Set maximum height of thumb/resize on upload - get imagemagick working?

trstn

Joined: 2010-06-14
Posts: 27
Posted: Mon, 2010-09-06 09:34

I'm using mediablock to pull items from gallery2 into this page: www.jennydmakeup.co.uk/beauty.php. Which works perfectly, but all the images need to be max 500px tall.

I tried using thumbs and setting max dimensions to 500 x 500, but gallery2 only seems to resize on the longest side, so landscape files work fine, but portrait end 500px wide, but a shorter.

Is there a way to use GD to set a standard height for either a) all thumbnails or b) all fullsize images so that Jenny doesn't need to resize her picture to 500px tall before upload?

I thought using imagemagick might be a solution but continually get 'The path you entered isn't a valid path' when I try to configure it (which seems to be a base error to do with part of cent OS I can't chage), so hoping for another solution

 
suprsidr
suprsidr's picture

Joined: 2005-04-17
Posts: 8339
Posted: Mon, 2010-09-06 12:58

You can have gallery build resizes to your specific needs and mediaBlock can poll for those sizes:
This example using the jQuery version to poll for nothing bigger than 800px
http://www.flashyourweb.com/gallery2/jquery_mediaBlock.php?g2_itemId=24203&g2_maxImageHeight=800&g2_maxImageWidth=800

-s
FlashYourWeb and Your Gallery with The E2 XML Media Player for Gallery2

 
suprsidr
suprsidr's picture

Joined: 2005-04-17
Posts: 8339
Posted: Mon, 2010-09-06 13:07

For CentOS imagemagick installs into /usr/local/bin by default so try that for your path.

Your host could have open_basedir restrictions if you cannot configure toolkits outside of your account space.

-s
FlashYourWeb and Your Gallery with The E2 XML Media Player for Gallery2

 
trstn

Joined: 2010-06-14
Posts: 27
Posted: Mon, 2010-09-06 16:46

You're an absolute legend supersidr, thanks so much for all the help you keep giving me ;)

I'm looking into the jquery tip now, also it does turn out open_basedir was my problem with imagemagick, resolved it using instructions here in case others have the same issue:

http://kb.mediatemple.net/questions/514/Enabling+PEAR+by+setting+your+open_basedir+and+include_path

 
trstn

Joined: 2010-06-14
Posts: 27
Posted: Mon, 2010-09-06 17:27

Ah, looked around (at length) but I don't seem to be able to find any downloads for jquery_mediaBlock, even tried cheekily reverse engineering the example you gave but no luck.

Is it available for download anywhere?

 
suprsidr
suprsidr's picture

Joined: 2005-04-17
Posts: 8339
Posted: Mon, 2010-09-06 18:15

the regular mediaBlock has the same functionality.
http://www.flashyourweb.com/gallery2/mediaBlock.php?g2_itemId=24203&g2_maxImageHeight=800&g2_maxImageWidth=800

Just have gallery build the resizes you desire:
Edit Root Album -> Album Tab -> Resized Images && Use these target sizes in all subalbums && Apply settings to existing items && and for all subalbums && Build resizes too

And then concatenate &g2_maxImageHeight=800&g2_maxImageWidth=800 to your mediaBlock query

BTW when gallery creates a 500x500 resize, the longest side will be 500

-s
FlashYourWeb and Your Gallery with The E2 XML Media Player for Gallery2

 
trstn

Joined: 2010-06-14
Posts: 27
Posted: Tue, 2010-09-07 10:55

Brilliant, I've applied that and it's helped, but I'm still having trouble with landscape images,I know you've said it's the longest side that becomes 500px, but is there anyway to override that to make all images 500px tall (be them portrait or landscape).

I manually edit the resize dimensions for each of the landscape images after upload, setting the dimensions to 500px all, then I can achieve right height (as seen with the first pic on the link below) but otherwise I'm getting images 500px wide but much shorter...

http://jennydmakeup.co.uk/fashion.php

I don't suppose it's possible to specify minimum/fixed height for all images?

Thanks again for all your help.

 
trstn

Joined: 2010-06-14
Posts: 27
Posted: Tue, 2010-09-07 11:45

Sorted it. I've set all the images so they're all over 500px tall within gallery2, and then using CSS to resize them to 500px tall within the page.

It's not the most elegant solution, but it works and it'll still give good looking images in everything outside of ie5. If there is a better way within gallery2 I'd love to hear it but I'm happy this works.

 
suprsidr
suprsidr's picture

Joined: 2005-04-17
Posts: 8339
Posted: Tue, 2010-09-07 12:12
Quote:
it'll still give good looking images in everything outside of ie5

Hell, most of us don't even support IE6 anymore.

Quote:
If there is a better way within gallery2 I'd love to hear it but I'm happy this works.

Not without hacking your image toolkit.

-s
FlashYourWeb and Your Gallery with The E2 XML Media Player for Gallery2

 
trstn

Joined: 2010-06-14
Posts: 27
Posted: Tue, 2010-09-07 12:41

Heh, perhaps I'll leave that to the pro's ;)

Took a bit of fumbling around but I've nailed what I was after, Jen should be very happy with it now, couldn't have done it without you suprsidr