Created
January 10, 2014 13:04
-
-
Save ronnyandre/8351604 to your computer and use it in GitHub Desktop.
Resize PDF with WP_Image_Editor to square JPEG thumbnail.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// Load PDF | |
$img = wp_get_image_editor( 'my/temp/uploads/path/mypdf.pdf' ); | |
// Resize PDF | |
$img->resize( 50, 50, TRUE ); | |
// Generate filename | |
$filename = $img->generate_filename( 'thumb', 'wp/wp-content/uploads/thumbs/', 'jpg' ); | |
// Save | |
$img->save( $filename, 'image/jpeg' ); | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment