Jump to:

17452 Posts in 4473 Topics by 1971 members


SilverStripe Forums » Archive » Gd Problem

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

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

Page: 1
Go to End
Author Topic: 2127 Views
  • xyz
    14 Posts

    Gd Problem Link to this post


    function ImageObject() {

    $gdObject = new GD("/mysite/images/image.png");

    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

  • Sigurd
    Forum Moderator
    628 Posts

    Re: Gd Problem Link to this post

    This looks to be a path issue;

    You're asking PHP to open this file:

    Which doesn't exist.

    Presumeably you're trying to open

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

  • xyz
    14 Posts

    Re: Gd Problem Link to this post


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

    please help me

  • dio5
    Community Member
    501 Posts

    Re: Gd Problem Link to this post

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

  • xyz
    14 Posts

    Re: Gd Problem Link to this post


    Thank you for help,now i am going to try

Page: 1
Go to Top

Want to know more about the company that brought you SilverStripe? Then check out SilverStripe.com

Comments on this website? Please give feedback.