Using imagegick with php to resize - php

I downloaded ImageMagick expecting to use it to resize images on my website like phpthumb use to do before the function are deprecated. But the fact is that i am not finding anywhere how to use it to resize en image with PHP code.
I see some command line but i want to resize using some php code
Thanks for helping

Sure you can resize images with imagemagik. PHP has a wrapper class. Check this https://github.com/avalanche123/Imagine and this http://imagine.readthedocs.org/en/latest/usage/introduction.html#resize-images. You can go with GD library if needs are minimal with images.

Related

How to connect ghostscript with imagecreatefrompng in PHP?

I am currently using ghostscript, via exec() from PHP, to create a PNG image that is saved to a file.
And then I use imagecreatefrompng() to load it into PHP. I am wondering if there is a way to directly connect these without first saving it to a file and then reading it from a file. Does this work with the expect:// wrappers? If so could somebody provide an example? I am not sure about the syntax.
Another solution may perhaps be with imagecreatefromstring() if one can get the image file as a string from ghostscript. I am looking for an example of how to do this. The image files I create are not that large, typically 600 x 150 pixels.

Yii create PDF Thumbnail with ImageMagick

I want to create auto Thumbnail if i upload my PDF, then i will save that path
i build my website with yii framework
i want to try capture with ImageMagick
Any Body Help..
Thx
I am also using Yii framework to generate the image file. It is pretty simple and straight forward. I am using window XP/apache and php 5.4
Download and install the imagemagick http://www.imagemagick.org/script/download.php
Download and install php extension for imagemagic http://pecl.php.net/package/imagick
Download and install the ghostscript because image magic use the ghost script to convert the pdf to images http://www.ghostscript.com/download/
Write a method in your model class to handle conversion
use command : command format OR
use library : php manual
Call the method after your form submission.
check if the image is saved at the desired location. I hope that help. Let me know if you face any issue.
I know you asked about ImageMagick but maybe you could use GD instead to accomplish such simple operation.
It's available virtually on every hosting.
Examples in comments below docs.
http://php.net/manual/en/book.image.php

creating a box with an image

I'd like to take an image and turn the corners over to make a box (like a canvas painting)
i have gd library, imagemagick installed on the server and imagick php extension installed.
is it possible? any help appreciated
turn the corners over
You're gonna need to explain this a little better. You can overlay a frame onto an image with the GD functions. Check out imagecopymerge()

resize animated GIFs with phpthumb

Im trying to use the phpThumb program to re-size an animated gif. But when i use it just as the site explains it in the demo, my re-sized GIF is single frame only.
Anyone have experience with this software that could offer tip?
The line im using is
phpthumb.php?src=/anitest/images/animation.gif&w=125&f=gif
Here is link of demo im using
Check if you have ImageMagick installed. If you don't then phpThumb will use GD library to resze your images and this library doesn't support animated gifs resizing. There is a nice script in phpThumb (in a phpThumb.config.php file) that allows you to analyse your server configuration and check if everything is set up correctly.
Here's the demo of the script: link

How would I go about cropping an image automatically on the server?

Like at Digg.com, I want to get members' pictures cropped for an avatar use. Please show me how to do this in PHP.
Here is a free script that does it using either GD or Imagick (Imagick is faster so I would use that):
Crop & Resize with JavaScript, PHP, and ImageMagick
From near the top of the page linked above:
Update: A new version of this example
and demonstration has been released.
Version 1.1 includes a GD version of
the script as well as a number of
functional improvements worth checking
out.

Categories