0
的我擴大與PHP GD圖像帆布:PHP GD imagefill - 區域填充到左源
$newimage = imagecreatetruecolor($imageWidth + 840, $imageHeight);
$color = imagecolorallocate($newimage, 0, 0, 0);
imagefill($newimage, 0, 0, $color);
imagecopy($newimage, $image, 0, 0, 0, 0, $imageWidth, $imageHeight);
//get extension of the cropped image
$ext = end(explode('.' , $imageName));
//timestamp it
$timestamp = time();
//rename the new image
$fileName = rand() . $timestamp . '.' . $ext;
//unlink old image
unlink($src);
//update the DB with new imagename
$update = array('update' => $this->image->update($imageID, $fileName));
//Set the path for the image
$path = 'data/gallery/' . $galleryID . '/images/album/' . $fileName;
//create the cropped image
imagejpeg($newimage,$path,$jpeg_quality);
可正常工作,畫布延伸到右側840個像素。我希望能夠做的是將畫布擴展到左邊的840像素。不知道如何做到這一點。
感謝您的幫助。