简体   繁体   English

在XAMPP1.7.7上使用Imagick保存图像

[英]Use Imagick on XAMPP1.7.7 for save image

I have the following code block: 我有以下代码块:

<?php
$im = new imagick('test.jpg');
echo "a";
?>

if $im is omitted, the result is "a" but if $im isn't omitted then the result is "". 如果省略$ im,则结果为“ a”;但如果不省略$ im,则结果为“”。 Is this because imagick isn't installed well? 这是因为imagick的安装不正确吗? If that's the answer, how can I install it well for XAMPP 1.7.7? 如果是这样,我如何为XAMPP 1.7.7很好地安装它? On the net there's little information and they talk about using old versions of imagick but I don't like that idea. 网上几乎没有信息,他们谈论使用imagick的旧版本,但我不喜欢这个想法。

Another question I have about imagick is that I want to reprocess an image and save it in my server. 关于imagick的另一个问题是我想重新处理图像并将其保存在服务器中。 I have read about the use of move_uploaded_file but if I use writeimage I won't use that. 我已经阅读了关于move_uploaded_file的用法,但是如果我使用writeimage,则不会使用它。 Do I need to use it in a different way? 我需要以其他方式使用它吗?

Last question: I pass an image encoded in 64 base and I decode in a php file. 最后一个问题:我通过一个以64 base为基础编码的图像,并在一个php文件中解码。 How can I assign the decode image to Imagick without saving it before? 如何在不保存的情况下将解码图像分配给Imagick?

To display. 显示。

<?
$im = new imagick('test.jpg');
$im->setImageFormat('jpg');
header('Content-type: image/jpg');
echo $im;
?>

To save 保存

<?
$im = new imagick('test.jpg');
$im->setImageFormat('jpg');
$saveToDir = "/home/";
$imageName = "image.jpg";
$im->writeImage($saveToDir . $imageName);
?>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM