#1
  1. No Profile Picture
    bag
    Guest
    Devshed Newbie (0 - 499 posts)
    Im using the GD.pm library to greate some dynamic graphics. I've got the graphics working but I can't get the open() function to save the genrated graphic to the right directory. It will save to the working directory which is /cgi-local but I want it to go in my /webdesign/images directory.

    this works:

    $gif_data = $image->gif;
    open (GIF,'>pic.gif') | | die;
    print GIF $gif_data;
    close GIF;

    it creates the file pic.gif in my cgi-local directory


    but if I try:

    $gif_data = $image->gif;
    open (GIF,'>/webdesign/images/pic.gif') | | die;
    print GIF $gif_data;
    close GIF;

    It bombs on me.

    I tried working through the documentation on perl.org but found it very confusing.

    I'm just learning so I apologise for bombarding the forum with questions.

    I really appreciate all the help everyone has provided.

    BAG
  2. #2
  3. No Profile Picture
    cbolt
    Guest
    Devshed Newbie (0 - 499 posts)
    Define 'bombs'... what error does it give you?

    You must make sure that your /webdesign/images directory is chmoded to 777 so it has permission to create a file there. At a shell prompt, type the following:

    <BLOCKQUOTE><font size="1" face="Verdana,Arial,Helvetica">code:</font><HR><pre>cd /webdesign
    chmod 777 images[/quote]

    And that should give it the required permissions...
  4. #3
  5. No Profile Picture
    bag
    Guest
    Devshed Newbie (0 - 499 posts)
    Internal Server Error.

  6. #4
  7. No Profile Picture
    cbolt
    Guest
    Devshed Newbie (0 - 499 posts)
    Can you find out what error you get by running it manually by telnetting to the server and running perl yourscript.pl? That should give you a much more descriptive error message. If you can't do that, try chmoding the images directory to 777 (you should be able to do this with your FTP client, something like "Change Permissions")
  8. #5
  9. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jan 2000
    Posts
    4
    Rep Power
    0
    um...
    instead of your current code:
    open (GIF,'>/webdesign/images/pic.gif') | | die;

    try something like this?
    open (GIF,'>../webdesign/images/pic.gif') | | die;

    i've had problems like that.
    just cruise directly to it?
    ???
    just a thought?


    ----------------------------------

    <BLOCKQUOTE><font size="1" face="Verdana,Arial,Helvetica">quote:</font><HR>Originally posted by cbolt:
    Define 'bombs'... what error does it give you?

    You must make sure that your /webdesign/images directory is chmoded to 777 so it has permission to create a file there. At a shell prompt, type the following:

    <BLOCKQUOTE><font size="1" face="Verdana,Arial,Helvetica">code:</font><HR><pre>cd /webdesign
    chmod 777 images[/quote]

    And that should give it the required permissions...
    [/quote]

  10. #6
  11. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jul 1999
    Posts
    33
    Rep Power
    16
    Off topic a little, are the images coming out fine? Even without going into binmode to write the file? (I don't know the GD.pm module)

    [This message has been edited by Imo (edited January 15, 2000).]
  12. #7
  13. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Nov 1999
    Posts
    1
    Rep Power
    0
    Imo. The images come out fine GD.pm is pretty easy to use.

    I got it working actually, I forgot to put the .. before the path. I'm an idiot.

    Thanks for everyone's help.

IMN logo majestic logo threadwatch logo seochat tools logo