notJJ  
                
                  
                    July 30, 2020,  2:45pm
                   
                  1 
               
             
            
              Hi!
I generally use .webp images in my web-projects and take .jpg as fallback.
It would be a great feature if you could request an image in a specific format eg.
fetch('/api/cockpit/image?token=xxtokenxx', {
    method: 'post',
    headers: { 'Content-Type': 'application/json' },
    body: JSON.stringify({
        src: imagePath || asset._id,
        t: webp
    })
})
Maybe even in multiple formats:
fetch('/api/cockpit/image?token=xxtokenxx', {
    method: 'post',
    headers: { 'Content-Type': 'application/json' },
    body: JSON.stringify({
        src: imagePath || asset._id,
        t: [webp, jpg]
    })
})
Greetings
             
            
              
            
           
          
            
            
              You can already convert it on the API call (at least worked for me). All you have to do is pass âmime=image/webpâ as a parameter for the API call.
So it would like this (with the encoded URI):
fetch(â/api/cockpit/image?token=xxtokenxx&src=yourImagePath.png&mime=image/webpâ, {
             
            
              1 Like 
            
            
           
          
            
              
                abernh  
              
                  
                    July 16, 2021,  7:30am
                   
                  3 
               
             
            
              This CMS just keeps giving and giving.
Just keep in mind : unless your code runs server-side releasing the token like that into the wild makes /api/cockpit/image a public endpoint.custom key for that token with only access to the image-api-endpoint.
Turns out you can also directly use the image path inline.
  
  
    Why donât you want to use it? what is wrong with this approach: 
<img src="/api/cockpit/image?token=xxtokenxx&src=path&w=200&h=200&o=1">
   
 
<img src="/api/cockpit/image?token=xxtokenxx&src=yourImagePath.png&mime=image/webp&o=1">