Hermann Posted December 19, 2011 Share Posted December 19, 2011 Hi there Larry. Firstly I would like to thank you for the great book.Before I started with your Effortless ECommerce book I didn't have a day's coding experience and I can honestly say that I have become quite accustomed to coding and techniques used as a result of this book so I am really thankful! I am building a social network type of site some of the principles in this book. I have used the image uploader from the second part of the book and instead of generating unique image names for every file, I have decided to rename the file so that it will exist only out of the user id data stored in the $_SESSION and the username. This is also stored in the session. A file would thus be stored in the following example directory...model/uploads/images/business_logos/5WalMart/5WalMart.jpg (this is just an example to Wal Mart's directory where it's logo will be stored). The image is stored and everything is working 100%. The only problem that I have is that I do not know how to display this image in a browser. What should be stored in a database table? How do I retrieve and show this image on a page? Any help would be appreciated. Please ask if you want any extra info! Kind Regards! Link to comment Share on other sites More sharing options...
rob Posted December 20, 2011 Share Posted December 20, 2011 Build up the <img> src value by using the information from the database that you used to rename the file with: echo '<img src=" .../' . $row['username'] . '/' . $row['id'] . $row['username'] . '.jpg">'; I've had to guess at what you've called database fields, but should give you the idea. 1 Link to comment Share on other sites More sharing options...
Hermann Posted December 20, 2011 Author Share Posted December 20, 2011 Thank you very much Rob. I was overcomplicating the whole thing. Tried to use header(Content-type:.... etc when all I needed to do was what you told me. Haha. Thanks again for the help! Link to comment Share on other sites More sharing options...
Recommended Posts