Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

PHP Forum


You are currently viewing our PHP Forum as a guest. Please register to participate.
Login



Freelance Jobs

Reply
Sorting Images According To Size...
Old 10-27-2008, 03:07 AM Sorting Images According To Size...
Brian07002's Avatar
Defies a Status

Posts: 2,162
Name: ...
Location: ...
Trades: 0
Hi,

Can someone enlighten me with an answer to this? I want to sort images according to their dimensions in a php gallery...It's a free gallery nothing that fancy ( Link To Gallery Script ), but I wanted to find out if it would be possible to make all the image in each on of my galleries to be sorted according to their dimensions, or at least very similar dimensions, because under each image is some text links and I wanted them to all look as uniform as possible...Check here for an example of what I am referring to: http://millart.110mb.com/store/advertisements/ Do you see how the first two rows are uniform, then after that the images are different dimensions?

Tia,
-Brian
__________________
Made2Own

Please login or register to view this content. Registration is FREE

Last edited by Brian07002; 10-27-2008 at 03:09 AM..
Brian07002 is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 10-27-2008, 03:32 AM Re: Sorting Images According To Size...
NullPointer's Avatar
Will Code for Food

Posts: 2,815
Name: Matt
Location: Irvine, CA
Trades: 0
In the images you linked to the major difference seems to be in the height of the images rather than the width so it may be sufficient just to sort by height.

Use getimagesize to get the height of each image. Then construct an associative array where the key is the image height and the value is the filename. From there juse use ksort to sort the array.

If sorting by height is not good enough you can try a chainsort to group more similar images. Its a bit more complicated however... I can explain if needed but its a lot of typing to waste if my previous answer is good enough.

Hope that helps
__________________

Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
NullPointer is online now
Reply With Quote
View Public Profile Visit NullPointer's homepage!
 
Reply     « Reply to Sorting Images According To Size...
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.10007 seconds with 12 queries