The online racing simulator
Image generation in PHP
(10 posts, started )
Image generation in PHP
Am working on a small project
www.liveforspeed.no/card.php
I am curiouse how to generate the www.lfsworld.net/isonline.blackfang
into the generated image.

<?php
$license = $_GET['license'];
$ingame = $_GET['ingame'];
$team = $_GET['team'];
$cars = $_GET['cars'];
$url = $_GET['url'];

Header ("Content-type: image/jpeg");
$img_handle = imageCreateFromJPEG("card.jpg");
$color = ImageColorAllocate ($img_handle, 255, 255, 255);
ImageString ($img_handle, 30, 57, 255, $license, $color);
ImageString ($img_handle, 30, 57, 337, $ingame, $color);
ImageString ($img_handle, 30, 360, 255, $cars, $color);
ImageString ($img_handle, 30, 360, 337, $url, $color);
ImageString ($img_handle, 30, 57, 425, $team, $color);
ImageAlphaBlending($img_handle, false);
ImageJPEG ($img_handle);
ImageDestroy ($img_handle);
}
?>

I have tried several ways but cant get the isonline.blackfang to get into the image.
For me it seems that LFSW takes too long when am trying to include the image, so the image is not loaded enough to get into the image.
Any suggestions?
#2 - filur

<?php 
$lfsw_image 
imagecreatefromgif('http://www.lfsworld.net/isonline.blackfang');
    
imagecopy($img_handle$lfsw_image22025000imagesx($lfsw_image), imagesy($lfsw_image));
?>

Woah... thanks filur
That font is ugly. If you want too, you can download a different GD font (*.gdf file). I googled and found a website with lots of GD fonts: http://www.widgnet.com/gdf_fonts/fonts.html

And a PHP fragment to load the font (I just read the page of the php manual for you since I was bored)


<?php 
$font 
imageloadfont("customfont.gdf");
imagestring($img_handle$font, [x], [y], [string], [color]);
?>

-
(blackfang) DELETED by blackfang
Thanks
Quote from wheel4hummer :That font is ugly. If you want too, you can download a different GD font (*.gdf file). I googled and found a website with lots of GD fonts: http://www.widgnet.com/gdf_fonts/fonts.html

And a PHP fragment to load the font (I just read the page of the php manual for you since I was bored)


<?php 
$font 
imageloadfont("customfont.gdf");
imagestring($img_handle$font, [x], [y], [string], [color]);
?>


or better yet, you can use TrueType fonts as well : http://nl2.php.net/manual/en/function.imagettftext.php
That works too
Also, this may be a bit OT, but you should put as small an amount of red in a jpeg as possible. In a jpeg, red always has lots of compression artifacts. Or just use PNG.
-
(blackfang) DELETED by blackfang
Nice

Quick suggestion though, having a 2.1MB gif loading on your page isn't the best idea. Takes a bit too long to load and bogs people down if they are browsing other sites simultaneously.

Otherwise, nice work

edit: wheel4hummer its actually Cb (blue) and Cr (red) that are downsampled the most in JPG compression, as the human eye can see more detail in the Y component. However as you say, I'd always use PNG unless the image is very large.

Image generation in PHP
(10 posts, started )
FGED GREDG RDFGDR GSFDG