Jump to content

Recommended Posts

Posted

I recently added an image as a blob into a mysql database. When I add an image it shows on the webpage required however on return it is gone and asks picture to be added. I have tried several ways to show the image but nothing works. Is this a problem normally?

league_1.php

Posted

Personally, I would approach this from a different angle. Rather than storing the image directly in the database, which is going to significantly increase your database size over time, I would suggest simply storing the image in a specific location (say, and "uploads" folder) and simply saving the path to the image in the database. I personally haven't ever used blobs for image storing -- this is the way I usually approach it.

 

That said, you might look here for help with the blob issue: http://www.phpro.org/tutorials/Storing-Images-in-MySQL-with-PHP.html. I believe you can ignore the PDO portions -- as long as you can access the database and retrieve the data, exactly how you do that (MySQL, MySQLi, PDO, etc.) doesn't specifically matter.

Posted

Personally, I would approach this from a different angle. Rather than storing the image directly in the database, which is going to significantly increase your database size over time, I would suggest simply storing the image in a specific location (say, and "uploads" folder) and simply saving the path to the image in the database. I personally haven't ever used blobs for image storing -- this is the way I usually approach it.

 

That said, you might look here for help with the blob issue: http://www.phpro.org/tutorials/Storing-Images-in-MySQL-with-PHP.html. I believe you can ignore the PDO portions -- as long as you can access the database and retrieve the data, exactly how you do that (MySQL, MySQLi, PDO, etc.) doesn't specifically matter.

Yes that is the way I normally do it. This time the site requires the owners to update league tables without ftp access and as I will delete obsolete images every month it will not be an overload problem. I will have a look at your link. I know it cannot be difficult. As I said I can get the garbled binary but I am lacking something in the header,(in more ways than one). Will keep looking

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  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.

Loading...
×
×
  • Create New...