Jump to content

[SOLVED] image with php


joecooper

Recommended Posts

a mod please delete my other post coz i think i got everyone confused with it.

 

i have this code:

 

header("Content-type: image/png");

imagepng("image.png");

 

it should return an image thats called image.png on the server, but it just comes up with the image box with a cross... what is it im doing wrong?

 

http://joeyjoe.co.uk/wallpaper/getpaper.php

Link to comment
https://forums.phpfreaks.com/topic/63803-solved-image-with-php/
Share on other sites

When you use imagepng($image), $image needs to be a gd-created image and not an image file

<?php
header("Content-type: image/png");
$im = imagecreatefrompng('path/to/image.png');
imagepng($im);
imagedestroy($im);
?>

 

 

Place on page with

<img src="image.php">

Link to comment
https://forums.phpfreaks.com/topic/63803-solved-image-with-php/#findComment-317976
Share on other sites

Archived

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

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.