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.

We're retiring the forums!

The SilverStripe forums have passed their heyday. They'll stick around, but will be read only. We'd encourage you to get involved in the community via the following channels instead:

Archive /

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

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

Gd Problem


Go to End


5 Posts   2469 Views

Avatar
xyz

14 Posts

8 November 2007 at 5:22pm

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

Forum Moderator, 628 Posts

8 November 2007 at 6:55pm

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

14 Posts

8 November 2007 at 9:38pm

Hi,

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

please help me

Avatar
dio5

Community Member, 501 Posts

8 November 2007 at 10:02pm

- 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

14 Posts

8 November 2007 at 11:21pm

Hi,

Thank you for help,now i am going to try