Cloudinary Blog

New Svelte Framework SDK for Cloudinary

New Svelte Framework SDK for Cloudinary

Back in April, Cloudinary made available on npm an alpha version of its components library for Svelte, a release that’s a wonderful addition to Cloudinary’s suite of client-side SDKs: React, Vue, and Angular. Those three front-end SDKs offer simple yet comprehensive optimization, transformation, and delivery capabilities for images and videos—features that you can tailor to automatically apply the best-fitting formats for all devices and browsers.

The Svelte SDK offers all those capabilities to Svelte developers through two robust components, Images and Videos.

Note
For details on Cloudinary’s next-generation developer SDKs, see this recent post.

The Image Component

With the Image component, you can display and transform images stored on Cloudinary, for example, by having Cloudinary generate an HTML <img> element whose source has been cropped as a circle and centered on someone’s face (see the photo below).

If you do not specify any image format, Cloudinary automatically applies the most suitable one for the browser. Here’s a code example:

Copy to clipboard
<Image
      cloud_name="demo"
      public_id="woman"
      transformation="{{
 width: 400,
 height: 400,
 gravity: 'face',
 radius: 'max',
 crop: 'crop' 
    }}"
/>

The generated HTML <img> element looks like this:

The Video Component

Similarly, the Video component enables you to display and transform videos stored on Cloudinary. For example, in automatically adding a poster image for a video, the Video component generates an HTML <video> element for a source that has been rotated by 20 degrees. If you don’t specify a video format, the component automatically adds fallback sources, as in this example:

Here’s the generated HTML <video> element:

Copy to clipboard
     <video
       controls="true"
       muted="true"
       poster="http://res.cloudinary.com/demo/video/upload/a_20/dog.jpg"
     >
       <source
         src="http://res.cloudinary.com/demo/video/upload/a_20/dog.webm"
         type="video/webm"
       />
       <source
         src="http://res.cloudinary.com/demo/video/upload/a_20/dog.mp4"
         type="video/mp4"
       />
       <source
         src="http://res.cloudinary.com/demo/video/upload/a_20/dog.ogv"
         type="video/ogg"
       />
     </video>

Upcoming Enhancements

Keep in mind that, even though the Svelte SDK components are fully functional, this is an alpha version only. That’s because our roadmap for the future encompasses major improvements to our core JavaScript library, which will affect all the client SDKs that rely on that library.

Here are the main upcoming enhancements:

  • A lighter modular bundle for importing used modules only.
  • New actions-based transformation capabilities for defining media transformations in a simpler manner.
  • An advanced Image component with built-in lazy loading and placeholder capabilities along with support for accessibility.

If you’re new to Cloudinary, to get started, just sign up for a free account, and do check out the new Svelte SDK on npm and its code repository on GitHub.

Recent Blog Posts

Our $2B Valuation

By
Blackstone Growth Invests in Cloudinary

When we started our journey in 2012, we were looking to improve our lives as developers by making it easier for us to handle the arduous tasks of handling images and videos in our code. That initial line of developer code has evolved into a full suite of media experience solutions driven by a mission that gradually revealed itself over the course of the past 10 years: help companies unleash the full potential of their media to create the most engaging visual experiences.

Read more
Direct-to-Consumer E-Commerce Requires Compelling Visual Experiences

When brands like you adopt a direct–to-consumer (DTC) e-commerce approach with no involvement of retailers or marketplaces, you gain direct and timely insight into evolving shopping behaviors. Accordingly, you can accommodate shoppers’ preferences by continually adjusting your product offering and interspersing the shopping journey with moments of excitement and intrigue. Opportunities abound for you to cultivate engaging customer relationships.

Read more
Automatically Translating Videos for an International Audience

No matter your business focus—public service, B2B integration, recruitment—multimedia, in particular video, is remarkably effective in communicating with the audience. Before, making video accessible to diverse viewers involved tasks galore, such as eliciting the service of production studios to manually dub, transcribe, and add subtitles. Those operations were costly and slow, especially for globally destined content.

Read more
Cloudinary Helps Minted Manage Its Image-Generation Pipeline at Scale

Shoppers return time and again to Minted’s global online community of independent artists and designers because they know they can count on unique, statement-making products of the highest quality there. Concurrently, the visual imagery on Minted.com must do justice to the designs into which the creators have poured their hearts and souls. For Minted’s VP of Engineering David Lien, “Because we are a premium brand, we need to ensure that every single one of our product images matches the selected configuration exactly. For example, if you pick an 18x24 art print on blue canvas, we will show that exact combination on the hero images in the PDF.”

Read more
Highlights on ImageCon 2021 and a Preview of ImageCon 2022

New year, same trend! Visual media will continue to play a monumental role in driving online conversions. To keep up with visual-experience trends and best practices, Cloudinary holds an annual conference called ImageCon, a one-of-a-kind event that helps attendees create the most engaging visual experiences possible.

Read more