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've moved the forum!

Please use forum.silverstripe.org for any new questions (announcement).
The forum archive will stick around, but will be read only.

You can also use our Slack channel or StackOverflow to ask for help.
Check out our community overview for more options to contribute.

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   2703 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