Imagemagick执行和转换 [英] Imagemagick exec and convert

查看:110
本文介绍了Imagemagick执行和转换的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我最近开始使用带有php和
的imagemagick我对这两个,IM和PHP都相对较新。
所以,我在这里要求一些帮助/建议。

I recently started using imagemagick with php and I'm relatively new with both of these, IM and PHP. So, I'm here to ask for some help/suggestion(s).

如果让我们说用户在
我的网站上传gif或png图像,我希望它转换为jpg,那么有没有任何
命令,例如。 $ image- >转换($ file,'。jpg)
或转换命令只能通过 exec()访问?
例如 exec(将picture.png 转换为picture.jpg)

If lets say a user uploads a gif or a png image on my site and I want it converted to jpg, is there any command like for example.$image->convert($file,'.jpg) or the convert command is accesible only thru exec() ? like for example exec(convert picture.png to picture.jpg)

如果再一次,用户在网站
上传gif / png并将图像大小调整为指定的宽度/高度并且
写入图像,使用IM的writeImage函数,如下所示:
$ image-> writeImage(basename。$ ext)其中 $ ext = jpg。
这项工作是否正常,这是一个好习惯吗?我认为这只是
只重命名但仍然,我没有看到这个问题... oO

What if for again, the user uploads gif/png on the site and I resize the image to a specified width/height and write the image, with the writeImage function of IM like this: $image->writeImage(basename.$ext) where $ext = jpg. Will this work properly,is this a good practice? I assume this will only rename it but still, I don't see a problem in this... o.O

哦对不起再问一个问题,我我不太熟悉exec,
使用imagemagick使用 exec()会更好吗,它会提高
的速度,加载等吗?

Oh sorry one more question, I'm not very familiar with exec, is it better using imagemagick using exec(), does it improve speed, load etc?

推荐答案

我无法直接回答您的问题,但我认为我指的是一些资源:

I can't answer your questions directly but thought I point you to a few resources:

关于哪个更好,exec或PHP扩展,几个月前我问了同样的问题:

Regarding which is better, exec or the PHP extension, I asked this same question a few months ago:

我应该为ImageMagick使用PHP扩展还是只使用PHP的Exec()函数运行终端命令?

对于所有Image Magick PHP函数,你应该查看官方指南:

For all Image Magick PHP functions you should look up the official guide:

http://www.php.net/ manual / en / book.imagick.php

我从Image Magick切换到Graphics Magick,因为我听说它有更好的性能。它是Image Magick的一个分支,强调性能。像Flickr和Etsy这样的大型网站使用它:

I switched from Image Magick to Graphics Magick as I heard it has better performance. It is a fork of Image Magick with an emphasis on performance. Large sites like Flickr and Etsy use it:

http:/ /www.graphicsmagick.org/

本指南让我入门:

http://devzone.zend.com/1559/manipulating-images- with-php-and-graphicsmagick /

他们在php.net上有自己的手册:

And they have their own manual on php.net:

http://php.net/manual/en/book.gmagick.php (大多数命令与Image Magick相同)

http://php.net/manual/en/book.gmagick.php (most of the commands are identical to Image Magick's)

这篇关于Imagemagick执行和转换的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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