By Book on Wednesday, 17 January 2018
Replies 1
Likes 0
Views 1K
Votes 0
Hi,

jevents creates thumbnails which works fine. But in case the original image is deleted the thumb stays. Is there some nice joomla or jevents way to get rid of those orphans? --- house cleaning. I would go with a cronjob bash, something like below, but would prefer to do it within joomla backend.

thanks,

toni



IFS=$'\n';
FULLMEDIAPATH="."
JEVENTSFOLDER="jevents"

# save all image names of media folder *except jevents* to array
array=( $(find "$FULLMEDIAPATH" -type f -name *.jpg -not -path "*/$JEVENTSFOLDER/*" | sed 's/.*\///') )

# loop through images of jevents and check if they exist in array of media array
for f in $(find "$FULLMEDIAPATH/$JEVENTSFOLDER" -name '*.jpg' -or -name '*.png'); do
if [[ ! " ${array[@]} " =~ `echo $f | sed 's/.*\///'i` ]]; then
echo "not found $f";
# rm $f;
fi
done

unset IFS;
Sorry - After we upgraded our forum software the site wasn't giving me unread assigned posts so I missed your question

The standard images plugin should delete the thumbnails when you delete the event.

Are you referring to the scaled images from the layout editor or the files with prefix "thumb_"? Also can you confirm if you are using the Joomla media manager to select your images or the JEvents uploader?
·
Wednesday, 28 February 2018 16:33
·
0 Likes
·
0 Votes
·
0 Comments
·
View Full Post