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

  • SEARCH
  • Home
  • 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 6226465
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T09:02:07+00:00 2026-05-24T09:02:07+00:00

So here is how we plan on doing it in PHP, but we don’t

  • 0

So here is how we plan on doing it in PHP, but we don’t know if this is advisable. If not, please kindly explain a better alternative.

Let me point out that we would be storing different resolutions of the same image for different devices so that we don’t have to render them in different resolutions on-the-fly which constantly eats up CPU.

So this is how we planning on storing the user pics:

Let’s say we’re storing an image in resolutions of 640px and 320px widths, the user is user 1, and they have one pic. We would store it in:

.../1/640/1.jpg
.../1/320/1.jpg

User 2’s first pic would be stored in:

.../2/640/1.jpg
.../2/320/1.jpg

So if we needed User 2’s 640px pic, we would fetch .../2/640/1.jpg and if we needed User 1’s 320px pic, we would simply fetch .../1/320/1.jpg.

We would then simply store additional pics numerically, so if User 1 uploaded a new pic, it would be stored in:

.../1/640/2.jpg
.../1/320/2.jpg

Their DEFAULT PIC displayed on their profile would ALWAYS be 1.jpg, so if they decided to make their 2nd pic their default pic, we would simply rename all the 2.jpg’s to 1.jpg, and all the 1.jpg’s to 2.jpg’s. Does that make sense?

That way, we can always call their Default pic easly by just pulling in 1.jpg from whatever resolution directory we needed to display.

As more pics are added, we just increment their filename numerically (3.jpg, 4.jpg, etc.) and make corresponding copies in each resolution’s sub-directories (…/640/ and …/320/ for example).

The order of the pics would simply be their numeric order and would be displayed as such, and if the user wanted to change the order of the pics, we would simply rename the files accordingly in EACH resolution’s directory. Yes, a lot of work during each change, but no more work needed until the next change.

What we like about this method is that we do not need to invoke the Database at all since all users will have the same structure based on their User ID.

I hope that all makes sense!

Is this a good method for storing multiple user pics? If not, why not?

Is there a better method? If so, can you please kindly describe it?

Thanks!

  • 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-24T09:02:07+00:00Added an answer on May 24, 2026 at 9:02 am

    This is how I’ve done it in multiple situations:

    • Store raw picture somewhere
    • Generate image-src, like: src="1234_640x320.png" or src="image.php?id=... (could also include the user id if necessary)
    • Route this (mod_rewrite, only needed if you don’t directly use a php file) to a php file, which will check for the actual existence of the resized image (analyzing the original path or using get-variables).
    • if the image is not yet resized, resize and store it
    • redirect (303) to the new file (next time the image will be resized, so the whole calculation is only done once)

    Update:

    to clearify:

    The idea is to use the request, path or variables, which should in some way include all the needed resize-information, to generate a final storage path.
    The path is then checked to actually being a valid image. If not, a resized image will be stored at that location. Implemented correctly, the recalculation only needs to be executed on one request.

    The main advantage would be, that it isn’t needed to know all dimensions beforehand. Say for example you’ll suddenly need to serve the image in new dimensions, with this implementation you’ll only need to update the code actually rendering the image-tag.

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

Sidebar

Related Questions

I know this questions has been asked a few times here. But these seem
I'm doing a webapp and need a backup plan. Here's what I've got so
What am I doing wrong here? $sub_data = $this->Subscriber->find('all', array( 'joins' => array( 'table'
Here is my plan, and goals: Overall Goals: Security with a certain amount of
Here's a coding problem for those that like this kind of thing. Let's see
I am doing my first database project. I would like to know what is
Currently, I only know a way of doing RPC for POJOs in Java, and
My select form is working perfectly, but my label will not display no matter
Hopefully more of a What am I doing wrong? than How do I? but
This may not be possible without writing some crazy extension method which I do

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.