Storing images
am 03.02.2010 08:37:18 von Karl DeSaulniers
--Apple-Mail-2--887369918
Content-Transfer-Encoding: 7bit
Content-Type: text/plain;
charset=US-ASCII;
delsp=yes;
format=flowed
Hello List,
Forgive me if this is a noob question, but is it possible to fill a
database table with actual image data, IE a jpeg? And then call that
data to display the image?
Or is it better to just reference it stored on the server somewhere
and just put the url in the database?
Thanks,
Karl DeSaulniers
Design Drumm
http://designdrumm.com
--Apple-Mail-2--887369918--
Re: Storing images
am 03.02.2010 08:54:19 von Karl DeSaulniers
--Apple-Mail-3--886349619
Content-Transfer-Encoding: 7bit
Content-Type: text/plain;
charset=US-ASCII;
delsp=yes;
format=flowed
Ok, now here is another question from what you stated.
Is there a way to compress the image data before storing, like a zip
archive does to files?
Thanks for your response.
Karl
On Feb 3, 2010, at 1:45 AM, Chaitanya Yanamadala wrote:
> It i possible to store the image in the database. But it will
> increase the database size.
> So try referring the URL..
Karl DeSaulniers
Design Drumm
http://designdrumm.com
--Apple-Mail-3--886349619--
Fwd: Storing images
am 03.02.2010 09:04:26 von bedul
--001636e0a9bfc74515047eadaaab
Content-Type: text/plain; charset=ISO-8859-1
---------- Forwarded message ----------
From: Gunawan Wibisono
Date: Wed, Feb 3, 2010 at 3:02 PM
Subject: Re: [PHP-DB] Storing images
To: Karl DeSaulniers
u can do that...
but i suggest you not put image to table since there a limit in table
i found 800kb the max image size you can input in table (1 row).
you should put the images in local.. but is up to you..
On Wed, Feb 3, 2010 at 2:54 PM, Karl DeSaulniers wrote:
> Ok, now here is another question from what you stated.
> Is there a way to compress the image data before storing, like a zip
> archive does to files?
> Thanks for your response.
>
> Karl
>
>
> On Feb 3, 2010, at 1:45 AM, Chaitanya Yanamadala wrote:
>
> It i possible to store the image in the database. But it will increase the
>> database size.
>> So try referring the URL..
>>
>
> Karl DeSaulniers
> Design Drumm
> http://designdrumm.com
>
>
--001636e0a9bfc74515047eadaaab--
Re: Storing images
am 03.02.2010 14:02:02 von Phpster
Sure is. Save the data in a blob field. Lots of examples on the net
on how to get it there and back out again.
Note that you will also find arguments about whether or not to do it
in the first place. I prefer not to, as it causes significant
performance issues when the image table gets to a certain size.
Bastien
Sent from my iPod
On Feb 3, 2010, at 2:37 AM, Karl DeSaulniers
wrote:
> Hello List,
> Forgive me if this is a noob question, but is it possible to fill a
> database table with actual image data, IE a jpeg? And then call that
> data to display the image?
> Or is it better to just reference it stored on the server somewhere
> and just put the url in the database?
> Thanks,
>
> Karl DeSaulniers
> Design Drumm
> http://designdrumm.com
>
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
Re: Storing images
am 03.02.2010 14:20:32 von Patrick Price
--0016e6d2764268bc31047eb21624
Content-Type: text/plain; charset=ISO-8859-1
I would say that only if this is going to be a very small project should you
think about storing the images in the db. I had a contract job for a real
estate company that had stored all their images in the database. They had
~25K rows of data where each image was ~5K and their website was going down
weekly.
I had to rewrite the entire image upload/retrieval system for their site to
change it to folder based storage.
Just my thoughts...
Thanks
patrick
On Wed, Feb 3, 2010 at 8:02 AM, Phpster wrote:
> Sure is. Save the data in a blob field. Lots of examples on the net on how
> to get it there and back out again.
>
> Note that you will also find arguments about whether or not to do it in the
> first place. I prefer not to, as it causes significant performance issues
> when the image table gets to a certain size.
>
> Bastien
>
> Sent from my iPod
>
>
> On Feb 3, 2010, at 2:37 AM, Karl DeSaulniers wrote:
>
> Hello List,
>> Forgive me if this is a noob question, but is it possible to fill a
>> database table with actual image data, IE a jpeg? And then call that data to
>> display the image?
>> Or is it better to just reference it stored on the server somewhere and
>> just put the url in the database?
>> Thanks,
>>
>> Karl DeSaulniers
>> Design Drumm
>> http://designdrumm.com
>>
>>
> --
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
--0016e6d2764268bc31047eb21624--
Re: Storing images
am 03.02.2010 17:07:49 von Karl DeSaulniers
Thank you all for your numerous responses.
I hear you loud and clear. I was wanting to see if it would be less
of a burden on the server and secure my images better to put the
images inside a database, but
as you all have almost uniformly stated, this would not be the best
situation.
I currently have all my images referenced by url in my database and
stored in a folder/s and I think I will keep it that way...
Thanks for your 2 cents,
:)
Karl
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
Re: Storing images
am 03.02.2010 17:14:50 von Richard Quadling
On 3 February 2010 16:07, Karl DeSaulniers wrote:
> Thank you all for your numerous responses.
>
> I hear you loud and clear. I was wanting to see if it would be less of a
> burden on the server and secure my images better to put the images inside a
> database, but
> as you all have almost uniformly stated, this would not be the best
> situation.
> I currently have all my images referenced by url in my database and stored
> in a folder/s and I think I will keep it that way...
>
> Thanks for your 2 cents,
>
> :)
>
> Karl
>
> --
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
If you put the images OUTSIDE of the webroot/docroot/public_html
folder (whatever you have), then a user cannot directly navigate to
the file.
e.g.
/home/sites/your_site/public_html/images/image1.jpg
http://www.yoursite.com/images/image1.jpg would probably work.
But ...
/home/sites/your_site/public_html/getImage.php
/home/sites/your_site/hidden_images/image1.jpg
Now, there is no way I can load image1.jpg from my browser. I have to
use getImage.php, which I assume would require me to login or
authenticate myself in some way.
--
-----
Richard Quadling
"Standing on the shoulders of some very clever giants!"
EE : http://www.experts-exchange.com/M_248814.html
EE4Free : http://www.experts-exchange.com/becomeAnExpert.jsp
Zend Certified Engineer : http://zend.com/zce.php?c=ZEND002498&r=213474731
ZOPA : http://uk.zopa.com/member/RQuadling
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
Re: Storing images
am 03.02.2010 17:22:04 von Karl DeSaulniers
--Apple-Mail-1--855884663
Content-Transfer-Encoding: 7bit
Content-Type: text/plain;
charset=US-ASCII;
delsp=yes;
format=flowed
Ahhhh..
Very nice. I did not think of that.
But lets say its a whole bunch of images and multiple people may be
accessing them.
Is it safe to have them accessing a directory outside the public_html
directory?
Thanks,
Karl
On Feb 3, 2010, at 10:14 AM, Richard Quadling wrote:
> On 3 February 2010 16:07, Karl DeSaulniers
> wrote:
>> Thank you all for your numerous responses.
>>
>> I hear you loud and clear. I was wanting to see if it would be
>> less of a
>> burden on the server and secure my images better to put the images
>> inside a
>> database, but
>> as you all have almost uniformly stated, this would not be the best
>> situation.
>> I currently have all my images referenced by url in my database
>> and stored
>> in a folder/s and I think I will keep it that way...
>>
>> Thanks for your 2 cents,
>>
>> :)
>>
>> Karl
>>
>> --
>> PHP Database Mailing List (http://www.php.net/)
>> To unsubscribe, visit: http://www.php.net/unsub.php
>>
>>
>
> If you put the images OUTSIDE of the webroot/docroot/public_html
> folder (whatever you have), then a user cannot directly navigate to
> the file.
>
> e.g.
> /home/sites/your_site/public_html/images/image1.jpg
>
> http://www.yoursite.com/images/image1.jpg would probably work.
>
> But ...
>
> /home/sites/your_site/public_html/getImage.php
> /home/sites/your_site/hidden_images/image1.jpg
>
> Now, there is no way I can load image1.jpg from my browser. I have to
> use getImage.php, which I assume would require me to login or
> authenticate myself in some way.
>
>
> --
> -----
> Richard Quadling
> "Standing on the shoulders of some very clever giants!"
> EE : http://www.experts-exchange.com/M_248814.html
> EE4Free : http://www.experts-exchange.com/becomeAnExpert.jsp
> Zend Certified Engineer : http://zend.com/zce.php?
> c=ZEND002498&r=213474731
> ZOPA : http://uk.zopa.com/member/RQuadling
Karl DeSaulniers
Design Drumm
http://designdrumm.com
--Apple-Mail-1--855884663--
Re: Storing images
am 03.02.2010 17:31:51 von Richard Quadling
On 3 February 2010 16:22, Karl DeSaulniers wrote:
> Ahhhh..
> Very nice. I did not think of that.
> But lets say its a whole bunch of images and multiple people may be
> accessing them.
> Is it safe to have them accessing a directory outside the public_html
> directory?
> Thanks,
>
> Karl
>
> On Feb 3, 2010, at 10:14 AM, Richard Quadling wrote:
>
>> On 3 February 2010 16:07, Karl DeSaulniers wrote:
>>>
>>> Thank you all for your numerous responses.
>>>
>>> I hear you loud and clear. I was wanting to see if it would be less of a
>>> burden on the server and secure my images better to put the images inside
>>> a
>>> database, but
>>> as you all have almost uniformly stated, this would not be the best
>>> situation.
>>> I currently have all my images referenced by url in my database and
>>> stored
>>> in a folder/s and I think I will keep it that way...
>>>
>>> Thanks for your 2 cents,
>>>
>>> :)
>>>
>>> Karl
>>>
>>> --
>>> PHP Database Mailing List (http://www.php.net/)
>>> To unsubscribe, visit: http://www.php.net/unsub.php
>>>
>>>
>>
>> If you put the images OUTSIDE of the webroot/docroot/public_html
>> folder (whatever you have), then a user cannot directly navigate to
>> the file.
>>
>> e.g.
>> /home/sites/your_site/public_html/images/image1.jpg
>>
>> http://www.yoursite.com/images/image1.jpg would probably work.
>>
>> But ...
>>
>> /home/sites/your_site/public_html/getImage.php
>> /home/sites/your_site/hidden_images/image1.jpg
>>
>> Now, there is no way I can load image1.jpg from my browser. I have to
>> use getImage.php, which I assume would require me to login or
>> authenticate myself in some way.
>>
>>
>> --
>> -----
>> Richard Quadling
>> "Standing on the shoulders of some very clever giants!"
>> EE : http://www.experts-exchange.com/M_248814.html
>> EE4Free : http://www.experts-exchange.com/becomeAnExpert.jsp
>> Zend Certified Engineer : http://zend.com/zce.php?c=ZEND002498&r=213474731
>> ZOPA : http://uk.zopa.com/member/RQuadling
>
> Karl DeSaulniers
> Design Drumm
> http://designdrumm.com
>
>
If the file is outside of the docroot, then they _CANNOT_ access them.
There is no url to the image!
So, a script which examines the session to make sure the request is
valid is normally enough to restrict feeding the images to valid
users.
Multiple simultaneous readers are not a problem.
If you have any writers, then you need to introduce a locking
mechanism or some other protection.
--
-----
Richard Quadling
"Standing on the shoulders of some very clever giants!"
EE : http://www.experts-exchange.com/M_248814.html
EE4Free : http://www.experts-exchange.com/becomeAnExpert.jsp
Zend Certified Engineer : http://zend.com/zce.php?c=ZEND002498&r=213474731
ZOPA : http://uk.zopa.com/member/RQuadling
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
Re: Storing images
am 03.02.2010 17:35:45 von Karl DeSaulniers
--Apple-Mail-3--855062801
Content-Transfer-Encoding: 7bit
Content-Type: text/plain;
charset=US-ASCII;
delsp=yes;
format=flowed
Any pointers on where I can find a sample locking script.
I may have artists editing files and that would be great to have a
locking of the file while an artist is working on it so no one over
writes each other.
LMK,
Thanks,
Karl
On Feb 3, 2010, at 10:31 AM, Richard Quadling wrote:
> If you have any writers, then you need to introduce a locking
> mechanism or some other protection.
Karl DeSaulniers
Design Drumm
http://designdrumm.com
--Apple-Mail-3--855062801--
Re: Storing images
am 03.02.2010 17:47:00 von Richard Quadling
On 3 February 2010 16:35, Karl DeSaulniers wrote:
> Any pointers on where I can find a sample locking script.
> I may have artists editing files and that would be great to have a
> locking of the file while an artist is working on it so no one over writes
> each other.
> LMK,
> Thanks,
>
> Karl
>
> On Feb 3, 2010, at 10:31 AM, Richard Quadling wrote:
>
>> If you have any writers, then you need to introduce a locking
>> mechanism or some other protection.
>
> Karl DeSaulniers
> Design Drumm
> http://designdrumm.com
>
>
Take a read at what started in
http://marc.info/?l=php-db&m=126444533212143&w=2 and
http://marc.info/?l=php-db&m=126471476932749&w=2
I mention using a simple directory as a lock.
You can implement it in any way you want though.
If you already have a mechanism to stop multiple users from editing
the same image via a DB, then use that, but just store the image
outside of the web root.
--
-----
Richard Quadling
"Standing on the shoulders of some very clever giants!"
EE : http://www.experts-exchange.com/M_248814.html
EE4Free : http://www.experts-exchange.com/becomeAnExpert.jsp
Zend Certified Engineer : http://zend.com/zce.php?c=ZEND002498&r=213474731
ZOPA : http://uk.zopa.com/member/RQuadling
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php