/    Sign up×
Community /Pin to ProfileBookmark

how to display images from the database

Hi

I have read the article in [URL=http://codewalkers.com/tutorials/35/1.html]CodeWalkers[/URL] about how to store and retrieve images from the database.

The article explains that once I have the type of the image and the image itself, then I can display them like this:

[code=php]
Header (“Content-type: $image_type”);
print $image;
[/code]

I would like to be able to display the image within HTML content. Meaning that instead of writing:
…<img src=”xxx.jpg”></img>…
I would display that image in that place. Note that the <img> tage may be embedded inside a much more complex html code.

does anyone know how I can make that last move?

thanks in advance

to post a comment
PHP

2 Comments(s)

Copy linkTweet thisAlerts:
@jpmoriartyMar 31.2004 — you can use the img tag to call a php page that generates the image, but you can't put your code for [i]generating[/i] the image into html, since that's not what html does. the html code needs to call the image file, be it dynamically created or static - but you can't put in some php that will just stick the image into the html page "as if from nowhere"
Copy linkTweet thisAlerts:
@trinitywaveMar 31.2004 — I store the path to the image in the database.....

Create the image in html, set the size you want etc, and then get php to insert the path in your html...
×

Success!

Help @davidklonski spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 6.17,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @nearjob,
tipped: article
amount: 1000 SATS,

tipper: @meenaratha,
tipped: article
amount: 1000 SATS,

tipper: @meenaratha,
tipped: article
amount: 1000 SATS,
)...