Jump to content

uggh! Diplaying images?


Gunnar J

Recommended Posts

You don't. PHP just generates HTML. It can also do many other things "in the meantime" like manipulating images that you'll display later, but that's not like "displaying an image with PHP" as if it's an alternative to HTML of some sort. You can send a complete image instead of an HTML file, but not put it inline with the rest.

Link to comment
Share on other sites

Okay. I assume you don't need this first part, but here it is anyway.

<img src="<?php $img = 'myimage.png'; echo $img;  ?>" />

Now, with additions and modifications, the above can be used to grab a random image or even manipulate an image, so you can take it pretty far.But let's say you want a fixed HTML file that has a tag in it like <img src="myserver.com/img.php" /> .img.php would be a script that goes out and gets images for you for whatever purpose you have in mind. In its most basic form, it'll look like this, using the GD extensions to php:

<?php   $im = imagecreatefrompng($imgpath_or_URL);   header("Content-Type: image/png");   imagepng($im);?>

Hope some of that helps.

Link to comment
Share on other sites

FWIW, this topic should never have been reposted into another thread. No real harm done today, but on a busy day, things might have gotten confusing. Please trust that we are paying attention.

Link to comment
Share on other sites

Well, I have an If sunction and want to display an image if you selected two things, but I cant seem to do it... Ill try your's Dierdes Dad
If you have a specific problem, specific code helps us to understand it :)
Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...