如何使用imagick的writeImage()函数? [英] How to use imagick's writeImage() function?

查看:283
本文介绍了如何使用imagick的writeImage()函数?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如果我将脚本与要处理的图像放在同一目录中,则此方法有效.并且生成的图像"foo.jpg"也在同一位置生成.

This works if I keep the script in the same directory as the image being manipulated. And the resultant image "foo.jpg" is also generated in the same location.

<?php

$im = new imagick('image.jpg');
$im->thumbnailImage( 200, 0);
$im->writeImage("foo.jpg");

?>

但是,如果脚本位于一个位置,而我希望使用的图像位于另一个位置,而我希望将缩略图保存到的位置位于另一个位置,怎么办?

But what if the script is in one location and the image I wish to work with is in another and the location I wish to save the thumbnail to is somewhere else, how to specify these paths?

做这样的事情是行不通的:

Doing something like this doesn't work:

$im = new imagick('path/to/image.jpg');

推荐答案

可能是某些文件系统问题.首先尝试在php中获取文件指针,然后检查是否存在任何问题

Might be some file system problem. Try and get a file pointer in php first and check for any problems

$fileHandle = fopen("path/to/image.jpg", "w");

然后您可以使用Imagick函数(版本6.3.6或更高版本);

You can then use Imagick function (version 6.3.6 or newer);

$im->writeImageFile($filehandle);

这篇关于如何使用imagick的writeImage()函数?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆