Jump to content

Recommended Posts

I'm in a major fix right now. I need to display multiple (20+) images from a Blob field in MySQL on a single web page using PHP. The problem arises when I get a 403 forbidden error, which can only mean one thing, too many database connections at one time. I have tried closing the MySQL connection each time I need to display each image, but I'm still getting this error! If anyone knows how to display multiple images from a Blob field on a single web page with PHP, without getting this error, I could really use your help!

Link to comment
https://forums.phpfreaks.com/topic/3137-display-images-from-blob/
Share on other sites

I don't understand exactly what you mean... how are you storing 20 images in a single BLOB field (or did I miss the piont)? I'm not sure why you think 403 means too many connections, either. Also, how would retrieving 20+ images require multiple DB connections? Or each each image calling it's own PHP script? Please clarify.

[!--quoteo(post=332696:date=Jan 3 2006, 03:35 AM:name=fenway)--][div class=\'quotetop\']QUOTE(fenway @ Jan 3 2006, 03:35 AM) 332696[/snapback][/div][div class=\'quotemain\'][!--quotec--]

I don't understand exactly what you mean... how are you storing 20 images in a single BLOB field (or did I miss the piont)? I'm not sure why you think 403 means too many connections, either. Also, how would retrieving 20+ images require multiple DB connections? Or each each image calling it's own PHP script? Please clarify.

 

 

No, let's say I have 20 images, then there would be 20 different rows, one row for each image. I'm calling the images using this method: <img src="getpicture.php?id=1234">

 

Then, in the getpicture.php script, I connect to the database, grab the blob data for that single image, then change the header type and then print out the image. Hopefully this clarify's what I'm trying to do.

[!--quoteo(post=332802:date=Jan 3 2006, 12:25 PM:name=fenway)--][div class=\'quotetop\']QUOTE(fenway @ Jan 3 2006, 12:25 PM) 332802[/snapback][/div][div class=\'quotemain\'][!--quotec--]

That's what I thought, it just wasn't clear from your initial post. It seems strange that your DB wouldn't allow 20 simultaneous connections, but it's possible.

 

 

I looked at the MySQL configurations, and it is set to allow 20 max user connections. But, I'm just wondering if there could be anything else causing the 403 error. And, is there a different way to accomplish this without having to make so many database connections?

Twenty isn't that many to begin with, but no, if you're going to make 20 images on a page, each retreived via script, then you don't have much of a choice without a whole bunch of undesired hacks. To be honest, there's nothing wrong with 20 connections, as long as each of them isn't doing that much work. In your case, if it's just getting and image and disconnecting, it shouldn't be an issue. BTW, I don't see how this is causing 403 errors; those are web server errors, usually related to permissions, and shouldn't have anything to do with PHP/MySQL-related issues -- the worst you should get would be a timeout.

When I get the 403 error, it's usually after I've tried refreshing the page again. The first time the page is displayed it will only produce a 1/4 of the images. I try to refresh, and then it gives me the 403 error. So it's hard to understand what's causing it to produce that error?

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.