Retrieve image from database problem

Questions about the MySQL, PostgreSQL, and most other databases, as well as using it with PHP can be asked here.

Moderator: General Moderators

Post Reply
THESiUS
Forum Newbie
Posts: 6
Joined: Wed Mar 17, 2004 2:53 am

Retrieve image from database problem

Post by THESiUS »

I have a table and the field I am storing the image in is set to blob. Everytime I try to pull the image back out to view it, it only shows a portion of the image. It seems that if I upload a small enough image, it will show the whole thing though. Has anyone run into this problem?
seeker2921
Forum Contributor
Posts: 120
Joined: Sat Mar 22, 2003 7:10 pm
Location: Wiesbaden Germany
Contact:

Post by seeker2921 »

I'm not sure but it soundes like timeout problem..
fastfingertips
Forum Contributor
Posts: 242
Joined: Sun Dec 28, 2003 1:40 am
Contact:

Post by fastfingertips »

I think that also depends on the image size :).
You must read the mysql about blob types as i remember you have other blob (bigger ones) that will help you to encode to whole image.

Also you may try to increase the server timeout period.
shwathi
Forum Newbie
Posts: 6
Joined: Mon Mar 15, 2004 12:29 am
Contact:

Image not retrieved!

Post by shwathi »

Hi,
Whatz the type of image file your working with? Is it svg?
Coz I've been facing with the same probs last month. And in my case I could retrieve images less than 8Kb of size and images with greater than that size failed to be retrieved. When I upgraded my browser, I found that everthing was fine working. So try upgrading ur browser no matter how latest ur version is. Make sure that ur cache is public in php configuration. If this still does work let me know the further details, I'll try suggeting u.

Bye, Good luck !
Shwathi 8)
freddy-a
Forum Newbie
Posts: 2
Joined: Wed Mar 17, 2004 5:58 am

Post by freddy-a »

Hi,

I'm trying to retrieve an image from a database but I can't get it to work :-(
Can anyone post some code to help me out?
I've tried a seperate file and various tips from other sites (hotscript.com and phpbuilder.com) but without succes...

I have a database in which I store the image (jpg). Now I want to show that image (along with some other information from the database) in an html page.

Please show some code, as things like:
To embed text and images within an html page, create the image program as a separate file and make sure that the image program returns image headers so that image.php will be viewed as an image by the browser.
Now just put your text in a separate file and at the place where you want the image to appear, embed it using
<img src="image.php?querystring">
where your querystring will pass the parameters required to create the image.
do not help me enough... (The idea behind it sounds cool, I've tried it. But I'm relative new to this subject and I couldn't get it to work with this little information...)


Thanx,

Freddy
THESiUS
Forum Newbie
Posts: 6
Joined: Wed Mar 17, 2004 2:53 am

Post by THESiUS »

The images I am storing in the database are jpg. I dont think its a timeout issue, because the images I am storing are like 60k.
freddy-a
Forum Newbie
Posts: 2
Joined: Wed Mar 17, 2004 5:58 am

Post by freddy-a »

Are you using blob for datatype? The max size for that is 65535 bytes.
Maybe you can try using mediumblob? The max size for a mediumblob is 1.6 Mb. It uses 1 byte more per record, so that propably won't cause any problems.

Greetz,
Freddy
THESiUS
Forum Newbie
Posts: 6
Joined: Wed Mar 17, 2004 2:53 am

Post by THESiUS »

Well, mediumblob did the trick. I read somewhere that blob would work, but I guess not. Thanks a ton for your help!
Post Reply