Re: [PHP] Images : Store in dB or disk?

2003-01-16 Thread Marek Kilimajer


Bobby Patel wrote:


Hello,
I have the Images table setup with columns (width, height, size, type,
etc...) the question is should I have the image data stored in this table or
disk?

I know, alot of people have said it is faster in disk, which is 1 page I/O.
But I need these images for displaying product pages, and I believe that it
would be faster to just pluck the properties from the dB (including the
image file) .

Usually I will need to pull 6 or 10 images per page, this is my rational for
this situation:

If all stored on db:
One query  - will take about 4-5 page I/O (assumiing index on filename)


images will be requested separate, so there will be query to get the 
properties (page request), and queries to get the actual image data 
(requests for images).


If just properties stored on dB and image on disk:
One query to grab the rows of properties - 2-3 page I/O
to grab 6 or 10 images - 6 or 10 page I/O
Total - 8 - 13 Page I/O's

If all images stored on disk, no dB whatso ever:
to grab 6 or 10 images - 6 or 10 page I/O
cpu time to run getimagesize()  for each image - CPU time unknown?

I assume that page I/O is that same as disk access.

I AGREE that storing images strored on disk is a valid approach PROVIDED
that you only need 1 image per page, but if you need to grab a bunch at a
time, I do beleieve that storing the actual file on the dB is faster.

I would like to hear from the list, of people that have worked with images
and PHP. I just started with images, so I just want to take the right path.



 



--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




[PHP] Images : Store in dB or disk?

2003-01-15 Thread Bobby Patel
Hello,
I have the Images table setup with columns (width, height, size, type,
etc...) the question is should I have the image data stored in this table or
disk?

I know, alot of people have said it is faster in disk, which is 1 page I/O.
But I need these images for displaying product pages, and I believe that it
would be faster to just pluck the properties from the dB (including the
image file) .

Usually I will need to pull 6 or 10 images per page, this is my rational for
this situation:

If all stored on db:
One query  - will take about 4-5 page I/O (assumiing index on filename)

If just properties stored on dB and image on disk:
One query to grab the rows of properties - 2-3 page I/O
to grab 6 or 10 images - 6 or 10 page I/O
Total - 8 - 13 Page I/O's

If all images stored on disk, no dB whatso ever:
to grab 6 or 10 images - 6 or 10 page I/O
cpu time to run getimagesize()  for each image - CPU time unknown?

I assume that page I/O is that same as disk access.

I AGREE that storing images strored on disk is a valid approach PROVIDED
that you only need 1 image per page, but if you need to grab a bunch at a
time, I do beleieve that storing the actual file on the dB is faster.

I would like to hear from the list, of people that have worked with images
and PHP. I just started with images, so I just want to take the right path.



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP] Images : Store in dB or disk?

2003-01-15 Thread rw
Have a look at:

http://vrscenes.com/2003/gallery.php?mls=230944

and tell me what you think - all images are stored in the filesystem

Don't worry about what it looks like - I extracted this from the frameset it goes in

Cheers!

RW

Quoting Bobby Patel [EMAIL PROTECTED]:

### Hello,
### I have the Images table setup with columns (width, height, size, type,
### etc...) the question is should I have the image data stored in this table
### or
### disk?
### 
### I know, alot of people have said it is faster in disk, which is 1 page
### I/O.
### But I need these images for displaying product pages, and I believe that
### it
### would be faster to just pluck the properties from the dB (including the
### image file) .
### 
### Usually I will need to pull 6 or 10 images per page, this is my rational
### for
### this situation:
### 
### If all stored on db:
### One query  - will take about 4-5 page I/O (assumiing index on filename)
### 
### If just properties stored on dB and image on disk:
### One query to grab the rows of properties - 2-3 page I/O
### to grab 6 or 10 images - 6 or 10 page I/O
### Total - 8 - 13 Page I/O's
### 
### If all images stored on disk, no dB whatso ever:
### to grab 6 or 10 images - 6 or 10 page I/O
### cpu time to run getimagesize()  for each image - CPU time unknown?
### 
### I assume that page I/O is that same as disk access.
### 
### I AGREE that storing images strored on disk is a valid approach PROVIDED
### that you only need 1 image per page, but if you need to grab a bunch at a
### time, I do beleieve that storing the actual file on the dB is faster.
### 
### I would like to hear from the list, of people that have worked with
### images
### and PHP. I just started with images, so I just want to take the right
### path.
### 
### 
### 
### -- 
### PHP General Mailing List (http://www.php.net/)
### To unsubscribe, visit: http://www.php.net/unsub.php
### 
### 




-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP] Images : Store in dB or disk?

2003-01-15 Thread Bobby Patel
It looks nice. It does take a couple of seconds, (but I guess that is to be
expected with dealing with images).
I guess seeing your example, it seems that I can go with the filesystem. But
do you use the getimagezise function? do you set the width and height for
the IMG tag dynamically, or you don't use the image function and just have
the IMG tags already set in stone?

[EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
 Have a look at:

 http://vrscenes.com/2003/gallery.php?mls=230944

 and tell me what you think - all images are stored in the filesystem

 Don't worry about what it looks like - I extracted this from the frameset
it goes in

 Cheers!

 RW

 Quoting Bobby Patel [EMAIL PROTECTED]:

 ### Hello,
 ### I have the Images table setup with columns (width, height, size, type,
 ### etc...) the question is should I have the image data stored in this
table
 ### or
 ### disk?
 ###
 ### I know, alot of people have said it is faster in disk, which is 1 page
 ### I/O.
 ### But I need these images for displaying product pages, and I believe
that
 ### it
 ### would be faster to just pluck the properties from the dB (including
the
 ### image file) .
 ###
 ### Usually I will need to pull 6 or 10 images per page, this is my
rational
 ### for
 ### this situation:
 ###
 ### If all stored on db:
 ### One query  - will take about 4-5 page I/O (assumiing index on
filename)
 ###
 ### If just properties stored on dB and image on disk:
 ### One query to grab the rows of properties - 2-3 page I/O
 ### to grab 6 or 10 images - 6 or 10 page I/O
 ### Total - 8 - 13 Page I/O's
 ###
 ### If all images stored on disk, no dB whatso ever:
 ### to grab 6 or 10 images - 6 or 10 page I/O
 ### cpu time to run getimagesize()  for each image - CPU time unknown?
 ###
 ### I assume that page I/O is that same as disk access.
 ###
 ### I AGREE that storing images strored on disk is a valid approach
PROVIDED
 ### that you only need 1 image per page, but if you need to grab a bunch
at a
 ### time, I do beleieve that storing the actual file on the dB is faster.
 ###
 ### I would like to hear from the list, of people that have worked with
 ### images
 ### and PHP. I just started with images, so I just want to take the right
 ### path.
 ###
 ###
 ###
 ### --
 ### PHP General Mailing List (http://www.php.net/)
 ### To unsubscribe, visit: http://www.php.net/unsub.php
 ###
 ###






-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP] Images : Store in dB or disk?

2003-01-15 Thread Jason Wong
On Thursday 16 January 2003 13:23, Bobby Patel wrote:

 I AGREE that storing images strored on disk is a valid approach PROVIDED
 that you only need 1 image per page, but if you need to grab a bunch at a
 time, I do beleieve that storing the actual file on the dB is faster.

 I would like to hear from the list, of people that have worked with images
 and PHP. I just started with images, so I just want to take the right path.

I would say develop your application so that it both stores the images in the 
DB _and_ copies it to the filesystem -- it should only require a few more 
lines of code. Then have a flag at runtime which decides whether to retrieve 
images from DB or from filesystem. Once you have enough data you can easily 
determine which method is faster and subsequently comment/remove the 
insertion code for the slower method.

-- 
Jason Wong - Gremlins Associates - www.gremlins.biz
Open Source Software Systems Integrators
* Web Design  Hosting * Internet  Intranet Applications Development *

/*
Be sure to evaluate the bird-hand/bush ratio.
*/


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php