Cropping images
-
Hello,
Is it possible to add crop function to this plugin? It works brilliant, but I want to hard crop image.
https://developer.wordpress.org/reference/functions/add_image_size/
I maean something like this for example:
// Add support for cropping default WordPress large images –
if(!get_option(‘large_crop’))
add_option(‘large_crop’, 1200, 720, array(‘center’,’center’));
else
update_option(‘large_crop’, 1200, 720, array(‘center’,’center’));Or registering new size like this:
add_image_size( ‘large_crop’, 1200, 720, array( ‘center’, ‘center’ ) ); // Hard crop center center
I can add this to the functions.php theme, but it works only with pages and posts. I need this to have it globally and via your plugin it is possible after changing the code properly.
This is how this function looks like:
function add_image_size( $name, $width = 0, $height = 0, $crop = false ) {
global $_wp_additional_image_sizes;
$_wp_additional_image_sizes[ $name ] = array(
‘width’ => absint( $width ),
‘height’ => absint( $height ),
‘crop’ => $crop,
);
}Just answer here please , I can do it by myself and add necessary changes in your plugin files. All I need to know is what and where I should change.
The topic ‘Cropping images’ is closed to new replies.