grucker Posted June 8, 2013 Report Share Posted June 8, 2013 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 Quote Link to comment Share on other sites More sharing options...
falkencreative Posted June 8, 2013 Report Share Posted June 8, 2013 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. Quote Link to comment Share on other sites More sharing options...
grucker Posted June 9, 2013 Author Report Share Posted June 9, 2013 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 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
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.