• Resolved Peter Raschendorfer

    (@petersplugins)


    Thanks for this great plugin. It’s exactly what I need – with a little exception.

    Would you please add an option to ignore width and height of the original image tag and always get the original image? I think this would be a useful extension not only for my needs and after taking a look at your code and doing a quick and dirty test I’m sure the effort would be very low.

    Regards,
    Peter

Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Author Junaid Bhura

    (@junaidbhura)

    Hey @petersplugins

    Glad you find this plugin useful! ??

    I’m not sure I fully understand what you mean. Could you please share an example?

    Thread Starter Peter Raschendorfer

    (@petersplugins)

    Sure @junaidbhura

    I’ve quickly put together an example. This is not an working example, the code is untested. It’s just to show what I mean.

    Modified plugins option page: https://ibb.co/dEdtRc.

    New option in setup() in class-core.php:
    $this->_options['ignore_transformations'] = get_option( 'cloudinary_ignore_transformations' );

    Modified line 93 in class-core.php:
    if ( ! ( ( 'the_content' == current_filter() || 'image_downsize' == current_filter() || 'wp_calculate_image_srcset' == current_filter() ) && '1' == $this->_options['ignore_transformations'] ) && ! empty( $args['transform'] ) )

    Expected result: no transformations are added to the Cloudinary URL in case of automatically generated URLs. Instead of using current_filter() it would be a better and safer solution to add something like $this->_is_auto = true;.

    Hope this understandable…

    Regards,
    Peter

    Plugin Author Junaid Bhura

    (@junaidbhura)

    @petersplugins If I understand this correctly, you just want the full sized images which are added to the WordPress editor in the WP Admin, to not have width and height in the Cloudinary URL?

    If that’s the case, I’m not sure this would be a good idea to add to plugin at this point. The good news is this plugin lets you extend it very easily. You can use the filter cloudinary_args: https://github.com/junaidbhura/auto-cloudinary/wiki/Filters#cloudinary_args

    add_filter( 'cloudinary_args', function( $args ) {
    	if ( $something ) { // Your condition to remove width and height.
    		unset( $args['transform']['width'] );
    		unset( $args['transform']['height'] );
    	}
    	return $args;
    } );
    Thread Starter Peter Raschendorfer

    (@petersplugins)

    Thanks for your feedback.

    I’ve seen that it’s possible to use that filter. But I thought that it would be a useful enhancement of your plugin tho have this as an option, because most WordPress users have no programming skills.

    Plugin Author Junaid Bhura

    (@junaidbhura)

    I really appreciate your feedback! ??

    I think most people won’t have a problem with the width and height being in the URL, since it doesn’t really affect anything. That way the plugin can be as light as possible, with very little configuration.

    For folks who want to customize the arguments, the filters are available. I’ll keep an eye out for more requests similar to yours, and if it’s something that a lot of people want, I can update the plugin!

    Thanks again for bringing this up! You can feel free to raise further issues directly on Github, since it will be easier to discuss code there: https://github.com/junaidbhura/auto-cloudinary/issues

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Add option to ignore size’ is closed to new replies.