cloudinary.url() with crop doesn't return sized image

Makaha
Makaha Member Posts: 1

const sizedUrl = cloudinary.url( file_name , { transformation: [ {width: 96, crop: "scale"}, {quality: "auto"}, {fetch_format: "auto"} ] } );

Returns the url,

http://res.cloudinary.com/XXXXXX/image/upload/v1/file_name

but the file size is just the original file size, why? Also option {secure: true} doesn't return https but http.

Answers

  • DannyFromCloudinary
    DannyFromCloudinary Member, Cloudinary Staff Posts: 151

    Hey @Makaha .

    I've just tried running the following code for my own account:

    const cloudinary = require("cloudinary").v2;
    
    cloudinary.config({ 
        secure: true
    });
    
    const file_name = "sample";
    const sizedUrl = cloudinary.url( file_name , { transformation: [ {width: 96, crop: "scale"}, {quality: "auto"}, {fetch_format: "auto"} ] } );
        
    console.log(sizedUrl);
    

    and the output of console.log is https://res.cloudinary.com/dannyv/image/upload/c_scale,w_96/q_auto/f_auto/sample

    It seems like your cloudinary.config may be missing or being overwritten somewhere. Are you able to share a larger code sample please?

    Kind regards,

    -Danny