<p>You can catch the <code>EVENT_GET_ASSET_THUMB_URL</code> event in your plugin and return the <code>$event-&gt;url</code>:</p>

<pre><code>   Event::on(Assets::class, Assets::EVENT_GET_ASSET_THUMB_URL, function(GetAssetThumbUrlEvent $event) {
            $event-&gt;url = $this-&gt;thumbUrl($event);
        });

   protected function thumbUrl($event)
      {
           return "{$this-&gt;cloudinary_ulr}/image/upload/w_{$event-&gt;width},h_{$event-&gt;height}/{$event-&gt;asset-&gt;filename}";
      }
</code></pre>

CC BY-SA 3.0
2018-04-10T00:29:12.643Z
2018-04-10T00:29:12.643Z
flamisz
<p>I realized Craft 3 generates its own thumbnails and does not use Cloudinary to do this on the CP. My question is, how and where should I modify the JavaScript code, or what is the best practice to use external generator.</p>

<p>What I would like to do is really just utilize the query string of Cloudinary instead of doing this on Craft side...?</p>

<p>So somehow I would like to overwrite this call, and change it:</p>

<pre><code>SITE/cpresources/4c875891/thumb-30x30.jpg?v=1522966431
</code></pre>

<p>And I also would like to avoid the generate thumbnail:</p>

<pre><code>http://tr3nds.test/index.php?p=admin/actions/assets/generate-thumb&amp;uid=7b78d4ed-9c3d-4193-89c0-f20e0d3c35be&amp;width=30&amp;height=30&amp;v=1523244927
</code></pre>

CC BY-SA 3.0
2018-04-12T18:54:29.197Z
FWIW, it's something that's on my "to do" list to write a Cloudinary driver for ImageOptimize: https://github.com/nystudio107/craft-imageoptimize/issues/10 -- if interested, voice your support in the thread. Then you'd be able to just choose "Cloudinary" as your transform method, and it'd "just work" everywhere, like it does not with Imgix.
andrew.welch
CC BY-SA 3.0
2018-04-14T17:30:59.073Z
If you want to use ImageOptimize with Cloudinary, install the [Cloudinary](https://github.com/timkelty/craft3-cloudinary) plugin that will make Cloudinary available as a file system for Craft CMS 3.
andrew.welch
<filesystem>
Cloudinary thumbnail creation for assets
# Cloudinary thumbnail creation for assets

(Asked by: username_0 on 2018-04-09)

I realized Craft 3 generates its own thumbnails and does not use Cloudinary to do this on the CP. My question is, how and where should I modify the JavaScript code, or what is the best practice to use external generator.
What I would like to do is really just utilize the query string of Cloudinary instead of doing this on Craft side...?
So somehow I would like to overwrite this call, and change it:
SITE/cpresources/4c875891/thumb-30x30.jpg?v=1522966431

And I also would like to avoid the generate thumbnail:
http://tr3nds.test/index.php?p=admin/actions/assets/generate-thumb&uid=7b78d4ed-9c3d-4193-89c0-f20e0d3c35be&width=30&height=30&v=1523244927

**Tags:** filesystem
> **Comments:**
> **username_1**: FWIW, it's something that's on my "to do" list to write a Cloudinary driver for ImageOptimize: https://github.com/nystudio107/craft-imageoptimize/issues/10 -- if interested, voice your support in the thread. Then you'd be able to just choose "Cloudinary" as your transform method, and it'd "just work" everywhere, like it does not with Imgix.  
> **username_1**: If you want to use ImageOptimize with Cloudinary, install the [Cloudinary](https://github.com/timkelty/craft3-cloudinary) plugin that will make Cloudinary available as a file system for Craft CMS 3.  

---

## 1 answers

### Answer by username_2 on 2018-04-10. Score: 2 | Accepted answer

You can catch the EVENT_GET_ASSET_THUMB_URL event in your plugin and return the $event->url:
   Event::on(Assets::class, Assets::EVENT_GET_ASSET_THUMB_URL, function(GetAssetThumbUrlEvent $event) {
            $event->url = $this->thumbUrl($event);
        });

   protected function thumbUrl($event)
      {
           return "{$this->cloudinary_ulr}/image/upload/w_{$event->width},h_{$event->height}/{$event->asset->filename}";
      }


---

