Skip to main content

Nested Transformations in Node

Comments

3 comments

  • 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:

    console.log(
    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?

    1
  • 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.

    0
  • 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:
    https://cloudinary.com/documentation/image_transformations#chained_transformations

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

     

    0

Post is closed for comments.