Jump to content

help me with gd


ahmed17

Recommended Posts

very weird problem with gd libary all time and i try more but no way
i used phpinfo() method to ensure if gd libary setup or not and  i am not found it installing and i ask
somebody wat i do then i found php.ini (configuration) and i remove  ; form gd then when i used  phpinfo
it appear
but when i run any code no result appears


[code]<?php
header("Content-type: image/gif");
$image= imagecreate(100,100)
or die("Cannot Initialize new GD image stream");
imagegif($im);
?>[/code]


gd with phpinfo()
[img]http://ahmed17.xlphp.net/gd.gif[/img]
Link to comment
Share on other sites

i test the following code  and take it copy and paste to ensure code is rigth  but the result is
[code]‰PNG  [/code]


the code
****************
[code]
<?php

// example1.php

// set the HTTP header type to PNG
header("Content-type: image/png");

// set the width and height of the new image in pixels
$width = 350;
$height = 360;

// create a pointer to a new true colour image
$im = ImageCreateTrueColor($width, $height);

// sets background to red
$red = ImageColorAllocate($im, 255, 0, 0);
ImageFillToBorder($im, 0, 0, $red, $red);

// send the new PNG image to the browser
ImagePNG($im);

// destroy the reference pointer to the image in memory to free up resources
ImageDestroy($im);

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

when i run this code
[code]<?php

// example1.php

// set the HTTP header type to PNG
header("Content-type: image/png");

// set the width and height of the new image in pixels
$width = 350;
$height = 360;

// create a pointer to a new true colour image
$im = ImageCreateTrueColor($width, $height);

// sets background to red
$red = ImageColorAllocate($im, 255, 0, 0);
ImageFillToBorder($im, 0, 0, $red, $red);

// send the new PNG image to the browser
ImagePNG($im);

// destroy the reference pointer to the image in memory to free up resources
ImageDestroy($im);

?>[/code]


the result of this code is      [quote] ‰PNG  [/quote]  so no result clear
Link to comment
Share on other sites

Rather than creating a PNG, maybe your browser doesnt support PNG. try a jpeg image instead so use:
[code=php:0]
// example1.php

// set the HTTP header type to JPEG
header("Content-type: image/jpeg");

// set the width and height of the new image in pixels
$width = 350;
$height = 360;

// create a pointer to a new true colour image
$im = ImageCreateTrueColor($width, $height);

// sets background to red
$red = ImageColorAllocate($im, 255, 0, 0);
ImageFillToBorder($im, 0, 0, $red, $red);

// send the new GIF image to the browser
Imagejpeg($im);

// destroy the reference pointer to the image in memory to free up resources
ImageDestroy($im);[/code]

Goto example.php you should get a red box. Also what does this return:
[code]<?php echo '<pre>' . print_r(gd_info(), true) . '</pre>'; ?>[/code]

Also what OS is your server running on, *nix (linux, unix, mac) or Windows?
Link to comment
Share on other sites

when i use this code
[code]<?php echo '<pre>' . print_r(gd_info(), true) . '</pre>'; ?>[/code]


the result is

Array
(
    [GD Version] => bundled (2.0 compatible)
    [FreeType Support] => 1
    [FreeType Linkage] => with freetype
    [T1Lib Support] =>
    [GIF Read Support] =>
    [GIF Create Support] =>
    [JPG Support] => 1
    [PNG Support] => 1
    [WBMP Support] => 1
    [XBM Support] =>
)
Link to comment
Share on other sites

[quote author=AndyB link=topic=107272.msg430480#msg430480 date=1157714602]
When I run exactly the same code using Firefox, I see a large red square.

I'd say there's something wrong with your GD library and/or set-up. Time to ask your web host for assistance
[/quote]

I run exactly the same code using Firefox, but give the same result
[code]‰PNG  [/code]
Link to comment
Share on other sites

OK, start a new topic. I suggest titling it "GD on localhost" so everyone will know what you're trying to do.

State exactly what you have for the server O/S, what version of php you're running, and that you have GD2 as part of the package and quote the GD info that you quoted earlier in this thread.  That should get you the assistance you need (let's hope).
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.