Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

Archive

Our old forums are still available as a read-only archive.

Moderators: martimiz, Sean, biapar, Willr, Ingo, simon_w

Gd Problem


Reply

5 Posts   2134 Views

Avatar
xyz

8 November 2007 at 5:22pm 14 Posts

Hi

function ImageObject() {

$gdObject = new GD("/mysite/images/image.png");
      $gdObject->resize;
$gdObject->gd;
}

I am creating a object for GD But i am getting below error

FATAL ERROR: getimagesize(/mysite/images/image.png) [function.getimagesize]: failed to open stream: No such file or directory
At line 35 in C:\lighttpd\htdocs\sapphire\filesystem\GD.php

please anybody help me what is wrong in my code

Avatar
Sigurd

8 November 2007 at 6:55pm Forum Moderator, 628 Posts

This looks to be a path issue;

You're asking PHP to open this file:
C:\mysite\images\image.png

Which doesn't exist.

Presumeably you're trying to open
C:\lighttpd\htdocs\mysite\images\image.png

You need to specify the full path, or use relative filenames. (like ../mysite/images/image.png )

Avatar
xyz

8 November 2007 at 9:38pm 14 Posts

Hi,

thank you for replay,but i already tried for full path then only it is giving same error.

please help me

Avatar
dio5

8 November 2007 at 10:02pm Community Member, 501 Posts

- Make sure the image exists. When I used GD, I got the filename out the the File table. So something like:

$photo = DataObject::get_by_id("File", $tip->PhotoID);
$GDImage = new GD("../".$photo->Filename);

- Don't you have to specify a width and height? what I did was:

$rs = $GDImage->resize($newWidth, $newHeight);

- I am not sure what you're doing with the last line. AFAIK $gd is a protected variable...

Hope this helps.

Avatar
xyz

8 November 2007 at 11:21pm 14 Posts

Hi,

Thank you for help,now i am going to try