Jump to:

17452 Posts in 4473 Topics by 1971 members

Archive

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: 2072 Views
  • xyz
    Avatar
    14 Posts

    Gd Problem Link to this post

    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

  • Sigurd
    Avatar
    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:
    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 )

  • xyz
    Avatar
    14 Posts

    Re: Gd Problem Link to this post

    Hi,

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

    please help me

  • dio5
    Avatar
    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
    Avatar
    14 Posts

    Re: Gd Problem Link to this post

    Hi,

    Thank you for help,now i am going to try

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