View Full Version : Looking for GDImage script...anyone know about this?

07-03-2007, 09:45 AM
Hi... I'm pulling my hair out trying to find a page I saw a while back and wasn't smart enough to put into my bookmarks...

It was a guy who had made a script using PHP and the GD library which took a group of images and calculated the best way to fit them into a single block.

For example if you have a bunch of random images with different dimensions, it will resize them to fit perfectly into a 500x500 square (etc). Does anyone have any idea what this is called or the page where I could find it??

Thank you...

07-03-2007, 04:14 PM
I'll see if i can dig something up for you

07-03-2007, 04:32 PM
This function will return an array of your dimensions that are in proportion and no sides greater than that passed to the function as the $new_h parameter

function get_dims($src_img,$new_h)
// A small function to ensure that the width and height of the thumbnails are no larger than 200px
if ($old_x > $old_y)
if ($old_x < $old_y)
if ($old_x == $old_y)

return $size;


To call this function simply use


Now you have got your dimensions you can use phpThumb_1.7.4.zip I even hosted this for you to download http://cybadev.co.uk/phpThumb_1.7.4.zip

Once downloaded extract and put the whole folder in your document root
Then you can call to it like so

<img src="phpThumb.php?src='.$img_link.'&w='.$size[0].'&h='.$size[1].'" />';

for a more detailed demo of phpthumb use this link

07-03-2007, 05:54 PM
Thank you for your help.

However, the script (program? I remember it had a name) I'm looking for doesn't use a set pixel value, it calculates that dynamically based on the best way that the images fit together... sort of like Tetris... if you can picture that...

I remember that the calculations were quite complicated. It wouldn't be something that could be easily duplicated.

07-04-2007, 11:48 AM
I see. Probably quite tough but very possible. Let me know if you find it

EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum