Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6747431
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T12:26:29+00:00 2026-05-26T12:26:29+00:00

I have multiple images stored at URLs like: /uploads/hash/IMAGE001.jpg . Using jQuery UI’s sortable()

  • 0

I have multiple images stored at URLs like: /uploads/hash/IMAGE001.jpg. Using jQuery UI’s sortable(), I want to sort and store the order of the images asynchronously.

I’ve come up with a couple ways to do this, and am curious what the best method would be.

I can create an SQL table for each of the /hash/ directories with 3 columns (ID, IMAGE_URL, IMAGE_INDEX) and update the table’s _INDEX values at every sort. Then, I can grab the sorted list of IMAGE_URLs by querying the database with ORDER BY IMAGE_INDEX.

Another idea I had was to name the files with a preceding 0000 (eg. /uploads/hash/0000IMAGE001.jpg). If I rename the files in PHP at every sort, I can grab the /hash/ directory of images in PHP with opendir() without the SQL overhead, then order by filename at the client or server end.

Would I run into any bottlenecking issues with lots of concurrent file renaming (vs concurrent SQL table updates)? How does the performance of grabbing a directory listing from PHP differ from querying SQL with ORDER BY?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T12:26:29+00:00Added an answer on May 26, 2026 at 12:26 pm

    You should sort with a database in this case,

    1. The database will build B-tree index and keep sorted for fast retrieval and update.
    2. You can make range queries on the file.
    3. You can change the storage of the actual file without coupling with the look up.
    4. You can scale to a huge number of images with memcachd and sharding on multiple machine

    The file system is not designed for sorting and managing change.

    1. Though fast when number of file is small, it will take longer and longer time to sort.
    2. The image itself is tied intimately to the id, this restrict flexibility.
    3. Limit you to one machine, one directory and by the OS limitations, you will have to scale by building this up more and more, end up with building your own pseudo-database.
    4. On a server this will be hellish, OS locks and concurrency management is not as sophisticated as db.

    Using a DB is the way to do so for any “real” application, using the file system is a quick hack.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have to create a multiple directory like this path(images/wallpaper/flower). It should be stored
I have multiple images that have the same class attribute and I want to
I am using AS3 to create a tween affect between multiple images that have
If we have a website with multiple images and videos, I've read that it's
I have multiple projects in a couple of different workspaces. However, it seems like
I want to display multiple images in a view. Images are downloaded from internet
I am trying to upload multiple images using meioupload which works fine if I
I have about 60 images I want to store in Core Data, 30 of
We have an application with multiple windows on different screens using 3 graphic cards.
On my asp.net mvc page I need to render multiple images that are stored

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.