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.

We've moved the forum!

Please use forum.silverstripe.org for any new questions (announcement).
The forum archive will stick around, but will be read only.

You can also use our Slack channel or StackOverflow to ask for help.
Check out our community overview for more options to contribute.

General Questions /

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

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

CRITICAL: Missing / Disappearing Images


Go to End


30 Posts   12337 Views

Avatar
Devlin

Community Member, 344 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, 344 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, 18 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.

Avatar
jaedb

Community Member, 6 Posts

21 March 2016 at 4:00pm

@forumq42 did you have any further insight into this issue? We're experiencing this problem on our websites and it genuinely seems to have no rhyme or reason. Our sites affected are running on various versions of SilverStripe, but upward of 3.1.1.

Any insight would be much appreciated!

Avatar
Sam

Administrator, 690 Posts

28 April 2016 at 9:55am

Hi everyone,

So you're all aware: this bug was fixed in SilverStripe 3.2. Specifically, the build task was replaced with RegenerateCachedImagesTask, which recreates the images instead of deleting them, and in so doing doesn't leave missing images.

If you're experiencing this problem, I recommend upgrading to SilverStripe 3.2 or later. If you really can't do that and what to try patching the issue yourself, you can see the relevant change here:
https://github.com/silverstripe/silverstripe-framework/pull/1723/commits/8908a6bcd7d1c6b812ecb12b2213d6f6598fd619

Thanks,
Sam

Go to Top