View Full Version : image sorting script
01-14-2003, 06:22 AM
I know you've all seen those scripts out there where you have a list of items with little up/down buttons off to the side that enable you to re-order the items in the list without actually submitting a form for each individual move. (Example here: http://members.evolt.org/jeff/code/rank_select.cfm)
What I am actually looking for, however, is some way to modify a script like this so that images are displayed instead of text items. I would like to have a list of thumbnails and be able to click an up/down button next to each one (or else somehow highlight a particular thumbnail and click a master up/down button somewhere on the page) and have it work the same way as the text list scripts. I have searched unsuccessfully for something like this online...it's hard to get the keywords right, so I tend to end up with search results on how to place orders for scripts that sort things alphabetically rather than on scripts that allow you to re-order the items in a list. ;) Does anybody have any advice?
01-14-2003, 04:46 PM
Let me ask this first. What is the purpose of sorting the images in this way? How does it benefit the user? Once they have been sorted, then what?
Also, how many images? A static number, or variable?
01-14-2003, 07:26 PM
I'm trying to modify an image gallery script, which currently only sorts pictures by their filename within a particular folder. Sometimes, however, I would like to sort the pictures differently without having to go in and manually rename each one to make it work. The script would allow the user to move the thumbnails around into their preferred order, then clicking an OK button would send the list order to a PHP script which would write the data into an SQL table. I can handle that last part...it's just the actual manipulation of the thumbnails that stumps me. And yes, the number of images would vary.
01-14-2003, 09:22 PM
I think he is trying to make his own gallery script to sort images by name / size / date / etc that is hassle free when uploading more pics.
01-14-2003, 09:49 PM
I got it. Knowing the purpose helps me conceptualize it better.
Hmm, a few more questions. Are we dealing with lots of images here? I'm trying to picture the UI. The sorting thing you've pointed to as an example is easy to pull off because of the nature of a select element.
Since this is being submitting to PHP we need to construct a querystring, or use a form. It would be far easier to use a form. So if we had just images, we'd need to populate a hidden form the with the sorted data for submission. Or, if we had a form/image combo then we could just submit that form. If there was a form/image combo, how would you like it to look? Do you display your thumbnails in a horiz/vertical list? Or in rows and columns? Do you want the switching to take place with the images, the form control, or both?
As you can see, I'm just thinking out loud here, what do you think of all this?
01-15-2003, 03:53 AM
Sounds like everybody has got a grasp on what I'm trying to do. :-) That certainly makes it easier to discuss from here on out...
Usually in any particular photo album, I could have anywhere from a handful of pictures to a few dozen. Not likely to ever get into the hundreds. Currently the thumbnails are displayed five to a row, with as many rows as necessary to display all thumbs. For the sorting script, it would be preferable to keep this format with a small "<" and ">" button under each thumbnail, but if that proves too difficult, I suppose a vertical column would be acceptable. Your suggestion of using a hidden form alongside the graphical interface to create the post query string for the PHP script is a good one that I hadn't yet considered. Given the right jumping-off point, I can probably pull this off myself. I'm just unsure of how to even begin writing the script so that the thumbnails move freely back and forth.
Powered by vBulletin® Version 4.2.2 Copyright © 2017 vBulletin Solutions, Inc. All rights reserved.