Answers.Body: <p>There's actually a really easy way to achieve this (Craft 3 only).</p>
  
  <p>Simply do this in your code:</p>
  
  <pre><code>&lt;img src="{{ image.thumbUrl(int) }}"&gt;
  
  {# int is a number that represents the width/height #}
  </code></pre>
  
  <p>The asset thumbnails are stored in <code>/storage/runtime/assets/thumbs/</code>, so no, they won't be taking up space in your S3 bucket (whereas some local testing inclines me to think that images generated via transforms are stored in your Asset Volume, wherever it's located).</p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2018-03-19T19:36:50.200Z
Answers.Text: would you mind to explain why this should only work for Craft 3?
Answers.UserDisplayName: Robin Schambach
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2018-03-20T14:52:34.847Z
Answers.Text: @RobinSchambach yeah definitely - it seems from digging around in the Craft source code that `thumbUrl` got a bit of an upgrade in Craft 3. In Craft 2, it seems from some local testing that `thumbUrl` just tries to use thumbnail images from `/storage/runtime/assets/thumbs/` if they already exist - which means that if someone were to clear the `/storage` directory (which could happen on deployment for example), Craft 2 will all of a sudden start showing broken image icons. In Craft 3, it seems that `thumbUrl` actually generates the thumbnails for you if they don't exist.
Answers.UserDisplayName: Jalen Davenport
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2018-03-20T14:54:34.453Z
Answers.Text: I'm not 100% certain that it doesn't work on Craft 2 (could always be some weirdness or mis-config on my end), so for now I'll leave that as a comment (vs. updating my answer), unless someone else can verify that the behavior I described is indeed the norm.
Answers.UserDisplayName: Jalen Davenport
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2018-03-20T19:23:54.943Z
Answers.Text: Amazing thanks. yeah I'm using Craft 3
Answers.UserDisplayName: Jai Sandhu
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2018-03-19T19:19:22.867Z
Answers.LastActivityDate: 2018-03-19T19:19:22.867Z
Answers.UserDisplayName: Jalen Davenport
Body: <p>My frontend template displays the assets that have been uploaded to Craft. I could create a series of asset transforms within that template to create a range of thumbnail sizes. </p>
  
  <p>Not too sure about the way this works but am I correct in thinking that every transform generates a new asset, to be more efficient with storage could I not reuse the transformed assets that the Control Panel creates? </p>
  
  <p>I inspect the Assets panel in the backend and it has a url <code>http://localhost:8888/index.php?p=admin/actions/assets/generate-thumb&amp;amp;uid=219035f4-92ae-41d6-ad95-0f6a4c38faa9&amp;amp;width=30&amp;amp;height=30&amp;amp;v=1521142167</code> I could pass the UID of the image to that url or may be instead match the sizes the CP creates would this reuse the same images instead of adding to my S3 storage?</p>
  
Tags: <control-panel><image-transforms>
Title: Get control panel asset thumbnails into a frontend template
ThreadText: # Get control panel asset thumbnails into a frontend template
  
  (Asked by: username_0 on 2018-03-19)
  
  My frontend template displays the assets that have been uploaded to Craft. I could create a series of asset transforms within that template to create a range of thumbnail sizes.
  
  Not too sure about the way this works but am I correct in thinking that every transform generates a new asset, to be more efficient with storage could I not reuse the transformed assets that the Control Panel creates?
  
  I inspect the Assets panel in the backend and it has a url `http://localhost:8888/index.php?p=admin/actions/assets/generate-thumb&amp;uid=219035f4-92ae-41d6-ad95-0f6a4c38faa9&amp;width=30&amp;height=30&amp;v=1521142167` I could pass the UID of the image to that url or may be instead match the sizes the CP creates would this reuse the same images instead of adding to my S3 storage?
  
  **Tags:** control-panel, image-transforms
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2018-03-19. Score: 2 | Accepted answer
  
  There's actually a really easy way to achieve this (Craft 3 only).
  
  Simply do this in your code:
  
  ```
  <img src="{{ image.thumbUrl(int) }}">
  
  {# int is a number that represents the width/height #}
  
  ```
  
  The asset thumbnails are stored in `/storage/runtime/assets/thumbs/`, so no, they won't be taking up space in your S3 bucket (whereas some local testing inclines me to think that images generated via transforms are stored in your Asset Volume, wherever it's located).
  
  > **Comments:**
  > **username_2**: would you mind to explain why this should only work for Craft 3?  
  > **username_1**: @username_2 yeah definitely - it seems from digging around in the Craft source code that `thumbUrl` got a bit of an upgrade in Craft 3. In Craft 2, it seems from some local testing that `thumbUrl` just tries to use thumbnail images from `/storage/runtime/assets/thumbs/` if they already exist - which means that if someone were to clear the `/storage` directory (which could happen on deployment for example), Craft 2 will all of a sudden start showing broken image icons. In Craft 3, it seems that `thumbUrl` actually generates the thumbnails for you if they don't exist.  
  > **username_1**: I'm not 100% certain that it doesn't work on Craft 2 (could always be some weirdness or mis-config on my end), so for now I'll leave that as a comment (vs. updating my answer), unless someone else can verify that the behavior I described is indeed the norm.  
  > **username_0**: Amazing thanks. yeah I'm using Craft 3  
  
  ---
  
  