Thumbnails
Permalink
Hi,
I am facing a problem in C5 5.7.5 with thumbnails.
I have created a custom thumbnails type : 250 (px) of width, and automatic height. But the generated thumbnails are weather 250 px wide (for the horizontal ones) OR 250 px tall. As if the number set in "width" was used as maximum width and maximum height.
Is it normal ?
In fact I am trying to customize an existing gallery add-on, so wonder if it is related to that (badly modified by me) add-on, or if it is a genuine C5 issue (or explanation-missing feature)..?
Thanks
I am facing a problem in C5 5.7.5 with thumbnails.
I have created a custom thumbnails type : 250 (px) of width, and automatic height. But the generated thumbnails are weather 250 px wide (for the horizontal ones) OR 250 px tall. As if the number set in "width" was used as maximum width and maximum height.
Is it normal ?
In fact I am trying to customize an existing gallery add-on, so wonder if it is related to that (badly modified by me) add-on, or if it is a genuine C5 issue (or explanation-missing feature)..?
Thanks
Hi,
Indeed, this addon (Thumb Gallery for 5.7) is creating its thumbnails through getThumbnail(). But it crops the thumbnails to fit a size defined by the user. You must specify a width AND a height or it doesn't work, but as I said, I'd like a free height...
That's why I'm trying to customize this addon, but it seems to be too complicated for me..:)
When I try to use Concrete's custom type thumbnails instead in the code (through getByHandle(), etc.), I get this problem I mentioned before, the width specified in the thumbnail type is used as max width as well as max height...
Thanks
Indeed, this addon (Thumb Gallery for 5.7) is creating its thumbnails through getThumbnail(). But it crops the thumbnails to fit a size defined by the user. You must specify a width AND a height or it doesn't work, but as I said, I'd like a free height...
That's why I'm trying to customize this addon, but it seems to be too complicated for me..:)
When I try to use Concrete's custom type thumbnails instead in the code (through getByHandle(), etc.), I get this problem I mentioned before, the width specified in the thumbnail type is used as max width as well as max height...
Thanks
"I have created a custom thumbnails type : 250 (px) of width, and automatic height. But the generated thumbnails are weather 250 px wide (for the horizontal ones) OR 250 px tall. As if the number set in "width" was used as maximum width and maximum height.
Is it normal ?"
In the file manager, I uploaded an image that is taller than it is wide (1098px x 1657px). I then checked the Medium Image thumbnail and it was 623px x 940px.
http://www.djc.com/blogs/SeattleScape/wp-content/uploads/2012/08/ch...
It does appear that automatic height is ignored. The setting for Medium Image is width "940" and height "Automatic. Based on this setting, the expectation is the image would be 940px x 1419px.
The add-on is most likely cropping the images so they are uniform in size and can fit into evenly spaced rows.
Using the getThumbnail() method appears to offer more control than using thumbnail types.
Here is an example of how getThumbnail() works:
If modifying the add-on is too complicated, you might look at some of the other gallery add-ons in the marketplace.
Is it normal ?"
In the file manager, I uploaded an image that is taller than it is wide (1098px x 1657px). I then checked the Medium Image thumbnail and it was 623px x 940px.
http://www.djc.com/blogs/SeattleScape/wp-content/uploads/2012/08/ch...
It does appear that automatic height is ignored. The setting for Medium Image is width "940" and height "Automatic. Based on this setting, the expectation is the image would be 940px x 1419px.
The add-on is most likely cropping the images so they are uniform in size and can fit into evenly spaced rows.
Using the getThumbnail() method appears to offer more control than using thumbnail types.
Here is an example of how getThumbnail() works:
<?php $imageHelper = Core::make('helper/image'); $file = File::getByID($fID); if (is_object($file)) { // getThumbnail($fileObject, maxWidth, maxHeight, crop) // - maxWidth and maxHeight are integers - setting them to "9999" effectively means "no maximum size" for that particular dimension // - crop set to true will crop the image // - crop set to false will not crop the image and preserve its dimension ratio // getThumbnail() creates an image object with these properties // - src // - width // - height // Example: // the image will not have a maximum width or maximum height // the image will not be cropped
Viewing 15 lines of 25 lines. View entire code block.
If modifying the add-on is too complicated, you might look at some of the other gallery add-ons in the marketplace.
Thanks a lot !
I will use the old getThumbnail system then. Your explanation is great.
Do you think that the current automatic height working is on purpose, or it is a bug that may be fixed ?
Thanks again.
I will use the old getThumbnail system then. Your explanation is great.
Do you think that the current automatic height working is on purpose, or it is a bug that may be fixed ?
Thanks again.
I am not sure if it is a bug.
Have you checked the bug tracker to see if anyone else is reporting this?
concrete5 bug tracker
https://www.concrete5.org/developers/bugs...
Have you checked the bug tracker to see if anyone else is reporting this?
concrete5 bug tracker
https://www.concrete5.org/developers/bugs...
Yes, I have checked everywhere before creating this discussion, but it seems like I am the only one concerned :) so, I don't dare to report a bug for now...
"In fact I am trying to customize an existing gallery add-on, so wonder if it is related to that (badly modified by me) add-on"
Which add-on are you trying to modify?
How is the add-on outputting images? Is it using thumbnails or grabbing the image object and resizing it (e.g. getThumbnail())?