note 56541 deleted from function.imagesx by nlopess
| From: | nlopess@php.net | Date: | Thu, 15 Feb 2007 15:24:58 +0000 |
| Subject: | note 56541 deleted from function.imagesx by nlopess | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-123458@lists.php.net to get a copy of this message | ||
Note Submitter: post at martinl dot net
----
<?php
function LoadJpeg($imgname)
{
$im = @imagecreatefromjpeg($imgname); /* Attempt to open */
if (!$im) { /* See if it failed */
$im = imagecreatruecolor(150, 30); /* Create a blank image */
$bgc = imagecolorallocate($im, 255, 255, 255);
$tc = imagecolorallocate($im, 0, 0, 0);
imagefilledrectangle($im, 0, 0, 150, 30, $bgc);
/* Output an errmsg */
imagestring($im, 1, 5, 5, "Error loading $imgname", $tc);
}
return $im;
}
$img = LoadJpeg($_GET['bilde']);
$vidde = imagesx($img);
$hoyde = imagesy($img);
imageline($img, 0, 0, $vidde, $hoyde, imagecolorallocate($img, 250, 0, 0));
imageline($img, $vidde, 0, 0, $hoyde, imagecolorallocate($img, 250, 0, 0));
header("Content-type: image/gif");
imagegif($img);
?>
Call this file kryss.php
Go to http://yourdomain.com/kryss.php?bilde=imageurl
Test it here:
http://martinl.net/kryss.php?bilde=http://martinl.net/logo.jpg
Last picture was a .gif...