Skip to content

Instantly share code, notes, and snippets.

@luancmaia
Created January 9, 2018 21:24
Show Gist options
  • Save luancmaia/6c67cafdef110b0b9149d15a5083ff7b to your computer and use it in GitHub Desktop.
Save luancmaia/6c67cafdef110b0b9149d15a5083ff7b to your computer and use it in GitHub Desktop.
$image = new Imagick();
$image->newImage(1100, 460, new ImagickPixel('red'));
$image->setImageFormat("jpg");
$type=$image->getFormat();
header("Content-type: $type");
$iw = $image->getimagewidth();
$ih = $image->getimageheight();
$inw = $iw / $ih * 460;
$texture = new Imagick();
$texture->readImage($pathToImage);
$texture->scaleImage($inw, 460);
$image = $image->textureImage($texture);
echo $image;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment