Nested Transformations in Node



  • Avatar
    Aleksandar Kostadinov

    Hi Fidel,

    Please find below an example of how you can turn that PHP code into NodeJS so that you get back the same exact Cloudinary URL generated:

    cloudinary.url(result["public_id"], {
    resource_type: "image",
    type: 'upload',
    transformation: [
    { "width": 260, "height": 166, "crop": "scale", "angle": "auto_left" },
    { "underlay": "backborderlogokeyad", "gravity": "north_west", "x": -13, "y": -13 },
    { "overlay": result["public_id"], "gravity": "south_west", "x": 23, "y": 23, "width": 260, "height": 166, "crop": "scale", "angle": "auto" },
    { "overlay": result["public_id"], "gravity": "south_west", "x": 23, "y": 207, "width": 272, "height": 174, "crop": "scale", "angle": "auto" },
    { "overlay": result["public_id"], "gravity": "south_west", "x": 305, "y": 23, "width": 272, "height": 174, "crop": "scale", "angle": "auto" },
    { "overlay": `text:text16:${imageText}`, "gravity": "south_east", "x": 30, "y": 40, "angle": 270 }
    format: "jpg"

    Let me know if this helps?

    Comment actions Permalink
  • Avatar
    Fidel Guajardo

    Yes, thank you. That helps.
    Would you know where I can find similar examples of these nested transformations? I can't find any in the documentation.

    Comment actions Permalink
  • Avatar
    Aleksandar Kostadinov

    Hi Fidel,

    You're welcome!

    These types of transformations (nested) are called Chained Transformations and we have more details on those in the following section of the documentation:

    If you run into any issues or have any questions on this please let us know.


    Comment actions Permalink

Please sign in to leave a comment.