在自定义路径中使用GD库保存裁剪的图像?

时间:2013-09-30 09:27:40

标签: 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
    $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 /',

我想将其保存在另一个文件夹中。可能吗? 请帮忙!

0 个答案:

没有答案