clem_c_rock Posted October 10, 2006 Share Posted October 10, 2006 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 124here'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 Quote Link to comment Share on other sites More sharing options...
printf Posted October 10, 2006 Share Posted October 10, 2006 You have to give it a name, not just the directory....so this....[code]imagejpeg( $thumb, '../', 100 );[/code]needs to be something like this....[code]imagejpeg( $thumb, '../new_image.jpg', 100 );[/code]me! Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.