Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

General Questions /

General questions about getting started with SilverStripe that don't fit in any of the categories above.

Moderators: martimiz, Sean, biapar, Willr, Ingo, swaiba, simon_w

CRITICAL: Missing / Disappearing Images


Go to End
Reply


28 Posts   4828 Views

Avatar
Devlin

Community Member, 217 Posts

7 February 2014 at 10:27pm

Don't use FlushGeneratedImageTask. It will "Remove all cached/generated images created as the result of an image manipulation" and "Actually clear out all the images".

All resized images inside HTMLEditors will be lost, because the path to the resized image is hardcoded in the image tag.

e.g.:
- You have "assets/Uploads/_resampled/ResizedImage200268-02.jpg" somewhere
- FlushGeneratedImageTask will remove all cached images
- "assets/Uploads/_resampled/ResizedImage200268-02.jpg" doesnt exists anymore
- edit "assets/Uploads/_resampled/ResizedImage200268-02.jpg" to "assets/Uploads/02.jpg" and save the DataObject
- a new "assets/Uploads/_resampled/ResizedImage200268-02.jpg" will be generated.

Avatar
flipsidenz

Community Member, 49 Posts

19 February 2014 at 8:36am

Edited: 19/02/2014 8:44am

Hmmm, that's a bit of an oversight....

Okay, how about this slight change of tack. When I was calling "FlushGeneratedImagesTask", I was only concerned with flushing the resampled folder of a specific directory within "assets/".

Is there a way to flush all generated images within a certain folder only?

Avatar
Devlin

Community Member, 217 Posts

19 February 2014 at 9:52pm

Sure. Write your own FlushGeneratedImagesTask?

Anyhow, cached images will be deleted if its original image get deleted. So there is really no good reason to use this task other than to have a clean state for development purposes.

@see
Image->onBeforeDelete()
Image->deleteFormattedImages()

Avatar
forumq42

Community Member, 15 Posts

31 October 2014 at 12:41pm

*bump*

I seem to be having this occur on a couple of my sites (2.4.x), but not all of them. (Seemingly) random disappearance of images in various _resampled directories. The originals stick around, and the _resampled ones reappear upon saving the pages again.

However it's still not clear to me what triggers the _resampled images to be deleted, when this is occurring.

Is it happening periodically due to something like a cron job (though I can't find crontabs for any user on the system this is happening on). Or SilverStripe schedules a daily/weekly task on it's own that flushes the images? Or is it the result of some action when logged into the web-based interface to the CMS.

It's not all the images on the system. At least not one of the sites. One of the new system it did appear all of the images were disappearing after being up for a few days fine. As in maybe they were disappearing 1x a day. I'm still trying to narrow down the times this has been occurring.

Ultimately I would prefer to understand what causes the flushes, how to alleviate the behavior and why it seems to occur on some sites and not others.

Go to Top