Skip to content

896904: Added topic for load images in webp format #4641

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jul 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions blazor-toc.html
Original file line number Diff line number Diff line change
Expand Up @@ -1049,6 +1049,13 @@
<li><a href="/blazor/carousel/navigators-and-indicators">Navigators and Indicators</a></li>
<li><a href="/blazor/carousel/accessibility">Accessibility</a></li>
<li><a href="/blazor/carousel/styles-and-appearance">Styles and Appearances</a></li>
<li>How To
<ul>
<li>
<a href="/blazor/carousel/how-to/load-images-in-webp-format">Load images in webp format</a>
</li>
</ul>
</li>
<li><a href="/cr/blazor/Syncfusion.Blazor.Navigations.SfCarousel.html">API Reference</a></li>
</ul>
</li>
Expand Down
62 changes: 62 additions & 0 deletions blazor/carousel/how-to/load-images-in-webp-format.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
---
layout: post
title: Load webp format image with Blazor Carousel Component | Syncfusion
description: Checkout and learn about how to load webp format image with Blazor Carousel component in Blazor Server App and Blazor WebAssembly App.
platform: Blazor
control: Carousel
documentation: ug
---

# Load webp format image with Blazor Carousel Component

You can load the carousel image in the webp format, which aims to create smaller, better-looking images. Choosing webp as your image format can significantly improve your website's performance without sacrificing visual quality. webp images are significantly smaller in file size compared to formats like JPEG and PNG. This results in faster load times and less data usage. To achieve this, you can convert your image format to webp and pass them to Carousel items. The following sample illustrates how to load a carousel image in the webp format component.

```cshtml
@using Syncfusion.Blazor.Navigations

<div class="control-container">
<SfCarousel SwipeMode="CarouselSwipeMode.Mouse & CarouselSwipeMode.Touch">
<CarouselItem>
<figure class="img-container">
<img src="https://www.gstatic.com/webp/gallery/1.webp" alt="Majestic Valley View" style="height:100%;width:100%;" />
<figcaption class="img-caption">Majestic Valley View</figcaption>
</figure>
</CarouselItem>
<CarouselItem>
<figure class="img-container">
<img src="https://www.gstatic.com/webp/gallery/2.webp" alt="Thrilling Rapids Adventure" style="height:100%;width:100%;" />
<figcaption class="img-caption">Thrilling Rapids Adventure</figcaption>
</figure>
</CarouselItem>
<CarouselItem>
<figure class="img-container">
<img src="https://www.gstatic.com/webp/gallery/3.webp" alt="Snowy Stroll" style="height:100%;width:100%;" />
<figcaption class="img-caption">Snowy Stroll</figcaption>
</figure>
</CarouselItem>
</SfCarousel>
</div>

<style>
.control-container {
height: 300px;
margin: 0 auto;
width: 500px;
}

.img-container {
height: 100%;
margin: 0;
}

.img-caption {
color: #fff;
font-size: 1rem;
position: absolute;
bottom: 3rem;
width: 100%;
text-align: center;
}

</style>
```