Custom Thumbnails in Wordpress using Imagick

I want to upload an image to Wordpress and create a really custom additional thumbnail for it using imagick.

I have the code for imagick - that works. But I have no idea, how I should implement it in the wordpress upload. Can you help me with this? Is there maybe a better way to do this than to hook into the Wordpress upload event?

Thank you.

My code for imagick is:

    <?php
/* Create new object */
$im = new Imagick();

/* Create new checkerboard pattern */
$im->readImage('test.jpg'); 

/* Set the image format to png */
$im->setImageFormat('png');

/* Fill new visible areas with transparent */
$im->setImageVirtualPixelMethod(Imagick::VIRTUALPIXELMETHOD_TRANSPARENT);

/* Activate matte */
$im->setImageMatte(true);

/* Control points for the distortion */
$controlPoints = array(500, 30, 133,150,90,2800);
/*size, inner-circle, padding links, padding-top (jeweils Mittelpunkt), wie weit, */


/* Perform the distortion */                       
$im->distortImage(Imagick::DISTORTION_POLAR, $controlPoints, true);



/* Ouput the image */
header("Content-Type: image/png");
echo $im;
?>

Solutions

if you have ImageMagick enabled but you don’t have the Imagick PHP extension. Without both WordPress won ’t automatically use ImageMagick. This plugin enables you to use it and has other awesome features.

You can use follwing plugin: https://wordpress.org/plugins/imagemagick-engine/

Similar questions

If I Regenerate Thumbnails, would WordPress delete the existing Thumbnails and replace them with 'new copies'?
I am currently working on a website, which has 1,000's of Product Images. All of these images were uploaded, without being optimized accordingly. For instance, most of the Product Images were uploaded with 5000px by 3000px dimensions which is far too large. I have downloaded these Product Images to my computer, to start resizing them. Rather than m...
Multiple featured image thumbnails for post types (Multiple Post Thumbnails plugin)
I found a plugin called Multiple Post Thumbnails and followed the directions in getting it set up. Everything shows up correctly in the admin dashboard (i.e. shows two sections to upload two separate thumbnails) but after I set the two thumbnails for each post and view the page which displays those posts, only the first post I set the thumbnails fo...
Regenerate Thumbnails Plugin successfully updated my thumbnails but image src won't change to new image size?
I "successfully" regenerated my thumbnails using the Regenerate Thumbnails Plugin as I added a variety of new image sizes to my site; however, I'm having difficulty getting these new images sizes to actual display. When I inspect each image it is still showing the old image size path in the src="". I don't have any cacheing plugins running (this is...
How do I add "live thumbnails" or slideshow like thumbnails?
I noticed on Tube sites like YouTube and some cheap adult sites built on WordPress, you can mouse over a video file (post) and the image will play a video in some cases, and a slideshow preview of the video in others. How is this possible? Every single Google Search result for Live Thumbnails gives me nothing related on how to create, or better yet...
Display Thumbnails Description with Multiple Post Thumbnails
I've added multiple featured images to my wordpress site using the multiple post thumbnail plugin. I'm trying to display them all underneath the content with their descriptions. I can do it for the main featured image no problem. I can display the rest of the featured images no problem, but whenever I try to add description by it's the page descrip...
Custom post thumbnails not using custom sizes
I have few post thumbnails sizes but it seems like it is not picking them up as I want as it is automatically proportioning by giving its own sizes even tho I have provided fixed sizes in function.php: In my function.php: In my template: Basically assigning an array so that i get random picked up sizes, yet while the width is correct for all the im...

Also ask

We use cookies to deliver the best possible experience on our website. By continuing to use this site, accepting or closing this box, you consent to our use of cookies. To learn more, visit our privacy policy .