I have this code to put a text on an image
but it shows me these weird symbols all over the pageCode:<?php
header ("Content-type: image/png");
$string = "test";
// try changing this as well
$font = 4;
$width = imagefontwidth($font) * strlen($string) ;
$height = imagefontheight($font) ;
$im = imagecreatefrompng("test.png");
$x = imagesx($im) - $width ;
$y = imagesy($im) - $height;
$backgroundColor = imagecolorallocate ($im, 255, 255, 255);
$textColor = imagecolorallocate ($im, 0, 0,0);
imagestring ($im, $font, $x, $y, $string, $textColor);
imagepng($im);
?>
what could be the problem?
Hi,
The code looks perfect. Usually garbled values are shown if the content type is not right
i double checked everything
the file path, the text, the codes...
but everytime i test it out
it shows me all this weird symbols all over the page
header("content-type: image/png")
are you trying to say its case sensitive?
no, no. I messed up. I'm sorry, I didn't see that you had the header already. I just ran it though, and it shows the image on my server. I'm not sure...
yeah i got it working already...
it has messed up with the headers.
i didnt see there was an include file that has another header content type
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks