Storing 4KB jpeg images on hospital web server

Storing 4KB jpeg images on hospital web server

am 08.03.2007 05:06:39 von Chetan Graham

Hi to All,

There is a page on our hospitals website where a patient can look at the
choice of different doctors with their credentials, publications, hobbies,
etc.Each doctor has or will have a 3-4KB jpeg image as well.

We are using MySQL5.0.2.7 with PHP5.2.1
My question concerns the following:
The existing table's fields with one for the image:

TABLE finddoc
id-int,not null, auto inc., unsigned,
name varchar(25),
desig varchar(30),
dept varchar(20),
email varchar(50),
image varchar(6000),
qualification varchar(100),
publications longtext,
areaofinterest longtext, not null,
achievements longtext not null,

My job is to develop a page where a admin user can create and edit
existing doctor profiles. My question is about the image uploading part.
I have a feeling the one field given to me for images is quite limited.
Would it not be better to add another table with all the image info. such
as the following?

CREATE TABLE image (
image_id int(10) unsigned NOT NULL auto_increment,
image_type varchar(50) NOT NULL default '',
image longblob NOT NULL,
image_size bigint(20) NOT NULL default '0',
image_name varchar(255) NOT NULL default '',
image_date datetime NOT NULL default '0000-00-00 00:00:00',
UNIQUE KEY image_id (image_id)
);

This will give greater control of the images or better manipulation of data.
If it is recommended by you php/mysql higher souls to add a table such as
this. Then I have more questions. Or perhaps the existing table is fine.
One might guess I inherited this project.
Blessings,
Chetan

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

Re: Storing 4KB jpeg images on hospital web server

am 08.03.2007 05:16:56 von dmagick

Chetan Graham wrote:
> Hi to All,
>
> There is a page on our hospitals website where a patient can look at the
> choice of different doctors with their credentials, publications, hobbies,
> etc.Each doctor has or will have a 3-4KB jpeg image as well.
>
> We are using MySQL5.0.2.7 with PHP5.2.1
> My question concerns the following:
> The existing table's fields with one for the image:
>
> TABLE finddoc
> id-int,not null, auto inc., unsigned,
> name varchar(25),
> desig varchar(30),
> dept varchar(20),
> email varchar(50),
> image varchar(6000),
> qualification varchar(100),
> publications longtext,
> areaofinterest longtext, not null,
> achievements longtext not null,
>
> My job is to develop a page where a admin user can create and edit
> existing doctor profiles. My question is about the image uploading part.
> I have a feeling the one field given to me for images is quite limited.
> Would it not be better to add another table with all the image info. such
> as the following?
>
> CREATE TABLE image (
> image_id int(10) unsigned NOT NULL auto_increment,
> image_type varchar(50) NOT NULL default '',
> image longblob NOT NULL,
> image_size bigint(20) NOT NULL default '0',
> image_name varchar(255) NOT NULL default '',
> image_date datetime NOT NULL default '0000-00-00 00:00:00',
> UNIQUE KEY image_id (image_id)
> );
>
> This will give greater control of the images or better manipulation of data.
> If it is recommended by you php/mysql higher souls to add a table such as
> this. Then I have more questions. Or perhaps the existing table is fine.
> One might guess I inherited this project.

Do you need to store the image in the database (either for security
reasons or something like replication) ?

Maybe it would be easier to store them in a folder for each doctor on
the server directly rather than in the DB.

eg create a doctor_images/{doctor_id}/ folder and upload the images
there.. then you don't have to worry about the db etc.

--
Postgresql & php tutorials
http://www.designmagick.com/

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

RE: Storing 4KB jpeg images on hospital web server

am 08.03.2007 05:37:33 von Bastien Koert

best sore the image on the filesystem and use that field to store the path
and image name. Its simpler to manage

Bastien


>From: "Chetan Graham"
>To: php-db@lists.php.net
>Subject: [PHP-DB] Storing 4KB jpeg images on hospital web server
>Date: Thu, 8 Mar 2007 07:06:39 +0300 (EAT)
>
>Hi to All,
>
>There is a page on our hospitals website where a patient can look at the
>choice of different doctors with their credentials, publications, hobbies,
>etc.Each doctor has or will have a 3-4KB jpeg image as well.
>
>We are using MySQL5.0.2.7 with PHP5.2.1
>My question concerns the following:
>The existing table's fields with one for the image:
>
>TABLE finddoc
>id-int,not null, auto inc., unsigned,
>name varchar(25),
>desig varchar(30),
>dept varchar(20),
>email varchar(50),
>image varchar(6000),
>qualification varchar(100),
>publications longtext,
>areaofinterest longtext, not null,
>achievements longtext not null,
>
>My job is to develop a page where a admin user can create and edit
>existing doctor profiles. My question is about the image uploading part.
>I have a feeling the one field given to me for images is quite limited.
>Would it not be better to add another table with all the image info. such
>as the following?
>
>CREATE TABLE image (
>image_id int(10) unsigned NOT NULL auto_increment,
>image_type varchar(50) NOT NULL default '',
>image longblob NOT NULL,
>image_size bigint(20) NOT NULL default '0',
>image_name varchar(255) NOT NULL default '',
>image_date datetime NOT NULL default '0000-00-00 00:00:00',
>UNIQUE KEY image_id (image_id)
>);
>
>This will give greater control of the images or better manipulation of
>data.
>If it is recommended by you php/mysql higher souls to add a table such as
>this. Then I have more questions. Or perhaps the existing table is fine.
>One might guess I inherited this project.
>Blessings,
>Chetan
>
>--
>PHP Database Mailing List (http://www.php.net/)
>To unsubscribe, visit: http://www.php.net/unsub.php
>

____________________________________________________________ _____
Win a trip for four to a concert anywhere in the world!
http://www.mobilelivetour.ca/

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

Re: Storing 4KB jpeg images on hospital web server

am 08.03.2007 07:29:03 von Chetan Graham

> Chetan Graham wrote:
>> Hi to All,
>>
>> There is a page on our hospitals website where a patient can look at the
>> choice of different doctors with their credentials, publications,
>> hobbies,
>> etc.Each doctor has or will have a 3-4KB jpeg image as well.
>>
>> We are using MySQL5.0.2.7 with PHP5.2.1
>> My question concerns the following:
>> The existing table's fields with one for the image:
>>
>> TABLE finddoc
>> id-int,not null, auto inc., unsigned,
>> name varchar(25),
>> desig varchar(30),
>> dept varchar(20),
>> email varchar(50),
>> image varchar(6000),
>> qualification varchar(100),
>> publications longtext,
>> areaofinterest longtext, not null,
>> achievements longtext not null,
>>
>> My job is to develop a page where a admin user can create and edit
>> existing doctor profiles. My question is about the image uploading part.
>> I have a feeling the one field given to me for images is quite limited.
>> Would it not be better to add another table with all the image info.
>> such
>> as the following?
>>
>> CREATE TABLE image (
>> image_id int(10) unsigned NOT NULL auto_increment,
>> image_type varchar(50) NOT NULL default '',
>> image longblob NOT NULL,
>> image_size bigint(20) NOT NULL default '0',
>> image_name varchar(255) NOT NULL default '',
>> image_date datetime NOT NULL default '0000-00-00 00:00:00',
>> UNIQUE KEY image_id (image_id)
>> );
>>
>> This will give greater control of the images or better manipulation of
>> data.
>> If it is recommended by you php/mysql higher souls to add a table such
>> as
>> this. Then I have more questions. Or perhaps the existing table is
>> fine.
>> One might guess I inherited this project.
>
> Do you need to store the image in the database (either for security
> reasons or something like replication) ?
>***Chetan writes:Actually the DB table 'finddoc' holds data for all
fields except the 'image' field. In this field, right now, it only
holds the reference to the web folder where the images are stored. All
the doctors images are in the same folder. The problem is my job is to
bring all the profiles up to the current level of doctors in the
hospital. We have close to 300 doctors right now working.

This is the reason I was thinking of actually putting the images in the
DB. However, whatever is easier and just as effective. Please let me
know if this has any bearing on your unexpected and excellent observation
of using the web server's file folders. You might want to check out the
web site as it is now. Only a small percentage of the doctors are listed
and not many photo's at all.


http://www.aimshospital.org/findadoc/find-a-doctor.php?id=47

>
> Maybe it would be easier to store them in a folder for each doctor on
> the server directly rather than in the DB.
>
> eg create a doctor_images/{doctor_id}/ folder and upload the images
> there.. then you don't have to worry about the db etc.
>
> --Thank you for your quick and to the point reply. I have something to
consider an about face in the design! Chetan
> Postgresql & php tutorials
> http://www.designmagick.com/
>

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

Re: Storing 4KB jpeg images on hospital web server

am 08.03.2007 09:18:52 von bedul

i do know there's no problem upload 4kb img to database
but is different case for.. 1mb pic.. it always fail.
> >>
> >> CREATE TABLE image (
> >> image_id int(10) unsigned NOT NULL auto_increment,
> >> image_type varchar(50) NOT NULL default '',
my application said is header
------------------------------------------------------------ ----

> >> image longblob NOT NULL,
> >> image_size bigint(20) NOT NULL default '0',
u don't need size.. since is able to count/strlen from image
------------------------------------------------------------ -

> >> image_name varchar(255) NOT NULL default '',
> >> image_date datetime NOT NULL default '0000-00-00 00:00:00',
> >> UNIQUE KEY image_id (image_id)
> >> );
> >>
what u mention above, i suggest to use cms like jomlaa

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

Re: Storing 4KB jpeg images on hospital web server

am 08.03.2007 10:35:08 von Chetan Graham

> i do know there's no problem upload 4kb img to database
> but is different case for.. 1mb pic.. it always fail.
>> >>
>> >> CREATE TABLE image (
>> >> image_id int(10) unsigned NOT NULL auto_increment,
>> >> image_type varchar(50) NOT NULL default '',
> my application said is header
> ------------------------------------------------------------ ----
>
>> >> image longblob NOT NULL,
>> >> image_size bigint(20) NOT NULL default '0',
> u don't need size.. since is able to count/strlen from image
> ------------------------------------------------------------ -
>
>> >> image_name varchar(255) NOT NULL default '',
>> >> image_date datetime NOT NULL default '0000-00-00 00:00:00',
>> >> UNIQUE KEY image_id (image_id)
>> >> );
>> >>
> what u mention above, i suggest to use cms like jomlaa

Chetan wrote: I googled the jomlaa(when I first saw it I automatically
thought you were speaking your native nepalise language or something.
Indeed it is like mambo. I will download either one and look into the CMS
aspect of it.
Back to the Hospital website. Now the Web Boss wants to put the images in
the DB. I do feel the webserver folders would simply and well.
However, we do what the boss says.
Again, thankyou all for your quick and wonderful help.
Blessings, Chetan
>

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

Re: Storing 4KB jpeg images on hospital web server

am 08.03.2007 13:29:56 von Bastien Koert

explain to him that there is a perfomance hit to storing images in the db as
well as causing some db bloat. You will also need to handle the output of
the images differently to ensure that they show up

see these example for getting info in and out of the db


http://www.weberdev.com/get_example-4063.html
http://www.weberdev.com/get_example-4062.html


bastien

>From: "Chetan Graham"
>To: php-db@lists.php.net
>Subject: Re: [PHP-DB] Storing 4KB jpeg images on hospital web server
>Date: Thu, 8 Mar 2007 12:35:08 +0300 (EAT)
>
> > i do know there's no problem upload 4kb img to database
> > but is different case for.. 1mb pic.. it always fail.
> >> >>
> >> >> CREATE TABLE image (
> >> >> image_id int(10) unsigned NOT NULL auto_increment,
> >> >> image_type varchar(50) NOT NULL default '',
> > my application said is header
> > ------------------------------------------------------------ ----
> >
> >> >> image longblob NOT NULL,
> >> >> image_size bigint(20) NOT NULL default '0',
> > u don't need size.. since is able to count/strlen from image
> > ------------------------------------------------------------ -
> >
> >> >> image_name varchar(255) NOT NULL default '',
> >> >> image_date datetime NOT NULL default '0000-00-00 00:00:00',
> >> >> UNIQUE KEY image_id (image_id)
> >> >> );
> >> >>
> > what u mention above, i suggest to use cms like jomlaa
>
>Chetan wrote: I googled the jomlaa(when I first saw it I automatically
>thought you were speaking your native nepalise language or something.
>Indeed it is like mambo. I will download either one and look into the CMS
>aspect of it.
>Back to the Hospital website. Now the Web Boss wants to put the images in
>the DB. I do feel the webserver folders would simply and well.
>However, we do what the boss says.
>Again, thankyou all for your quick and wonderful help.
>Blessings, Chetan
> >
>
>--
>PHP Database Mailing List (http://www.php.net/)
>To unsubscribe, visit: http://www.php.net/unsub.php
>

____________________________________________________________ _____
RealLiveMoms: Share your experience with Real Live Moms just like you
http://www.reallivemoms.ca/

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

Re: Storing 4KB jpeg images on hospital web server

am 08.03.2007 17:48:28 von Micah Stevens

On 03/08/2007 01:35 AM, Chetan Graham wrote:
> Back to the Hospital website. Now the Web Boss wants to put the images in
> the DB. I do feel the webserver folders would simply and well.
> However, we do what the boss says.
>
>
I'm with Bastien on this one, I've stored images in a database in the
past, and although I have to admit that it makes a certain amount of
sense in the fact it keeps all your data in one place, practically it's
a pain in the butt. It's faster, more efficient and better in almost
every respect to let the filesystem do what it does best and store the
files, and the database deal with data you need to organize and sort.

-Micah

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

Re: Storing 4KB jpeg images on hospital web server

am 08.03.2007 17:58:08 von Steven Cruz

Yeah, do what the boss says, but I will tend agree, storing the images
the database will slow it down. There is one place that holds large
images and even small vids in the DB. IO over kill. They have two
servers to run one database.


Micah Stevens wrote:
> On 03/08/2007 01:35 AM, Chetan Graham wrote:
>> Back to the Hospital website. Now the Web Boss wants to put the
>> images in
>> the DB. I do feel the webserver folders would simply and well.
>> However, we do what the boss says.
>>
> I'm with Bastien on this one, I've stored images in a database in the
> past, and although I have to admit that it makes a certain amount of
> sense in the fact it keeps all your data in one place, practically
> it's a pain in the butt. It's faster, more efficient and better in
> almost every respect to let the filesystem do what it does best and
> store the files, and the database deal with data you need to organize
> and sort.
>
> -Micah
>

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

Re: Storing 4KB jpeg images on hospital web server

am 09.03.2007 06:17:13 von bedul

i will just add a few what happen to me. since i build the same programing
1. sometimes the images where we wanted to upload doesn't upload right.
2. images called from db sometimes don't have match header.. like gif images
but read as png??

----- Original Message -----
From: "Steven Cruz"
To: "Micah Stevens"
Cc: "Chetan Graham" ;
Sent: Thursday, March 08, 2007 11:58 PM
Subject: Re: [PHP-DB] Storing 4KB jpeg images on hospital web server


> Yeah, do what the boss says, but I will tend agree, storing the images
> the database will slow it down. There is one place that holds large
> images and even small vids in the DB. IO over kill. They have two
> servers to run one database.
>
nope.. i disagree with that.. since i use pic and my data on same database..
it could say same as reading a lot text.. just imagine pic are a bunch of
word "aaaa" but in 300line.
to be honest.. i never try above statement. perhaps for a small database (i
point on data), database not slowdown.. but if use for big database.. i
never try about

btw.. img upload to database will never break 1mb (i already try that)
>
> Micah Stevens wrote:
> > On 03/08/2007 01:35 AM, Chetan Graham wrote:
> >> Back to the Hospital website. Now the Web Boss wants to put the
> >> images in
> >> the DB. I do feel the webserver folders would simply and well.
> >> However, we do what the boss says.
> >>
> > I'm with Bastien on this one, I've stored images in a database in the
> > past, and although I have to admit that it makes a certain amount of
> > sense in the fact it keeps all your data in one place, practically
> > it's a pain in the butt. It's faster, more efficient and better in
> > almost every respect to let the filesystem do what it does best and
> > store the files, and the database deal with data you need to organize
> > and sort.
that's correct.
and one small add.. u can backup the data without copy paste all things (i
mean export the database) and make a fuss because it
> >
> > -Micah
> >
>
> --
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>

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