0

GD Library を使用して、トリミング後に新しいサムネイル画像を保存しています。

$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/」のようなルート フォルダーに自動的に保存されます。

別のフォルダに保存したい。出来ますか?助けてください!

4

0 に答える 0