junaidbhura / auto-cloudinary

Super simple Cloudinary auto-upload implementation for WordPress.
https://wordpress.org/plugins/auto-cloudinary/
MIT License
40 stars 9 forks source link

New cloudinary format #49

Closed Rahe closed 1 year ago

Rahe commented 1 year ago

Hello,

I do not know since when, but cloudinary changed the way it handles the medias now. For now the old urls with within the path transformations have been replaced with an unique parameter : tx. CF : https://cloudinary.com/documentation/media_optimizer_transformations#transformations_overview Before : `https://res.cloudinary.com/dhsa3ksmc/w_624,h_134,c_fit,f_auto,q_auto,g_center,dpr_auto/blognico/2015/01/logo-wordcamp-paris-2015-full.png

After : https://domain.mo.cloudinary.net/2015/01/logo-wordcamp-paris-2015-full.png?tx=w_624,h_134,c_fit,f_auto,q_auto,g_center,dpr_auto

(after link is not working since my account have not been created recently.

Maybe offering a filter or a setting to switch to it ?

junaidbhura commented 1 year ago

Hi @Rahe thanks for creating this issue.

It looks like a different API offered by Cloudinary: https://cloudinary.com/documentation/media_optimizer

Vs.

https://cloudinary.com/documentation/image_transformations

It doesn't look like it has changed the existing transformations, it has just added a new offering. I'll keep this issue open and look into this more deeply to decide how to approach it!

Rahe commented 1 year ago

Hello,

Yes, there is now 2 products :

  1. Programmable media : like the old product but without the media library, not the same interface. Only as "proxy mode" for S3, HTTP Proxy, Google storage or Web. That fits well with the plugin, but not the same url structure.
  2. Digital Asset Management : everything like the old offer, media library, editable element etc.

On mode 1 on the settings on page we cannot add mapping folder anymore. Transformation doesn't seems to be affected indeed, only the url format.

Nicolas,

Rahe commented 1 year ago

Hello again,

It seems that the account account I have access to is dedicated to this mode, but I do not know how to activate it. Nevertheless, I've managed to display the urls I wanted with :

add_filter('cloudinary_url', function ($url, $identifier, $args){
    $core =  JB\Cloudinary\Core::get_instance();
    $transformations = $core->build_transformation_slug( $args['transform'] );
    $local_path = parse_url( $identifier,PHP_URL_PATH  );

    return add_query_arg( [ 'tx' => $transformations], untrailingslashit( $core->get_domain() ).$local_path );
}, 3, 10 );

We need to enter a fake path and a fake identifier into the admin but this is working, event with filters on transformations and args.

junaidbhura commented 1 year ago

Hey @Rahe thanks, just to confirm - are you saying that you are unable to use the Auto Mapping folder, etc. from here?https://github.com/junaidbhura/auto-cloudinary/wiki/Setup

Rahe commented 1 year ago

Hello,

Yes, but this is weird I cannot create an account like this from the interface. I think we can close this, this is a edge case in my opinion.

Nicolas,