Jump to content
Stef's Coding Community

Recommended Posts

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.

Link to post
Share on other sites

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" />';

Link to post
Share on other sites

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.

Link to post
Share on other sites

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...