PDA

View Full Version : <.< Help ::PHP::



Kasabian
26-05-2006, 07:47 PM
<?php

$image = imagecreatefrompng('http://img148.imageshack.us/img148/9800/slipknot4qj.png');
//$image = imagecreatefromjpeg('http://img148.imageshack.us/img148/9691/slipknot134832cv.jpg');
$red = imagecolorallocate($image, 255, 0, 0);

imagestring($image, 0, 0, 0, $_SERVER['REMOTE_ADDR'], $red);

header ("Content-type: image/png");
imagepng($image);
imagedestroy($image);
?>

What would be wrong with that?

James!
26-05-2006, 07:53 PM
<?php

$image = imagecreatefrompng('http://img148.imageshack.us/img148/9800/slipknot4qj.png');
//$image = imagecreatefromjpeg('http://img148.imageshack.us/img148/9691/slipknot134832cv.jpg');
$red = imagecolorallocate($image, 255, 0, 0);

imagestring($image, 0, 0, 0, $_SERVER['REMOTE_ADDR'], $red);

header ("Content-type: image/png");
imagepng($image);
imagedestroy($image);
?>
What would be wrong with that?You have a .jpg image in there and the '
header ("Content-type: image/png");' only searches for .png images!

Heinous
27-05-2006, 03:01 AM
You have a .jpg image in there and the '
header ("Content-type: image/png");' only searches for .png images!



*BEEP* wrong.

You really shouldn't act like you know something, when you don't.

To clarify, Devilman; The jpg image was commented out, therefore, being ignored.

The problem was, Stealth, all you did was rename the slipknot image, from, eg; slipknot.jpg to slipknot.png , thus keeping the jpeg format. I've taken the liberty to change the file format for you, and reupload it. So this script will work;

<?php
$image = imagecreatefrompng('http://img146.imageshack.us/img146/5871/slipknot9af.png');
$red = imagecolorallocate($image, 255, 0, 0);
imagestring($image, 0, 0, 0, $_SERVER['REMOTE_ADDR'], $red);
header ("Content-type: image/png");
imagepng($image);
imagedestroy($image);
?>

Dentafrice1
27-05-2006, 03:08 AM
Wasn't the format supposed to include a $font??

Heinous
27-05-2006, 03:10 AM
Wasn't the format supposed to include a $font??
Probably, but it works how it is. Test if you don't believe me.
http://trav.mine.nu/test.php

Dentafrice1
27-05-2006, 03:12 AM
Object not found.

look: http://www.hab-world.com/includes/subnav_link.php

http://www.hab-world.com/includes/subnav_link.php?text=hey

Ill post the code to that in a sec

Dentafrice1
27-05-2006, 03:13 AM
<?
// ## Hab-World - subnav link
header('Content-type: image/gif');
if($_REQUEST['type'] == "over") { $im = @imagecreatefromgif('../images/nav_images/subnav_bg_on.gif'); } else { $im = @imagecreatefromgif('../images/nav_images/subnav_bg_off.gif'); }
$white = imagecolorallocate($im, 51, 102, 152);
$font = '../scripts/Volter (Goldfish).ttf';
$text = $_REQUEST['text'];
imagettftext($im, 6.4, 0, 20, 10, $white, $font, $text);
imagegif($im, "", 100);
imagedestroy($im);
?>

Edit the $font with your own in a directory

Heinous
27-05-2006, 03:33 AM
http://trav.mine.nu/image.php

Yeah, used the wrong link. -_-

Like I said, you could add the font, but it works how it is atm.

Dentafrice1
27-05-2006, 03:35 AM
But thats nothing but IP :p

Heinous
27-05-2006, 03:45 AM
Which is what he/she wanted! >.< lol.

Dentafrice1
27-05-2006, 03:51 AM
Oh ;p lol

LeTomb
27-05-2006, 07:23 AM
Move the

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

underneath <?php

Want to hide these adverts? Register an account for free!