Jump to content


Photo

test if gd working need help


  • Please log in to reply
3 replies to this topic

#1 redarrow

redarrow
  • Members
  • PipPipPip
  • Advanced Member
  • 7,308 posts
  • Locationlondon

Posted 11 March 2006 - 12:07 AM

Has anyone got a test gd snippet to see if the gd libarry working please thanks.
Wish i new all about php DAM i will have to learn
((EMAIL CODE THAT WORKS))
http://simpleforum.ath.cx/mail2.inc
((PAYPAL INTEGRATION THAT WORKS))
http://simpleforum.a...aypal1_info.inc

#2 AndyB

AndyB
  • Staff Alumni
  • Advanced Member
  • 5,465 posts
  • LocationToronto

Posted 11 March 2006 - 12:14 AM

Check what's installed:
<?php
gd_info();
?>
Check the operation - there's a simple tutorial here on GD. That should do.
Legend has it that reading the manual never killed anyone.
My site

#3 redarrow

redarrow
  • Members
  • PipPipPip
  • Advanced Member
  • 7,308 posts
  • Locationlondon

Posted 11 March 2006 - 12:26 AM

[!--quoteo(post=353773:date=Mar 11 2006, 12:14 AM:name=AndyB)--][div class=\'quotetop\']QUOTE(AndyB @ Mar 11 2006, 12:14 AM) View Post[/div][div class=\'quotemain\'][!--quotec--]
Check what's installed:
<?php
gd_info();
?>
Check the operation - there's a simple tutorial here on GD. That should do.
[/quote]

from the phpinfo.php

Looks ok to me can you spot the problam please thank you.

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  


my test code but the success stops on type1 and type2 i think the types are for the pics.

<?php

function 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 functionality

ob_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)); 

?>

Wish i new all about php DAM i will have to learn
((EMAIL CODE THAT WORKS))
http://simpleforum.ath.cx/mail2.inc
((PAYPAL INTEGRATION THAT WORKS))
http://simpleforum.a...aypal1_info.inc

#4 d.shankar

d.shankar
  • Members
  • PipPipPip
  • Advanced Member
  • 535 posts

Posted 21 January 2008 - 11:10 AM

Is it possible to apply alt attribute in gd ??

<?php

echo "<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 ?


There are no rules when you kill for money. Signed in Blood.

Please someone help me solve this topic
http://www.phpfreaks...c,271648.0.html




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users