[Wolves] PHP image management

gary at walsall.uk.com gary at walsall.uk.com
Tue Dec 23 19:30:06 GMT 2003


I wouldn't suggest storing images in a database, as this tends to add a little strain on the db server and webserver. Its much easier to you to store your image in a file and then use a mysql table with a reference to that file, but then again, if you have all your mysql/php/apache setting correct and you aren't putting all these under any stress, then this shouldn't prove a problem.

have a look at http://www.webmasterworld.com/forum88/754.htm - this may provide some help to your problem.

When i did this a long time ago, I found that the most common error I had was with the headers. Make sure your image is using the correct header, and try loading the image.php page from another page pointing to this, ie 

index.php
<img src='image.php'>

Another thing to check when you have uploaded your image, is that the length of the image in your sql field, is exactly the same length as the file you uploaded.


Gary



"Matthew Revell" <wolveslug at understated.co.uk> wrote ..
> Hello chaps,
> 
> I'm trying to set up some form of mySQL/PHP image management for my site.
> I've had a look at an O'Reilly tutorial
> http://www.onlamp.com/pub/a/onlamp/2002/05/09/webdb2.html which has a
> script for uploading images to a database, then displaying them from
> within a web page.
> 
> However, I just can't get the bugger to work on my server. The only way
> I
> can get an image into the database is through PHPMyAdmin. Then, when I
> run
> the view.php script, I get a opening and closing HTML and body tags.
> 
> I'm not asking for direct assistance with this script but I'm really just
> wondering if anyone knows of PHP or mySQL config probs that could stop
> the
> image from being output properly. The exact same scripts work fine on the
> example set up given in the tutorial.
> 
> Ugh.
> 
> Matthew.
> 
> _______________________________________________
> Wolves LUG mailing list
> Homepage: http://www.wolveslug.org.uk/
> Mailing list: Wolves at mailman.lug.org.uk
> Mailing list home: http://mailman.lug.org.uk/mailman/listinfo/wolves


More information about the Wolves mailing list