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
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...
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