本文整理汇总了PHP中imagick::setImageFilename方法的典型用法代码示例。如果您正苦于以下问题:PHP imagick::setImageFilename方法的具体用法?PHP imagick::setImageFilename怎么用?PHP imagick::setImageFilename使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类imagick
的用法示例。
在下文中一共展示了imagick::setImageFilename方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: fopen
// So in this case we want to write PNG but file should come out
// as JPEG
$fp = fopen(PNG_FILE, "w+");
$im->readImage(JPEG_FILE);
$im->setImageFormat('png');
$im->writeImageFile($fp);
$im->clear();
fclose($fp);
// Output the format
$identify = new Imagick(PNG_FILE);
echo $identify->getImageFormat() . PHP_EOL;
// Lets try again, setting the filename rather than format
// This should cause PNG image to be written
$fp = fopen(PNG_FILE, "w+");
$im->readImage(JPEG_FILE);
$im->setImageFilename('png:');
$im->writeImageFile($fp);
$im->clear();
fclose($fp);
// If all goes according to plan, on second time we should get PNG
$identify = new Imagick(PNG_FILE);
echo $identify->getImageFormat() . PHP_EOL;
// Lastly, test the newly added format parameter
$fp = fopen(PNG_FILE, "w+");
$im->readImage(JPEG_FILE);
$im->writeImageFile($fp, 'png');
$im->clear();
fclose($fp);
// If all goes according to plan, on second time we should get PNG
$identify = new Imagick(PNG_FILE);
echo $identify->getImageFormat() . PHP_EOL;