Use file format in conditionnal transformation (p.ex: f_svg/fl_sanitize if source is svg)

Options
ZecKa
ZecKa Member Posts: 1

Is it possible to apply a specific transformation only if the image source is a given format.

My goal is to apply special transformation if source is an svg and another transformation if file source is not an svg

if svg : /fl_sanitize/f_svg
else /w_400,h_400,c_fit/q_auto

I alreay check documentation here

https://cloudinary.com/documentation/conditional_transformations#specifying_conditions

Answers

  • Tom
    Tom Member, Cloudinary Staff Posts: 78
    Options

    Hi @ZecKa ,

    Thanks for reaching out.

    So there is no field in conditional transformations that can check an image's format currently.

    You could assign an image with an svg tag/contextual metadata/structured metadata during upload and use an if statement based on one of those characteristics as per Supported image characteristics.

    However do note, format is not a supported conditional image transformation parameter as per Supported conditional image transformation parameters and flags.

    Please let me know if you have any questions.

    Kind Regards,

    Thomas