Reputation: 3074
I want to change image file as jpeg format as follows:
$img_real_path = realpath(".") . "/" .$dest;
echo $img_real_path;
$image = new Imagick();
$image->readImage($img_real_path);
$image->setImageFormat("jpeg");
But image format is same as it was. What am I doing wrong?
Upvotes: 0
Views: 1023
Reputation: 755
You're not using $image->imageWriteFile()
Add this to your code:
$image->imageWriteFile (fopen ($image_real_path, "wb"));
It should look like this:
$img_real_path = realpath(".") . "/" .$dest;
echo $img_real_path;
$image = new Imagick();
$image->readImage($img_real_path);
$image->setImageFormat("jpeg");
$image->imageWriteFile (fopen ($image_real_path, "wb"));
Upvotes: 2