You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am trying to generate ImageMeta for a Post model, which has an image stored in S3. When this image is uploaded, I calculate their dimensions, write that information to my model, and then write the image to S3. ImageMeta only has a constructor for constructing from a public path, which I don't have.
Hello guys, thank you, I'm definitely open to a change to improve this (preferably in some way without a BC).
What you can always do in the meantime is just create a new class and extend the original ImageMeta class.
That you can make your own e.g. RemoteImageMeta:
class RemoteImageMeta extends ImageMeta
{
publicfunction__construct(string$path)
{
// Own logic to determine width and height, then set the properties defined in the parent `ImageMeta`.$this->width = $width;
$this->height = $height;
}
}
I am trying to generate
ImageMeta
for aPost
model, which has an image stored in S3. When this image is uploaded, I calculate their dimensions, write that information to my model, and then write the image to S3.ImageMeta
only has a constructor for constructing from a public path, which I don't have.I am currently working around this like this:
Which isn't optimal... Is there a different way I should be doing this? Or is a better approach not possible right now? 😬
I have some ideas for improving
ImageMeta
, but it's a breaking change. Something like this would be much more flexible I think:The text was updated successfully, but these errors were encountered: