Srcset only for .jpg files

Hello,

Is it possible to set up srcset() only for .jpg files?
I want to maintain the original .gif files.

Thanks!

Yes, you can check the file mime and use srcset conditionally.

Thanks for the help!
I’m trying this, but I’m not having any results:

        <figure>
            <img
            class="fade"
            alt=""
            src="<?= $file->url() ?>"
            <?php if ($file->mime('jpg')): ?>

              srcset="<?= $file->srcset([ 600, 900, 1200]) ?>"
   <?php endif ?>
    />
</figure>

You cannot pass jpg as an argument.

<?php if ($file->mime() === 'image/jpeg'): ?>

Thank you
Works perfectly!