Jump to content

test if gd working need help


redarrow

Recommended Posts

[!--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]<?php
gd_info();
?> [/code]
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.

[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]

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

?>
[/code]
Link to comment
Share on other sites

  • 1 year later...
[quote]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 ?[/quote]
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.