473,487 Members | 2,671 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

PHP and Images

I posted this elsewhere but got no answer so I thought I would see if anyone
here is smarter. :)

I am creating a image management system and have a few questions, if anyone
could help

1) I read somewhere that storing images in a mysql database as a BLOB
reduces speed and efficiency. Is this true? I don't expect to be serving
many images although they could feasible get up to about 1000. I am instead
opting to just store the filename in the database and use that to grab the
image.

2) Assuming the latter (using just the filename in the database), I have a
question about file storad and dynamic images. Should I create the images
at runtime, including thumbnails, or should I, when the image is first
uploaded, create and save a thumbnail and a web version (maybe a 800 x 600
image) and
discard the high-quality uploaded image? My preview page could generate
anywhere from one to 25 thumbnails so I am a little hesitant to dynamically
create 25 thumbnails on a page; it seems to me that would have a definite
performance problem. However, I am somewhat tempted to do this because I
want the user to have the ability to easily change the thumbnail size and I
don't to have run a script that, everytime they change the thumbnails size,
loops through potentially 1000 images creating new thumbnails.

Any help or ideas?

Thanks,

wtgee

Jul 16 '05 #1
2 2850
On Sat, 26 Jul 2003 15:12:39 GMT, wtgee wrote:
I posted this elsewhere but got no answer so I thought I would see if anyone
here is smarter. :) I am creating a image management system and have a few questions, if anyone
could help


[snip]
I'm no expert, so you will probably get better answers. Automatically
creating thumbnails and storing them on disk is easy enough, and I tried
that. However, if you're going to be deleting files too, don't forget to
delete the relevant thumbnails in the same routine otherwise you'll clog up
the server's disk.

I have a 'gallery' section on my personal web site where the thumbnails are
created on the fly when the page is loaded. It uses the GD1 library for
this because my hosting service hasn't implemented GD2 (I used that when
developing the site, on my local system, and it produced better thumbnails
because I could use imagecopyresampled() rather than imagecopyresized() -
but selah). If you want to check it out, to judge performance, the page is
at:
http://www.webvivant.com/montcocher/gallery/

This page checks to see what subdirectories there are below it (using the
name of each subdir for each thumbnail table) and creates thumbnails from
all the jpg or png files in those sub-dirs. This means, to add a new image,
all I do is drop the image file into the relevant directory - no HTML
editing at all. To create a new section, I just create a sub-directory and
moving images from one section to another is similarly easy. I also wanted
to add captions to some images, so the page also looks for a .txt file with
the same name as the image in the same dir. Creating captions this way is
the work of a few moments using Notepad or Kwrite (depending which OS I'm
using at the time).

The thumbnails load fast enough for me (over a single 64k ISDN connection)
- but your needs may be different.

a+
Steve
Jul 16 '05 #2
> 1) I read somewhere that storing images in a mysql database as a BLOB
reduces speed and efficiency. Is this true? I don't expect to be serving
many images although they could feasible get up to about 1000. I am instead opting to just store the filename in the database and use that to grab the
image.
Yep - good plan! There are two main problems with putting images in the
database - one is speed, particularly on searching in the database, and also
general access. The second is that usually databases are much more
size-limited than the general webspace, so better to use the webspace than
database... especially as theres no disadvantage to using the files anyway.
2) Assuming the latter (using just the filename in the database), I have a question about file storad and dynamic images. Should I create the images
at runtime, including thumbnails, or should I, when the image is first
uploaded, create and save a thumbnail and a web version (maybe a 800 x 600
image) and
discard the high-quality uploaded image? My preview page could generate
What I decided to do is, on upload, create the thumbnail, and then just save
the original file - I wanted to keep the original so then people have the
choice to have a high quality image if they want it, and I just make this
fit the layout by sizing it with css.
anywhere from one to 25 thumbnails so I am a little hesitant to dynamically create 25 thumbnails on a page; it seems to me that would have a definite
performance problem. However, I am somewhat tempted to do this because I
Dynamically generating all the thumbnails at runtime will be a huge waste of
server resources!
want the user to have the ability to easily change the thumbnail size and I don't to have run a script that, everytime they change the thumbnails size, loops through potentially 1000 images creating new thumbnails.


You could easily make a simply script to go through your image directories
and generate new thumbnails. Even if it has to do 1000 and that takes a few
minutes, its nothing compared to the time it'd take to keep generating new
ones each time.

David
Jul 16 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

7
2350
by: Wayne | last post by:
I have a script that uses filesystemobject that reads files from a given path, in my case images. It is running on a server that is 2000 adv svr w/ all current patches. The script prior to some...
3
3809
by: Simon | last post by:
This problem has been driving me mad for months.... Seen a few posts on forums about it but no answers... No mention on MSDN etc. XP Pro SP1, VS.NET (c#) .Net framework 1.1, IIS 5.1. In a...
10
2290
by: Neo Geshel | last post by:
I am seeking to hand-roll my own blog in ASP.NET 2.0 and SQLExpress 2005. Why? Because I can. Because I will gain experience. The one thing that has me stumped at square one is inline images....
6
4596
by: wattanabi | last post by:
Greetings, I'm attempting to layout a bunch of images in a grid using DIV's instead of a table. I currently have a 3x6 table that I need to convert to css. I've seen various example of a 3 to 4...
2
3780
by: mouseit101 | last post by:
Hi, I'm writing a script that would (hopefully) search google images for whatever, and then return a list of URLs for the image. Right now I have: $dom = new DomDocument(); $url =...
0
1811
by: Frenchie | last post by:
Hi, I have created a very neet menu from an example found on the MSDN library at: http://msdn2.microsoft.com/en-us/library/system.web.ui.webcontrols.menuitembinding.imageurlfield.aspx My...
1
1371
by: Cerebral Believer | last post by:
Hi folks, I am using the following code for mouse over (roll-overs) in my XHTML code. <a onmouseover="document.getElementById('sitemap').src = '../images/buttons/sitemap_mo.jpg';"...
4
2946
toxicpaint
by: toxicpaint | last post by:
Hi, can anyone give me a hand. I'm currently displaying 4 random images at the top of a page. I did this using an array of 35 pictures and then writing them to page. The problem I have is that in...
5
4083
by: remon87 | last post by:
I need some help. I have javasript that creates the submenu but it works if I have a text with css. I need it to do the same with a roll over images. so when I click on the image the submenu...
0
7106
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7137
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
1
6846
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
5442
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
4874
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
4565
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3071
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
600
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
267
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.