Hi,

    Does the user under wich the Apache server runs (implicitly PHP)
has write access to those directories ?

Cheers,
Catalin

"Seth Willits" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> Warning:  imagejpeg(): Unable to open
> 'thumbnails/marching/years/2000/Miscellaneous/24left.jpg' for writing
> in /Library/WebServer/Documents/pictures/list.php on line 28
>
> I'm looping through a directory and creating thumbnail images and in
> doing so, I get the error above for each image. The code I'm using to
> resize and create the image is below (it's an example from php.net) and
> the parameters are as follows:
>
> $forcedwidth = 100
> $forcedheight = 100
> $sourcefile = 'marching/years/2000/Miscellaneous/24left.jpg'
> $destfile = 'thumbnails/marching/years/2000/Miscellaneous/24left.jpg'
> $imgcomp = 50
>
>
> Both directories exist as does the source file. Which makes me wonder,
> will the library create a directory if it doesn't exist?
>
>
> function resampimagejpg($forcedwidth, $forcedheight, $sourcefile,
> $destfile, $imgcomp) {
> $g_imgcomp=100-$imgcomp;
> $g_srcfile=$sourcefile;
> $g_dstfile=$destfile;
> $g_fw=$forcedwidth;
> $g_fh=$forcedheight;
> $g_is=getimagesize($g_srcfile);
>
> if (file_exists($g_srcfile)) {
> /////////////// Set Image Size ///////////////////
> if(($g_is[0]-$g_fw)>=($g_is[1]-$g_fh)) {
> /// Width is Greater Than Or Equal to Height
> $g_iw=$g_fw;
> $g_ih=($g_fw/$g_is[0])*$g_is[1];
> } else {
> /// Height is Greater than Width
> $g_ih=$g_fh;
> $g_iw=($g_ih/$g_is[1])*$g_is[0];
> }
>
> ////////////// Create Thumbnail ///////////////////
> $img_src=imagecreatefromjpeg($g_srcfile);
> $img_dst=imagecreate($g_iw, $g_ih);
> imagecopyresampled($img_dst, $img_src, 0, 0, 0, 0, $g_iw, $g_ih,
> $g_is[0], $g_is[1]);
> imagejpeg($img_dst, $g_dstfile, $g_imgcomp);
> imagedestroy($img_dst);
> } else
> return false;
> }
>
>
>
> Seth Willits
> ------------------------------------------------------------------------ 
> ---
> President and Head Developer of Freak Software - http://www.freaksw.com
> Q&A Columnist for REALbasic Developer Magazine -
> http://www.rbdeveloper.com
> Webmaster for REALbasic Game Central - http://www.freaksw.com/rbgames
>
> "Few are those who see with their own eyes and feel with their own
> hearts."
>      -- Albert Einstein
> ------------------------------------------------------------------------ 
> ---

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to