Jump to:

7939 Posts in 1472 Topics by 944 members

DataObjectManager Module

SilverStripe Forums » DataObjectManager Module » My challenge: combine two images into one. Advice appreciated!

Discuss the DataObjectManager module, and the related ImageGallery module.

Moderators: martimiz, UncleCheese, Sean, biapar, Willr, Ingo, swaiba, simon_w

Page: 1
Go to End
Author Topic: 765 Views
  • Wilson
    Avatar
    Community Member
    63 Posts

    My challenge: combine two images into one. Advice appreciated! Link to this post

    Hi everyone,

    My client would like to be able to upload two images and have them combined into one. For example, two individual magazine pages combined into one spread.

    I have all of the PHP written to do this, and would very much appreciate any advice on how/where to incorporate this into DOM/Uploadify workflow, of course, without touching the core of either.

    I'm planning that there will be three db fields, 'image1', 'image2' and 'combinedImage' (something along these lines), so image1 and image2 are never destroyed. Then 'onSave', combine them into one image and save into the 'combinedImage' field.

    Thanks in advance for your time.

    Best,
    Wilson

  • banal
    Avatar
    Community Member
    901 Posts

    Re: My challenge: combine two images into one. Advice appreciated! Link to this post

    I don't know where your two source images are coming from (are they part of the same DataObject)? A good place to do things like this would be in the onAfterWrite method of your DataObject.
    To avoid rendering of the image every time you save the DataObject, you could compose the name of the image from the two IDs of the source images (eg. composite_idA_idB.jpg) and check if such a file already exists. If the file exists, you're done, otherwise the composite image doesn't exist yet and can be created.

  • Wilson
    Avatar
    Community Member
    63 Posts

    Re: My challenge: combine two images into one. Advice appreciated! Link to this post

    Thanks banal! Yes, both images are part of the same DataObject. That sounds like a good plan. Much appreciated.

    765 Views
Page: 1
Go to Top

Want to know more about the company that brought you SilverStripe? Then check out SilverStripe.com

Comments on this website? Please give feedback.