redarrow Posted March 11, 2006 Share Posted March 11, 2006 Has anyone got a test gd snippet to see if the gd libarry working please thanks. Quote Link to comment Share on other sites More sharing options...
AndyB Posted March 11, 2006 Share Posted March 11, 2006 Check what's installed:[code]<?phpgd_info();?> [/code]Check the operation - there's a simple tutorial here on GD. That should do. Quote Link to comment Share on other sites More sharing options...
redarrow Posted March 11, 2006 Author Share Posted March 11, 2006 [!--quoteo(post=353773:date=Mar 11 2006, 12:14 AM:name=AndyB)--][div class=\'quotetop\']QUOTE(AndyB @ Mar 11 2006, 12:14 AM) [snapback]353773[/snapback][/div][div class=\'quotemain\'][!--quotec--]Check what's installed:[code]<?phpgd_info();?> [/code]Check the operation - there's a simple tutorial here on GD. That should do.[/quote]from the phpinfo.phpLooks ok to me can you spot the problam please thank you.[code]GD Support enabled GD Version bundled (2.0.28 compatible) FreeType Support enabled FreeType Linkage with freetype GIF Read Support enabled GIF Create Support enabled JPG Support enabled PNG Support enabled WBMP Support enabled XBM Support enabled [/code]my test code but the success stops on type1 and type2 i think the types are for the pics.[code]<?phpfunction test ($string, $test){ echo $string . '... '; if ($test) echo "success.\n"; else echo "fail.\n";}$token = "Testing GD!";// Create image$pic = ImageCreate (300, 300); test ('Creating image', $pic);$col2 = ImageColorAllocate ($pic, 0, 0, 100); $col1 = ImageColorAllocate ($pic, 200, 200, 200); // Test PNG/JPG functionalityob_start();$res1 = @ImagePNG ($pic);$res2 = @ImageJPEG ($pic);ob_clean();test ('Testing PNG output', $res1);test ('Testing JPEG output', $res2);// Test TrueType functionality$ttfont = trim (`locate -n 1 .ttf`);test ('Testing FreeType', @ImageTTFText ($pic, 30, 0, 10, 40, $col1, $ttfont, $token));test ('Testing FreeType2', @ImageFTText ($pic, 30, 0, 10, 40, $col1, $ttfont, $token, array()));// Test Type1 functionality$font = @ImagePsLoadFont (trim (`locate -n 1 .pfb`));if ($font) $res = @ImagePsText ($pic, $token, $font, 10, $col1, $col2, 0, 0);test ('Testing the Type1 library', ($font && $res));test ('Destroying image', ImageDestroy($pic)); ?>[/code] Quote Link to comment Share on other sites More sharing options...
d.shankar Posted January 21, 2008 Share Posted January 21, 2008 [quote]Is it possible to apply alt attribute in gd ??<?phpecho "<img src=".crImage()." alt='testing alt'>";function crImage(){header("Content-type: image/gif");$im = imagecreatefrompng("new.gif");imagepng($im);imagedestroy($im);}?>The above code creates an image is it possible to add an alt attribute to it ?[/quote] Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.