Welcome to the Question2Answer Q&A. There's also a demo if you just want to try it out.
+2 votes
444 views
in Q2A Core by
Hello everybody. Is it possible to add watermark to the uploaded images? I tried to make it myself, but without any result.

I wrote thiscode and added it to qa-util.image.php:

                            //watermark add-on
                            $watermarkfile = 'watermark.png';
                            $watermark = imagecreatefrompng($watermarkfile);
                            // width and height of the watermark
                            $x2 = imagesx($watermark);
                            $y2 = imagesy($watermark);
                            $wmwidth = $width - $x2 - 10;
                            $wmheight = $height - $y2 - 10;
                            imageSaveAlpha($watermark, true);
                            imagecopyresampled($image, $watermark, $wmwidth, $wmheight, 0, 0, $width, $height, $x2, $y2);
Q2A version: 1.6
by
Did you find a way or solution?

1 Answer

+1 vote
by
edited by

Reference:

http://www.php.net/manual/en/image.examples-watermark.php

Method to get image data:

$blobid = "Set your blob id of image";
if(function_exists('qa_read_blob'))
  $blob = qa_read_blob($blobid);
else
  $blob = qa_db_blob_read($blobid);
$imagedata = imagecreatefromstring($blob['content']);
by
Thanks, I know this examples, but I can't understand where we recieving image file.
I want to know where we can get image file (not BLOB) and modify it.
by
I edited answer. Ask a question a little more exactly.
...