Skip to main content

How to upload webP image format using cloudinary IOS sdk ?

Comments

3 comments

  • Aditi Madan

    Hi,

    Here is an example of how to upload a webp in IOS:

    let request = cloudinary.createUploader().upload(
    url: URL(fileURLWithPath:"<path to the webp image>.webp"), uploadPreset: "<your preset>",params: params as! CLDUploadRequestParams)
    .response( { response, error in
    print(error);
    } )

    Regards,

    Aditi

    0
  • Explurger App

    Hi,

    Thanks for reply. Is there any way to convert jpeg image into webP during the process of uploading image to cloudinary server ?

    CLDPreprocessHelpers.customImageEncoder(format: EncodingFormat.PNG) -> This function doesn't accept webP as a value.

    Regards,

    Explurger Team

    0
  • Shirly Manor

    Hi,

     

    Our best practice will be to upload the image as is and generate the transformation eagerly. For example:

    let trans = CLDEagerTransformation().setFormat("webp");

    let params = CLDUploadRequestParams().setPublicId("mynewVideo").setEagerAsync(true).setEager([trans]).setResourceType(CLDUrlResourceType.image);

    let
    request = cloudinary.createUploader().signedUploadLarge(url: URL(fileURLWithPath:"/XXXX/dog.webp"), params: params as! CLDUploadRequestParams).response({ response, error in print(response,error);})

     

    However, If you want to upload the file just as `webp` and not have it in jpg anywhere (not our best practice). You can set a default upload preset and set the format to webp.

    Can you please elaborate on why you want to change the format before the upload and not change the format later by using our on-the-fly or eager transformation?

    Also note that webp is not supported in the old versions of the ios.

    0

Post is closed for comments.