Php 在自定义路径中使用GD库保存裁剪的图像?
我正在使用GD库在使用Php 在自定义路径中使用GD库保存裁剪的图像?,php,image,gd,Php,Image,Gd,我正在使用GD库在使用 $source_handle = ImageCreateFromPNG(images/image_name.png) // for read image 然后,我在创造,就像 // Create a blank image $destination_handle = ImageCreateTrueColor($thumbWidth, $thumbHeight); // Put the cropped area onto the blank image
$source_handle = ImageCreateFromPNG(images/image_name.png) // for read image
然后,我在创造,就像
// Create a blank image
$destination_handle = ImageCreateTrueColor($thumbWidth, $thumbHeight);
// Put the cropped area onto the blank image
$check = ImageCopyResampled($destination_handle, $source_handle, 0, 0, $x1, $y1, $thumbWidth, $thumbHeight, $w, $h);
// Save the image
$function_to_write($destination_handle, $newFilename);
最后把图像写成
ImagePNG($destination_handle, $newFilename) //for write new cropped image, $newFilename contains whatever filename is!
一切正常,除了新文件的路径,它会自动保存在我的根文件夹中,如“www/web/”
我想把它保存在另一个文件夹中。可能吗?
请帮忙
$newFilename
必须包含路径、文件名和扩展名。示例path\u到\u文件夹/filename.png
Worked=),谢谢!