cloudinary_angular icon indicating copy to clipboard operation
cloudinary_angular copied to clipboard

Ability Skip SVG

Open chris480 opened this issue 4 years ago • 5 comments

Explain your use case

SVGs still get transformed and converted to some close format

Describe the problem you’re trying to solve

Have the ability to cleanly and easily skip transformation of svgs if an file format is svg

Do you have a proposed solution?

A new config at at?

chris480 avatar Mar 04 '21 22:03 chris480

@chris480 Can you provide more details on your workflow and what is happening and what you would like to happen?

aksjoshi1 avatar Mar 06 '21 20:03 aksjoshi1

@aksjoshi1 I have user generated content, and most of the time it's just jpgs or pngs. On occasion an svg is uploaded. Because I'm using transforms on the uploaded content, cloudinary will convert the svg to either jpg/png.

Ideally cloudinary could skip transforms of svgs without having write additional UI logic to determine if the image ID contains .svg

chris480 avatar Mar 07 '21 01:03 chris480

@chris480 If you're using upload presets in order to transform the images on upload, you can add local logic that checks the file's format, and chooses a different preset for SVG uploads (if you're using our upload widget you can do that with the help of the preBatch parameter (in order to check the file format) and the prepare parameter (in order to update the preset) - you can see an example here. Additional details regarding these parameters can be found here.

eyalktCloudinary avatar Mar 07 '21 16:03 eyalktCloudinary

@eyalktCloudinary For my current use case the images are uploaded as-is. The ID is then stored in a db for later ref. I then pass the id to the cloudinary angular component

eg.

    <cl-image public-id="id_name">
      <cl-transformation [attr.gravity]="'auto'" width="100" fetch_format="auto">
      </cl-transformation>
    </cl-image>

The rendered asset is a rasterized version of the SVG.

chris480 avatar Mar 09 '21 02:03 chris480

@chris480 Thanks for the additional details. We have an internal task for adding the option to retain SVG format when using f_auto (fetch_format="auto"). I'll update this thread about any progress made. In addition, if you are on an enterprise plan, our Solutions team can fix this for your account - In that case, please open a support ticket.

eyalktCloudinary avatar Mar 09 '21 15:03 eyalktCloudinary