aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--fonts/LiberationSerif-Regular.ttfbin0 -> 172964 bytes
-rw-r--r--fonts/License.txt13
-rw-r--r--lib/watermark.php30
3 files changed, 30 insertions, 13 deletions
diff --git a/fonts/LiberationSerif-Regular.ttf b/fonts/LiberationSerif-Regular.ttf
new file mode 100644
index 000000000..1dd4aaa92
--- /dev/null
+++ b/fonts/LiberationSerif-Regular.ttf
Binary files differ
diff --git a/fonts/License.txt b/fonts/License.txt
new file mode 100644
index 000000000..e972b52de
--- /dev/null
+++ b/fonts/License.txt
@@ -0,0 +1,13 @@
+LICENSE AGREEMENT AND LIMITED PRODUCT WARRANTY
+LIBERATION FONT SOFTWARE
+
+This agreement governs the use of the Software and any updates to the Software, regardless of the delivery mechanism. Subject to the following terms, Red Hat, Inc. ("Red Hat") grants to the user ("Client") a license to this work pursuant to the GNU General Public License v.2 with the exceptions set forth below and such other terms as our set forth in this End User License Agreement.
+
+ 1.The Software and License Exception. LIBERATION font software (the "Software") consists of TrueType-OpenType formatted font software for rendering LIBERATION typefaces in sans serif, serif, and monospaced character styles. You are licensed to use, modify, copy, and distribute the Software pursuant to the GNU General Public License v.2 with the following exceptions:
+(a)As a special exception, if you create a document which uses this font, and embed this font or unaltered portions of this font into the document, this font does not by itself cause the resulting document to be covered by the GNU General Public License. This exception does not however invalidate any other reasons why the document might be covered by the GNU General Public License. If you modify this font, you may extend this exception to your version of the font, but you are not obligated to do so. If you do not wish to do so, delete this exception statement from your version.
+(b)As a further exception, any distribution of the object code of the Software in a physical product must provide you the right to access and modify the source code for the Software and to reinstall that modified version of the Software in object code form on the same physical product on which you received it.
+ 2.Intellectual Property Rights. The Software and each of its components, including the source code, documentation, appearance, structure and organization are owned by Red Hat and others and are protected under copyright and other laws. Title to the Software and any component, or to any copy, modification, or merged portion shall remain with the aforementioned, subject to the applicable license. The "LIBERATION" trademark is a trademark of Red Hat, Inc. in the U.S. and other countries. This agreement does not permit Client to distribute modified versions of the Software using Red Hat's trademarks. If Client makes a redistribution of a modified version of the Software, then Client must modify the files names to remove any reference to the Red Hat trademarks and must not use the Red Hat trademarks in any way to reference or promote the modified Software.
+ 3.Limited Warranty. To the maximum extent permitted under applicable law, the Software is provided and licensed "as is" without warranty of any kind, expressed or implied, including the implied warranties of merchantability, non-infringement or fitness for a particular purpose. Red Hat does not warrant that the functions contained in the Software will meet Client's requirements or that the operation of the Software will be entirely error free or appear precisely as described in the accompanying documentation.
+ 4.Limitation of Remedies and Liability. To the maximum extent permitted by applicable law, Red Hat or any Red Hat authorized dealer will not be liable to Client for any incidental or consequential damages, including lost profits or lost savings arising out of the use or inability to use the Software, even if Red Hat or such dealer has been advised of the possibility of such damages.
+ 5.General. If any provision of this agreement is held to be unenforceable, that shall not affect the enforceability of the remaining provisions. This agreement shall be governed by the laws of the State of North Carolina and of the United States, without regard to any conflict of laws provisions, except that the United Nations Convention on the International Sale of Goods shall not apply.
+Copyright © 2007 Red Hat, Inc. All rights reserved. LIBERATION is a trademark of Red Hat, Inc.
diff --git a/lib/watermark.php b/lib/watermark.php
index 13eb598a0..e28194b18 100644
--- a/lib/watermark.php
+++ b/lib/watermark.php
@@ -27,27 +27,31 @@ function tp_gd_watermark($image) {
if (!$watermark_text)
return;
-
+ global $CONFIG;
+
$owner = get_loggedin_user();
$watermark_text = tp_process_watermark_text($watermark_text, $owner);
+
+ // transparent gray
+ imagealphablending($image, true);
+ $textcolor = imagecolorallocatealpha($image, 50, 50, 50, 60);
+ // font and location
+ $font = $CONFIG->pluginspath . "tidypics/fonts/LiberationSerif-Regular.ttf";
+ $bbox = imagettfbbox(20, 0, $font, $watermark_text);
+ $text_width = $bbox[2] - $bbox[0];
+ $text_height = $bbox[1] - $bbox[7];
- $font = 5;
- $line_width = strlen($watermark_text) * imagefontwidth($font);
- $line_height = imagefontheight($font);
-
- $image_width = 600;
- $image_height = 450;
+ $image_width = imagesx($image);
+ $image_height = imagesy($image);
- // matching -gravity south -geometry +0+10
- $top = $image_height - $line_height - 10;
- $left = round(($image_width - $line_width) / 2);
+ $left = $image_width / 2 - $text_width / 2;
+ $top = $image_height - 20;
- imagealphablending($image, true);
- $textcolor = imagecolorallocatealpha($image, 50, 50, 50, 50);
- imagestring($image, $font, $left, $top, $watermark_text, $textcolor);
+ // write the text on the image
+ imagettftext($image, 20, 0, $left, $top, $textcolor, $font, $watermark_text);
}
function tp_imagick_watermark($filename) {