Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon.

Pages: 1-

PHP

Name: Anonymous 2012-11-01 23:01

How do I use PHP to place an image into HTML?

$img = imagecreatefrompng("./dir/subdir/image.png");

Do I then do:

<img src="<?php "$img"; ?>" />

???

Name: Anonymous 2012-11-01 23:09

By not using PHP, fagstorm.

Name: Anonymous 2012-11-01 23:15

cabal install happstack

Name: sage 2012-11-01 23:28

nicetry() $OP;
but it\'s too obvious;

Name: Anonymous 2012-11-01 23:29


<?php
/* $img_path is your image's location; on most hosts, the contents of public_html would be your root directory and, for sanity, images would be stored in their own directory. */
 
$img_path = "http://www.yourdomain.com/images/img_000.png";

/* Then you generate the HTML and plop your PHP in */

?>

<!-- Make sure you use the .php extension on your filename and have PHP running -->
<img src="<?php echo $img_path; ?>" />

<!-- You can take this concept even further by abstracting everything so that you can reuse code.  But you'll find out about that as you go along -->

Name: php ignorant 2012-11-02 4:42

>>5
better yet

$URL = "http://cats.com/"
$img = imagecreatefrompng("./dir/subdir/image.png");

echo '<img src="' + $URL + some_function_to_clean_dot_and_backslash($img) '" />'


And even better yet!
[spoiler]no FUCKING PHP AT ALL [/spoilers]

Don't change these.
Name: Email:
Entire Thread Thread List