imagemagick新形象

How to create a new image with imagemagick?

exec('/usr/local/bin/convert -size 900x360 -quality 90 xc:white new_image.png')

what am I doing wrong here? The image is not created.. Imagemagick does work because I can resize an already existing image

... and how is it possible to define a HEX code color as background eg. ff0000

There are no errors in Apache error log

edit

$this->image = tempnam(Init::$dynamic['tmp_path'], null);
        $syn = $this->path_im.'convert -size '.$this->width.'x'.$this->height.' -quality '.$this->quality.' xc:white '.$this->image;
        echo $syn;
        exec($syn);

It's hard to solve a problem without knowing what it is, but here are some ideas.

SSH

If you have Secure Shell access to your server (or it's on your local computer) you should navigate to the same directory your script is in, and then run the command from there. That way you can see the output from the command. Check the errors, search them on Google, fix the problem.

Permissions

On UNIX computers, different users have different permissions in different places. Make sure that your directory lets you write to it. Try changing the permissions to 777 for the folder either with chmod 777 myfolder/ or chmod a+w myfolder or with your GUI interface. Then try the command again.

Once you have that working, you can put it back to 755. The 777 is to make testing less error-prone.

Hope that helps.

Apart from using chmod, another suggestion would be to install the imagick extension with pecl, that way you won't need to use exec, and you're less likely to get issues, plus imagick is easy to use!