PHP SDK: JPEG XL delivery format

Options
CodeMonkeys
CodeMonkeys Member Posts: 2

Hi,

Are there plans to add JPEG XL as a delivery format with the PHP SDK and any timeline on that if there are?

Unless it already is, although attempts to use 'jxl' are just throwing errors and I can't see anything JPEG XL like in ImageFormatInterface.php

Comments

  • DannyFromCloudinary
    DannyFromCloudinary Member, Cloudinary Staff Posts: 108
    Options

    Hey @CodeMonkeys . Thanks for getting in touch.

    You should be able to specify any format you like, including any we add in the future, by specifying the format with ->format().

    For instance, running the following code gives me <img src="https://res.cloudinary.com/dannyv/image/upload/f_jxl/sample.jpg?_a=BAAASyDQ">

    <?php
    
    
    require_once __DIR__ . '/vendor/autoload.php';
    use Cloudinary\Cloudinary;
    use Cloudinary\Tag\ImageTag;
    
    
    // Set up your Cloudinary credentials
    $cloudinary = new Cloudinary([
        "cloud" => [
            "cloud_name" => "dannyv",
            "api_key" => "###############",
            "api_secret" => "XXXXXXXXXXXXXXXXXXXXXXXXXXX"
        ]
    ]);
    echo (new ImageTag('sample.jpg'))->format("jxl");
    

    Alternatively, if you're talking about adding Jpeg XL support to the list of formats available in f_auto, this is something we can do upon confirming your cloud name and the last four characters of your API secret. If you'd like to proceed with that, I would recommend raising a support ticket with us directly via support.cloudinary.com

    I hope this helps!

    Thanks,

    -Danny

  • CodeMonkeys
    CodeMonkeys Member Posts: 2
    edited January 18
    Options

    Thanks, @DannyFromCloudinary , that's perfect.

    I was trying to do it this way, based on the transformation builder's example PHP for other formats previously:

    ->delivery(Delivery::format(Format::jxl()))

    but going by your example and changing it to:

    ->delivery(Delivery::format('jxl'))

    it works a treat.

    Makes a whole lot of sense (now I know the answer)!

  • DannyFromCloudinary
    DannyFromCloudinary Member, Cloudinary Staff Posts: 108
    Options

    Glad to hear it's working :)

    Please let us know if there's anything else you need

    All the best,

    -Danny