Re: image files - upload and managment

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Sat, 2004-10-30 at 02:43 -0700, Jaskirat Singh wrote:
> Hi People,
> 
> I am writing a web app on LAMP.
> The app is sort of yellow pages where people can login and post
> advertisments with pictures.
> 
> App needs to allow users to upload pictures. (jpg and gif),
> needs to create thumbnails of those pictures
> and to store thumbnails and full pictures.
> 
> App needs to manage all those files - can be as much as 20K plus
> images.
> 
> I think image file size, file type and image dimensions restrictions
> should be easy to handle by using $_FILES array and  getimagesize
> function.
> 
> The issues that I am thinking of and need suggestions about are
> 
> 1) Storage and retrieval -  File system sounds like a better choice
> over database. We are talking about 20 thousand plus pictures.
> 

I would do it in the database (PostgreSQL in my case). The speed isn't
going to be much slower if you keep things optimized. You can even cache
your images if necessary on the filesystem (for high traffic images).

> 2) Thumbnails - Should I create those once and save it in a file when
> the image is uploaded for the first time. Looks like a faster option
> than creating them every time on the fly.
> 

I just recently finished working on a project where I knew that would
automatically create a thumbnail version of each image on upload... but
then I realized that I might one day want to change the default
thumbnail sizes.. so what I did was have it create a thumbnail on the
fly from the database. (this way I can control the thumbnail size in the
future). The speed difference was hardly noticed. I have done what I
mentioned above and am now caching images that get loaded frequently. 

> 3) Security issues - I believe I must have a world writable "666"
> permissions directory to keep images as users of the web app are
> uploading them. Does that create any security holes in my application?
> 

The database will help you add a nice layer of security.

> 4) Any thing else related to image uploads that one might need to take
> care of. Are there any tutorials on image upload issues.
> 

an example:
http://blog.planetargon.com/index.php?/archives/26_Uploading_images_into_PostgreSQL.html

and here is how you can display the images from the db. I am also using
mod_rewrite so that it looks like it's coming from the filesystem, for
example:

mydomain.com/images/mypic.jpg actually
calls ./image.php?filename=mypic.jpg

http://blog.planetargon.com/index.php?/archives/27_Displaying_image_from_PostgreSQL_large_object_with_PHP.html


hth,

-Robbyu

-- 
/***************************************
* Robby Russell | Owner.Developer.Geek
* PLANET ARGON  | www.planetargon.com
* Portland, OR  | robby@xxxxxxxxxxxxxxx
* 503.351.4730  | blog.planetargon.com
* PHP/PostgreSQL Hosting & Development
*    --- Now supporting PHP5 ---
****************************************/

Attachment: signature.asc
Description: This is a digitally signed message part


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux