Is it possible to create a temp file server side for viewing an image?
I've some images & they're displayed from server but I want to have them watermarked... Found out about the Imagick Class, used composite... It can be viewed when sent as header but I need it somehow visible for the tag.
I don't want to uses 'write image' & create a new image from the composited image. I'm trying to use it as client Side thing (I'm not familiar with JS... Yes, I'll look into it but need an alternative till then).
Another alternative that I'm aware of is I should control that WHILE uploading the images but I've already uploaded quite a few so... Any help appreciated!
Have you tried using the function that generates your image as a src
attribute for the <img />
tag?
I don't know exactly how your code is, but I am thinking the end result could be something like:
<img src="data:image/jpeg;base64,<?php echo base64_encode($image_headers); ?>">
You basically output the headers inside the image src
as a base64 encoded string.
What you should keep in mind is that you should adjust the image/jpeg
type to the corresponding type of your image.
For example:
image/jpeg
image/png
image/webp
And of course the encoded string should be an image of the corresponding format.