You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Image::PreviewLink() always calls ImageManipulation::FitMax(), which in turn will always create a copy of an image if one doesn't exist, regardless of whether or not the image is large enough to be rescaled. I'm not exactly sure where in this chain of events it should happen, but I feel like there should be a check against the File::resample_images config setting to prevent this from happening and to just use the full-size image's URL if resample_images is set to false. At least, I can work around this for now by subclassing Image and editing the config for File::class_for_file_extension to override the default class definitions for the image extensions.
In my use-case, I'm not using SilverStripe as a traditional CMS - I do not need images to be optimized for quick delivery and consumption, and do not want the assets directory to be littered with thumbnails alongside the source images.
The text was updated successfully, but these errors were encountered:
I'm not sure whether to label this a bug or an enhancement.... does this actually cause some failure of functionality at all or is the only downside that you have more files on the filesystem?
I personally feel this should probably be labeled as a bug. While there isn't a "failure" in the sense of something being rendered unusable, the fact remains that there is a switch here, and the functionality that it purportedly controls still happens regardless of whether it's switched "off". That is, by definition, a bug.
I'm aware I have a strange use-case and I don't kid myself for a moment thinking that there's any urgency or high priority to it, but when something doesn't do the thing it's described to do, it should be brought to attention.
I'm just looking at the code now. The PHPDoc comment for the resample_images configuration property says:
Control whether images in the admin will be resampled
In other words this configuration must not affect the front-end. Really it should be declared somewhere in silverstripe/asset-admin... but in any case, the PreviewLink() method can be used on the front-end to get a thumbnail for display, so the problem isn't so much that PreviewLink() ignores the config setting, but that it is used by asset-admin regardless of the setting.
I'm going to rename the issue to reflect that and move it to the asset-admin repository.
GuySartorelli
changed the title
Image PreviewLink ignores resample_images config setting and generates a thumbnail anyway
Image PreviewLink should not be used by asset-admin, because it ignores resample_images config setting
Jul 19, 2023
Image::PreviewLink()
always callsImageManipulation::FitMax()
, which in turn will always create a copy of an image if one doesn't exist, regardless of whether or not the image is large enough to be rescaled. I'm not exactly sure where in this chain of events it should happen, but I feel like there should be a check against theFile::resample_images
config setting to prevent this from happening and to just use the full-size image's URL ifresample_images
is set tofalse
. At least, I can work around this for now by subclassingImage
and editing the config forFile::class_for_file_extension
to override the default class definitions for the image extensions.In my use-case, I'm not using SilverStripe as a traditional CMS - I do not need images to be optimized for quick delivery and consumption, and do not want the assets directory to be littered with thumbnails alongside the source images.
The text was updated successfully, but these errors were encountered: