Do I need a database?

They have: 2 posts

Joined: Jun 2016

We have a website with more than 5000 pictures and growing. When our members want to view the site pages, the pages are loading very slow. Each page has 10 to 60 pictures. We are a fully volunteer organization. Someone suggested that by using a database the pages will load a lot faster. Do we need a database? And how to create one? We do not have a tech in our volunteer, yet. Any help would be greatly appreciated.

Greg K's picture

He has: 2,141 posts

Joined: Nov 2003

In what way are you hoping to speed things up? Am I correct that you want to be able to limit how many images per page?

A database would be a good way to manage them, and allow you to categorize them, and change dynamically how many per page.

The first question for how to go about setting it up is what environment the site is currently using.

They have: 2 posts

Joined: Jun 2016

Dear Greg K,

While going into the website, it takes longer time to see the pages. The pages are loading, but very slowly. Each page may have 10 to 60 pictures.

We are using WYSIWYG software to create the site. It is windows based. We are hosting on the Linux based hosting system.

We want to speed things up for anyone who wanted to see the website and pictures.

Our website is - www.EmbraceSacredPlaces.org

I received several opinions regarding using database and not using database.

Thank you for your response.

Regards.

Greg K's picture

He has: 2,141 posts

Joined: Nov 2003

The big thing you need to speed up the site is to have thumbnails of the images, instead of displaying the full size image on the page.

Take for example this page: http://www.embracesacredplaces.org/britain.html

You have a total of 51megs of images for the viewer to see. A database is going to do nothing the change that. A system that lets you upload the images and it will auto make thumbnails of the images for you, that will make a HUGE difference. (Granted, most systems that allow this will be database driven in the background)

For fun, I just went through and resized those 28 images down to the size that you display them at, (180x180px). It drops the total image size needed down load to only about 1meg, that is 50megs less than what you have, a HUGE difference on page load. (And also resizing them properly, gets rid of the stretched resizes, like the first image in the third row down). It was nothing fancy, I did them with the free Gimp editor with these steps:

  1. Open the image in Gimp
  2. In top menu: Image -> Scale Image
  3. Set Width or Height (whichever is SMALLER) to 180 (let other one auto set)
  4. Click the "Scale" button at bottom
  5. In top menu: Image -> Canvas Size
  6. Set Width or Height (whichever is NOT already 180) to 180.
  7. Click the "Center" button to center the image
  8. Some images you may want to drag it to something other than center (ie, if there was a lot of sky over the main object, drag it up so there is less sky in the thumnail)
  9. Click the "Resize" button at bottom
  10. In top menu: File -> Export As
  11. It should default to the same directory you opened it, and default to .jpg, just add something like "_tn" or "_thumb" to the end (before the extension... filename_tn.jpg )
  12. Click "Export" button
  13. I let it defaults on the options screen (90 for quality level)

-Greg

They have: 4 posts

Joined: Aug 2016

using database to store image as binary quite expensive deal, the main problem is to delete the database and handling the exception.If your website is going slow it's your servers problem, databse can reduce it to few limits. You can make a website that works on Requests and action i.e. runs on MVC model. That is good exercise. store the address of your image location or image name in database and image location in hard disk is quite good option.

brucemesnekoff's picture

He has: 2 posts

Joined: Sep 2016

First thing, you should optimise your images. For example: A image is placed in a div with the 500px width and the image has 1200px width. Obviously the image is taking the more size with more size. So you should optimize your images first. The database option is also good. You can store the images name in the database and then just provide the reference with the image name to display.

Thanks Bruce Mesnekoff

Bruce Mesnekoff | Student Loan Consolidation Expert Bruce Mesnekoff | The Ultimate Student Loans Guide by Bruce Mesnekoff | Consolidation Preparer by Bruce Mesnekoff

Want to join the discussion? Create an account or log in if you already have one. Joining is fast, free and painless! We’ll even whisk you back here when you’ve finished.