Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author Stanislav Khromov

    (@khromov)

    Hey otavio,

    Thanks for explaining the issue so clearly. I’ve been trying to find a way to solve this but haven’t found the perfect solution yet.

    A “quick fix” is to simply not touch image sizes which have an array as a fourth parameter, like so:

    add_image_size( 'custom-size', 220, 220, array( 'left', 'top' ) );

    Ideally though, if we can somehow get the plugin to upscale cropped images properly, it’d be even better. I’ll look into it and will get back to you. Thanks again for the report.

    Late reply, but I found the solution for accounting for crop positions. I submitted it to GitHub here: https://github.com/jackrugile/wp-thumbnail-upscale/commit/eb48b515ed0ad58b784c3e146403f59262046553

    Add this directly before the return of the main function.

    if(is_array($crop)) {
    	if($crop[ 0 ] === 'left') {
    		$s_x = 0;
    	} else if($crop[ 0 ] === 'right') {
    		$s_x = $orig_w - $crop_w;
    	}
    	if($crop[ 1 ] === 'top') {
    		$s_y = 0;
    	} else if($crop[ 1 ] === 'bottom') {
    		$s_y = $orig_h - $crop_h;
    	}
    }
    Plugin Author Stanislav Khromov

    (@khromov)

    The crop changes have been merged in version 1.1 of the plugin that was just pushed. Let me know if it causes any issues and big thanks to @jackrugile for the patch.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Upscale crop position?’ is closed to new replies.