Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at

  • Mark Mitchell 35 posts 60 karma points
    Jan 30, 2014 @ 01:50
    Mark Mitchell

    Chaining multiple ImageGen tasks

    I would like to chain multiple ImageGen operations to automate the building of more complex images.

    For example, I have a png likie this one: ; that provides the frame of a tablet, a desktop, and a smartphone. I would like to have 3 image pickers in my content node, where the content editor can select three image to overlay into the devices.  I then want ImageGen to resize / crop the first selected image and overlay it into the proper position for the desktop, then do the same for the smartphone version, and likewise for the tablet version.

    I know I can simplify the parameters needed with classes, but I obviously can't specify the acutal images in the class since they will be variable for each node. Is it feasible to URL escape multiple calls to ImageGen inside the parameters of other ImageGen calls?  I know this would be a lot of processing, but hopefully with client and server side caching the actual work will be reduced.

    My current thinking:

    Save a URL encoded string of the 3 selected images being scaled properly by ImageGen.
    Pass them into another call to ImageGen as the parameters for OverLayImage.

    Is it possible to overlay more than one image in a single call, or will that need to be chained as well? Has anyone attempted anythign like this before?


  • Douglas Robar 3570 posts 4711 karma points MVP ∞ admin c-trib
    Jan 30, 2014 @ 08:33
    Douglas Robar

    Hi, Mark,

    What you're attempting is beyond what ImageGen and automated image processors are designed to achieve. For complex situations like this photoshop or similar with a human editor is more likely the better tool.

    Having said that, if you want to give it a go you'll need to url-encode subsequent imagegen.ashx requests that appear as part of the ?image= parameter of the first request in the querystring if there is more than one parameter passed in to the subsequent imagegen.ashx requests. Check this thread for some important information about calling imagegen from within imagegen:

    The performance of this approach isn't nearly as quick as direct calls to the filesystem (because of latency in http requests) and I wouldn't recommend it.

    Also, there isn't the level of precision for overlay images to specify exact coordinates, having only an overlay margin to help your positioning which may not be adequate.

    What I'd recommend instead is to use ImageGen to make 3 requests to resize each of the selected images and then use css (or even old-school tables) to position the images in the correct place on top of or underneath a (transparent?) image of the the devices.


  • Mark Mitchell 35 posts 60 karma points
    Jan 30, 2014 @ 08:38
    Mark Mitchell

    Thanks for the info!  I will have a go at it, and if it becomes too much of an issue to implement, we will just fall back on using manually built images.  

Please Sign in or register to post replies

Write your reply to: