1<?php
2/*************************
3  Coppermine Photo Gallery
4  ************************
5  Copyright (c) 2003-2016 Coppermine Dev Team
6  v1.0 originally written by Gregory Demar
7
8  This program is free software; you can redistribute it and/or modify
9  it under the terms of the GNU General Public License version 3
10  as published by the Free Software Foundation.
11
12  ********************************************
13  Coppermine version: 1.6.03
14  $HeadURL$
15**********************************************/
16
17class ImageTool {
18
19	// image information
20	protected $imginfo;
21
22	// needed actions to correctly orient an image based on its current orientation
23	// array(<rotate angle>, <mirror>)
24	protected $orientAction = array(
25		1 => array(0, false),
26		2 => array(0, true),
27		3 => array(180, false),
28		4 => array(180, true),
29		5 => array(-90, true),
30		6 => array(-90, false),
31		7 => array(90, true),
32		8 => array(90, false)
33	);
34
35	// Calculate watermark position
36	protected function get_wm_position ($destW, $destH, $wmW, $wmH)
37	{
38		global $CONFIG;
39
40		$pos = $CONFIG['where_put_watermark'];
41		$posx = $posy = $m = 2;		// 2 pixel margin
42		if ($pos == 'northwest') {
43		} else if ($pos == 'northeast') {
44			$posx = $destW - $wmW - $m;
45		} else if ($pos == 'southwest') {
46			$posy = $destH - $wmH - $m;
47		} else if ($pos == 'southeast') {
48			$posx = $destW - $wmW - $m;
49			$posy = $destH - $wmH - $m;
50		} else if ($pos == 'center') {
51			$posx = ($destW/2) - ($wmW/2);
52			$posy = ($destH/2) - ($wmH/2);
53		}
54
55		return array($posx, $posy);
56	}
57
58}
59//EOF