Image icon indicating copy to clipboard operation
Image copied to clipboard

Re-applying serialized operations

Open garygreen opened this issue 9 years ago • 2 comments

Is this possible? It seems strange to expose the serialization method as public without having a way to re-apply the serialized operations

https://github.com/Gregwar/Image/blob/master/Image.php#L367

garygreen avatar Mar 11 '15 23:03 garygreen

Hello, Maybe this method should not be public. What is your use case? Why would you like to re-apply operation?

Gregwar avatar Mar 12 '15 09:03 Gregwar

Well in my application I'm looking to store operations that need to happen to my user images on the fly (so I can keep the existing source image intact). I'm currently storing these image_operations in json form in my database like the below:

{
    "crop": {
        "x": 4,
        "y": 8,
        "x2": 800,
        "y2": 800
    },
    "rotate": -90
}

It would be nice to be able to do something like applyOperationsArray(...) then an array of operations to perform like above. So then I looked at the serialization of the operations and it's kind of similar to the above I think. What's your thoughts?

garygreen avatar Mar 12 '15 09:03 garygreen