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 6591489
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T17:25:46+00:00 2026-05-25T17:25:46+00:00

In my web app i’m using MongoDB GridFS to store user uploaded images. The

  • 0

In my web app i’m using MongoDB GridFS to store user uploaded images.

The rest of the site is managed by MySQL.

In a photo table (in mysql) I have three fields for storing the MongoId of the file object.

  • small
  • medium
  • large

So I store three versions of the image. Small, medium and large.

My question is, sometimes i’ll need to use a thumbnail smaller than the ‘small’ version of the image (i.e. in a widget box, message avatars etc.) or i’ll need to use a slighly smaller version of the medium image.

So my question, would it better to just store one image in the GridFS system and then have one field in the photo table storing the MongoID and then create a script that resizes the image on the fly (i.e. http://localhost/image/fetch/{mongoid}?resize=50

Otherwise, in my db i’ll need thumbnail_50, thumbnail_100, medium_300, medium_400 etc. etc.

What would be the implications of going down the on-the-fly resize route? is it a bad or a good idea? What would you do?

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-25T17:25:46+00:00Added an answer on May 25, 2026 at 5:25 pm

    Resizing on the fly will result in far more CPU load on your server than resizing to a variety of sizes once, and storing the results. On the other hand, resizing ahead of time may result in a larger set of data to be stored in GridFS. In other words, it’s a tradeoff.

    You could consider a hybrid approach, where you resize on the fly but save the results back to GridFS so that you don’t need to resize any one image to a given size more than once.

    You should also know that HTML and CSS allow various options for controlling the displayed size of an image. For example:

    <img src="/path/to/image.jpg" width="50"/>
    

    Will result in an image scaled proportionally to 50 pixels wide (in most modern browsers, at any rate). You can also use the width and max-width CSS properties to control image size.

    For myself, and knowing nothing about the volume or file size of the images you’ll be storing, I’d probably resize when images are added — in other words, take the page speed and CPU load hit once — and then serve the various sizes out of GridFS, using max-width to control the on-screen size if a slightly different size is required in one particular case.

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

Sidebar

Related Questions

Our web app needs to be made PCI compliant, i.e. it must not store
In my (PHP) web app, I have a part of my site that keeps
My web app runs well except one thing. File Uplods. Basically when a user
My web app is using Rack 1.4.0, Sinatra v1.2.6, Thin v1.2.11, Ruby v1.9.2p180 Navigating
My web app (asp VB 2005) uses Windows authentication. If the user isn't part
The web app I'm working on allows a user to upload videos. The videos
I'm writing a web app that inserts and modifies HTML elements via AJAX using
My web app offers personalized recommendations. When a user starting to use it, about
I have created one web app using mvc and in that used form authentication
My web app using JMS to send mail via GMAIL as my SMTP server.

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.