davids_media Posted April 9, 2012 Share Posted April 9, 2012 I am currently looking to insert images into a database and then display them in php. I am thinking of storing the images as a VARCHAR data type but what would be a more suitable type? Quote Link to comment https://forums.phpfreaks.com/topic/260614-storing-and-displaying-images-with-phpmysql/ Share on other sites More sharing options...
AyKay47 Posted April 9, 2012 Share Posted April 9, 2012 The typical way would be to store the path to the file in the database. Yes that would be a varchar field. Quote Link to comment https://forums.phpfreaks.com/topic/260614-storing-and-displaying-images-with-phpmysql/#findComment-1335666 Share on other sites More sharing options...
scootstah Posted April 9, 2012 Share Posted April 9, 2012 You can store it as base64 encoded and then display it that way. You'd probably want a TEXT type though. It's a better idea to just store the path like aykay said. Quote Link to comment https://forums.phpfreaks.com/topic/260614-storing-and-displaying-images-with-phpmysql/#findComment-1335667 Share on other sites More sharing options...
davids_media Posted April 9, 2012 Author Share Posted April 9, 2012 thanks, with my chosen data type, that was route i looking to go down anyway Quote Link to comment https://forums.phpfreaks.com/topic/260614-storing-and-displaying-images-with-phpmysql/#findComment-1335668 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.