Jump to content

Directory permissions problems w/ imagejpeg():


clem_c_rock

Recommended Posts


Hello,

  I'm trying to create thumbnails w/ the  imagejpeg():  and no matter what directory I try to reference w/ the function and no matter what permissions I give any folder, I still get this error:

Warning: imagejpeg(): Unable to open '../' for writing in /home/content/e/r/i/eric68/html/admin/catalogue/catalogue_admin.php on line 124


here's the function I'm using:

[code]
function thumb( $filename, $destination, $th_width, $th_height, $forcefill )

      list( $width, $height ) = getimagesize( $filename );
      $source = imagecreatefromjpeg( $filename );

      #$filename = '../../uploaded_gallery_photos/global_album_photos/25_tn_bgfish.jpg';

      if( $width > $th_width || $height > $th_height )
      {
            $a = $th_width/$th_height;
            $b = $width/$height;

    if( ( $a > $b ) ^ $forcefill )
    {
        $src_rect_width  = $a * $height;
        $src_rect_height = $height;
        if(!$forcefill)
        {
          $src_rect_width = $width;
          $th_width = $th_height/$height*$width;
        }
    }
    else
    {
        $src_rect_height = $width/$a;
        $src_rect_width  = $width;
        if(!$forcefill)
        {
          $src_rect_height = $height;
          $th_height = $th_width/$width*$height;
        }
    }

    $src_rect_xoffset = ( $width - $src_rect_width ) / 2*intval( $forcefill );
$src_rect_yoffset = ( $height - $src_rect_height ) / 2*intval( $forcefill );

    $thumb  = imagecreatetruecolor($th_width, $th_height);
    imagecopyresized( $thumb, $source, 0, 0, $src_rect_xoffset, $src_rect_yoffset, $th_width, $th_height, $src_rect_width, $src_rect_height );

            echo "<br>thumb-->>$thumb || filename-->>$filename || destination-->>$destination";
    #imagejpeg( $thumb, $destination );
            imagejpeg( $thumb, '../', 100 );
  }
}
[/code]

Just don't get it.

Clem C
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.