c::set('thumbs.filename','{safeName}-{width}x{height}.{extension}');
Expected
my-filename-300x150.png
In real life
my-filename-300x.png
Here is why
When creating the thumbnail I let the thumb calculate the height.
thumb( $page->image(), array('width' => 300) );
However I still expect it to rename the file by the size even if I donât set it.
Bug or feature?
- Is how it work now expected behaviour?
- Will it be changed in the future to reflect the image size, not the function call?
- If not, can we add another height-value, like âautoheightâ to have the height in the filename even if itâs not set by the template?
It is kind-of expected behavior, but you can see why it works like this in the code.
Actually, the fitting gets done in the driver, and thatâs after the filename gets determined.
I think it makes sense, as the filename should reflect what was requested by the user, not what the result is.
PS: Please open such issues directly on GitHub, as having them here is only useful if itâs something worth discussing. Once you are pretty sure itâs an actual bug, having issues tracked on GitHub makes more sense to keep the overview over all issues.
For my perspective it is a bug, but I also understand how itâs probably ment to work and why.
I still donât know if this is a bug or a feature. Should I still open an issue on GitHub instead?
Alright, thatâs a valid point.
Just for my understanding: Why do you want to customize your thumbs and especially in that way? I currently donât understand why having calculated values in the filename is relevant in this case, but maybe that can change.
OK, then itâs totally fine to have it here until the community has decided if it is a bug or not.
Just in general: You opened a lot of issues in the forum already. GitHub is better for issue tracking (this forum category is mostly for non-developers not familiar with GitHub), so for stuff you know should change (at least in your opinion) GitHub makes more sense.
Maybe I still suffering from the WordPress illness. They use the filenames like that.
For me I just want to see what sizes I have of each image, for an overview, like thisâŚ
my-picture.png
my-picture-300x200.png
my-picture-300x300.png
my-picture-500x100.png
For me the width is often most important but sometimes I might have a cropped image and then the height is important.
I think the default hashed filenames are crap (sorry for the ones I hurt). The hash donât tell me anything at all.
Yeah, and in that case, the height would be included, as it is in the option array.
Thatâs a valid opinion. But in my opinion, the thumb filenames ought to be unique. If you have the same image filename in two pages, it all collapses. Thatâs why the hash is in there by default.
I think that thumbs should be completely automatic, never altered manually (only by some kind of size optimizer, but they donât care about filenames) and work and live in the background. I personally didnât have to look at the generated thumbs in the folder structure once.
I agree, the thumbs are not visible in the panel, so a user will not see them and thus the information the file name provides, is of no importance as long as you donât go visiting the file system. And since the size of the thumb is determined by the options, to get the right thumb all you need to do is change the settings if you need another file size. So you donât have a reason to care if the file is there or not, because it is generated automatically anyway.
@texnixe @lukasbestle
Thumbs in page folder
I think this is a better way for storing thumbsâŚ
http://forum.getkirby.com/t/create-thumbnails-in-subdirectory-of-page/1468
The main reason is that they will be cleaned up when a page is deleted. Another reason is that the filenames donât collide when they are in a page folder.
For more reasons, scoll down in the linked post to see my list.
About file names
Because Iâm not a robot I like to see the size instead of a hash, at least for debuging.