shoopaie Posted November 21, 2010 Report Share Posted November 21, 2010 I am curious if one uses php to call an image from a directory to be displayed on a certain webpage? I have looking around the net but can't seem to find a good answer. Can anyone point me to a good resource to learn it? Thanks very much. Quote Link to comment Share on other sites More sharing options...
falkencreative Posted November 21, 2010 Report Share Posted November 21, 2010 I'm not completely sure what you are asking -- how does what you want differ from using a usual image tag? Quote Link to comment Share on other sites More sharing options...
shoopaie Posted November 21, 2010 Author Report Share Posted November 21, 2010 Sorry, let me clarify. If i had it to where users could upload images to be used at another time. For instance, if i had them upload a logo to be used in a coupon template. How does php call that image to be used dynamically in different coupon templates? Hope that makes it a little more clear. Quote Link to comment Share on other sites More sharing options...
falkencreative Posted November 21, 2010 Report Share Posted November 21, 2010 Got it. When you upload the file, I would save the path to the file in the database. Then, when you want to use the image again, you pull the path from the database. Make sense? For example, say the path to the file is "http://www.yourdomain.com/uploads/image.jpg" after you upload it. You would save that path into the database using a MySQL insert statement. When you want to display it, you would do something like this: // get path from database using MySQL select, assign it to the $path variable echo '<img src="'.$path.'" alt="alt attribute" />'; Quote Link to comment Share on other sites More sharing options...
shoopaie Posted November 21, 2010 Author Report Share Posted November 21, 2010 Got it. When you upload the file, I would save the path to the file in the database. Then, when you want to use the image again, you pull the path from the database. Make sense? For example, say the path to the file is "http://www.yourdomain.com/uploads/image.jpg" after you upload it. You would save that path into the database using a MySQL insert statement. When you want to display it, you would do something like this: // get path from database using MySQL select, assign it to the $path variable echo '<img src="'.$path.'" alt="alt attribute" />'; Thanks so much, I will definitely give that a try. Sounds like a great idea to me. 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.