I had this code for saving thumbnails into the db (some of it):
Code: Select all
.................
$img2 = imagecreatetruecolor( 150, 150 );
imagecopyresampled ( $img2, $img, 0, 0, 0 , 0, $thumb_x, $thumb_y, $w, $h );
$fimg = time().$userid . '.jpg';
$real_tpath = realpath ("temp");
if( $HTTP_ENV_VARS['OS'] == 'Windows_NT'){
$real_tpath= str_replace( "\\", "\\\\", $real_tpath);
$file = $real_tpath . "\\" . $fimg;
}else{
$file = $real_tpath . "/" . $fimg;
}
imagejpeg($img2, $file, $C_QUAL);
imagedestroy($img2);
imagedestroy($img);
return $file;
...............
Code: Select all
Warning: imagejpeg() [function.imagejpeg]: Unable to open '/1231707631.jpg' for writing: Permission denied in /home/<user>/public_html/photos.php on line 220Code: Select all
$file = $real_tpath . "/" . $fimg;Code: Select all
$file = $real_tpath . "../images/" . $fimg;Is this the right approach ?
Thanks