Code: Select all
,Code: Select all
and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]
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: Select all
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 );
}
}Clem C
feyd | Please use
Code: Select all
,Code: Select all
and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]