Is there any way I can get g3 to make all my thumbs square? And not square by squishing, but square by cropping, if that makes sense. Working on a theme and I think it would be much better if all thumbs were the same size/orientation.
No, you'll need to create the plugin for that. It's not meant to be part of the core product. There is already a task made for that and I believe it's marked "Field of Dreams" meaning the core dev team has no intention of coding it themselves or it's extremely low priority if one of them happens to have an interest in that plugin. Someone else will probably need to get to it first.
____________________________________________
Like Gallery? Like the support? Donate now!!! See G2 live here
Note that includes the default values. When you change your settings, we remove and re-add the rules. There's no separate rule for album vs. photo thumbnail. We call graphics::generate() in modules/gallery/helpers/graphics.php to run the rules for any given item.
I did get that far, but what puzzles me is that while photo thumbs are square one for albums are proportional.
Any hints what may cause this?
nivekiam
Joined: 2002-12-10
Posts: 16504
Posted: Thu, 2009-07-16 05:00
I'm not seeing that. My photos are proportional as well as the album thumbs.
____________________________________________
Like Gallery? Like the support? Donate now!!! See G2 live here
No idea. I'm using a completely unmodified B2 at the moment.
____________________________________________
Like Gallery? Like the support? Donate now!!! See G2 live here
jasonh
Joined: 2009-07-09
Posts: 31
Posted: Thu, 2009-07-16 17:14
Serge your thumbs being the same size and proportions no matter the input image is what gave me the idea to ask
I see that they are no different now...did you change anything, or did you have some kind of funky leftover from a g2 import maybe?
Serge D
Joined: 2009-06-11
Posts: 2466
Posted: Fri, 2009-07-17 03:08
Yes, they are now all not in the way I want them to be... Story is as following:
a) I have square thumbs in my gallery 2. My guess from the looking at the code, import process imports data as is meaning if there is a thumb in G2 which is square, import would pick it as is. This does not apply to albums since thumbs are dynamic
b) Last night I did dump everything from thumbs and resizes folders which caused all the pictures goes bad/missing. Following up on the problem I have seen the suggestion to adjust thumb and resize dimensions on the theme options page (200->201->200, 640->639->640) and then rebuild the pictures.
Well... it did not go well because code in graphics.php does not recreate the folder structure...
Ok... after some research I did the following adjustments in modules/gallery/helpers/graphics.php (true would force folder structure):
(Update 6:28pm) - improved handling of the folder recreation
static function generate...
...
if ($item->thumb_dirty) {
$ops["thumb"] = $item->thumb_path();
self::ensure_path($item->thumb_path());}
if ($item->resize_dirty && !$item->is_album() && !$item->is_movie()) {
$ops["resize"] = $item->resize_path();
self::ensure_path($item->resize_path());
}
static function resize...
...
} else {
// ensure that folder exists
self::ensure_path($output_file));
Image::factory($input_file)
That may not be final solution, or could be overkill, but it does what it is suppose to do - allows recreate proper folder structure and refresh all resizes/thumbs.
I've kind of gotten the square thumb "look" working so far...it's really just a pretty bad hack... All I did was set my thumb size to 301px (crashed on 300 for some reason and wouldn't start back up), so my 4x6 aspect ratio photos would have 200px on the short side. Then my div blocks in the theme I'm working on are set to 200x200 and the overflow is hidden. changing the vertical alignment on the images will change which portion is shown. The only time this causes a problem is when I have a photo that is cropped to a different aspect ratio.
my beta-gallery testing different techniques for a theme (so yeah, it's ugly): http://g3.jasonhight.net
It's actually a really simple fix in the command-line for ImageMagick to get what we're looking for, but I can't for the life of me find anywhere in the code that calls the actual IM binary.
Serge D
Joined: 2009-06-11
Posts: 2466
Posted: Thu, 2009-07-16 22:57
To say everything is here in code - classes support crop properly, but I am having difficulty as well to find where crop could be called instead of resize for thumbs...
jasonh
Joined: 2009-07-09
Posts: 31
Posted: Sun, 2009-07-19 17:53
For anybody interested, I've come up with a solution for those using ImageMagick:
Posts: 16504
No, you'll need to create the plugin for that. It's not meant to be part of the core product. There is already a task made for that and I believe it's marked "Field of Dreams" meaning the core dev team has no intention of coding it themselves or it's extremely low priority if one of them happens to have an interest in that plugin. Someone else will probably need to get to it first.
____________________________________________
Like Gallery? Like the support? Donate now!!! See G2 live here
Posts: 31
Bummer. Thanks for the info.
Posts: 16504
http://sourceforge.net/apps/trac/gallery/ticket/445
____________________________________________
Like Gallery? Like the support? Donate now!!! See G2 live here
Posts: 2466
Would it be then possible to point at the part of the code where album thumbs are built versus image thumbs?
Posts: 7994
modules/gallery/helpers/gallery_installer.php defines these rules:
Note that includes the default values. When you change your settings, we remove and re-add the rules. There's no separate rule for album vs. photo thumbnail. We call graphics::generate() in modules/gallery/helpers/graphics.php to run the rules for any given item.
---
Problems? Check gallery3/var/logs
bugs/feature req's | upgrade to the latest code | use git | help! vote!
Posts: 2466
I did get that far, but what puzzles me is that while photo thumbs are square one for albums are proportional.
Any hints what may cause this?
Posts: 16504
I'm not seeing that. My photos are proportional as well as the album thumbs.
____________________________________________
Like Gallery? Like the support? Donate now!!! See G2 live here
Posts: 2466
Could you visit my gallery? http://photo.dragonsoft.us
Posts: 16504
No idea. I'm using a completely unmodified B2 at the moment.
____________________________________________
Like Gallery? Like the support? Donate now!!! See G2 live here
Posts: 31
Serge your thumbs being the same size and proportions no matter the input image is what gave me the idea to ask
I see that they are no different now...did you change anything, or did you have some kind of funky leftover from a g2 import maybe?
Posts: 2466
Yes, they are now all not in the way I want them to be... Story is as following:
a) I have square thumbs in my gallery 2. My guess from the looking at the code, import process imports data as is meaning if there is a thumb in G2 which is square, import would pick it as is. This does not apply to albums since thumbs are dynamic
b) Last night I did dump everything from thumbs and resizes folders which caused all the pictures goes bad/missing. Following up on the problem I have seen the suggestion to adjust thumb and resize dimensions on the theme options page (200->201->200, 640->639->640) and then rebuild the pictures.
Well... it did not go well because code in graphics.php does not recreate the folder structure...
Ok... after some research I did the following adjustments in modules/gallery/helpers/graphics.php (true would force folder structure):
(Update 6:28pm) - improved handling of the folder recreation
Added a new function
Adjusted following parts of the code
That may not be final solution, or could be overkill, but it does what it is suppose to do - allows recreate proper folder structure and refresh all resizes/thumbs.
This is today. Last night I have created a case http://sourceforge.net/apps/trac/gallery/ticket/550
and I am hopelessly (Field of Dreams) looking forward to have case http://sourceforge.net/apps/trac/gallery/ticket/445 implemented or for any information what I have to modify to force square thumbs
Posts: 31
I've kind of gotten the square thumb "look" working so far...it's really just a pretty bad hack... All I did was set my thumb size to 301px (crashed on 300 for some reason and wouldn't start back up), so my 4x6 aspect ratio photos would have 200px on the short side. Then my div blocks in the theme I'm working on are set to 200x200 and the overflow is hidden. changing the vertical alignment on the images will change which portion is shown. The only time this causes a problem is when I have a photo that is cropped to a different aspect ratio.
my beta-gallery testing different techniques for a theme (so yeah, it's ugly): http://g3.jasonhight.net
It's actually a really simple fix in the command-line for ImageMagick to get what we're looking for, but I can't for the life of me find anywhere in the code that calls the actual IM binary.
Posts: 2466
To say everything is here in code - classes support crop properly, but I am having difficulty as well to find where crop could be called instead of resize for thumbs...
Posts: 31
For anybody interested, I've come up with a solution for those using ImageMagick:
http://gallery.menalto.com/node/89120#comment-314345
Posts: 2466
Ok, will continue there