aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/album.php23
-rw-r--r--lib/exif.php74
-rw-r--r--lib/image.php23
-rw-r--r--lib/resize.php539
-rw-r--r--lib/tidypics.php55
-rw-r--r--lib/watermark.php56
6 files changed, 0 insertions, 770 deletions
diff --git a/lib/album.php b/lib/album.php
deleted file mode 100644
index 7e03ed6eb..000000000
--- a/lib/album.php
+++ /dev/null
@@ -1,23 +0,0 @@
-<?php
- /**
- * Tidypics Album class
- *
- */
-
-
- class TidypicsAlbum extends ElggObject
- {
- protected function initialise_attributes()
- {
- parent::initialise_attributes();
-
- $this->attributes['subtype'] = "album";
- }
-
- public function __construct($guid = null)
- {
- parent::__construct($guid);
- }
- }
-
-?> \ No newline at end of file
diff --git a/lib/exif.php b/lib/exif.php
deleted file mode 100644
index 2bc25c996..000000000
--- a/lib/exif.php
+++ /dev/null
@@ -1,74 +0,0 @@
-<?php
-
-function td_get_exif($file) {
- $mime = $file->mimetype;
- if ($mime != 'image/jpeg' && $mime != 'image/pjpeg')
- return;
-
- $filename = $file->getFilenameOnFilestore();
- $exif = exif_read_data($filename);
- create_metadata($file->getGUID(), "tp_exif", serialize($exif), "string", $file->getObjectOwnerGUID(), ACCESS_PUBLIC);
-}
-
-function tp_exif_formatted($file_guid) {
-
- $metadata_exif = get_metadata_byname($file_guid, "tp_exif");
- if (!$metadata_exif) { //try to load it from the file if its not in the database
- $file = new ElggFile($file_guid);
- td_get_exif($file);
- unset($file);
- $metadata_exif = get_metadata_byname($file_guid, "tp_exif");
- }
-
- if (!$metadata_exif) {
- return false;
- }
-
- $exif = unserialize($metadata_exif["value"]);
-
- $model = $exif['Model'];
- if(!$model) $model = "N/A";
- $exif_data['Model'] = $model;
-
- $exposure = $exif['ExposureTime'];
- if (!$exposure) $exposure = "N/A";
- $exif_data['Shutter'] = $exposure;
-
- //got the code snippet below from http://www.zenphoto.org/support/topic.php?id=17
- //convert the raw values to understandible values
- $Fnumber = explode("/", $exif['FNumber']);
- if ($Fnumber[1] != 0)
- $Fnumber = $Fnumber[0] / $Fnumber[1];
- else
- $Fnumber = 0;
- if (!$Fnumber) {
- $Fnumber = "N/A";
- } else {
- $Fnumber = "f/$Fnumber";
- }
- $exif_data['Aperture'] = $Fnumber;
-
- $iso = $exif['ISOSpeedRatings'];
- if (!$iso) $iso = "N/A";
- $exif_data['ISO Speed'] = $iso;
-
- $Focal = explode("/", $exif['FocalLength']);
- if ($Focal[1] != 0)
- $Focal = $Focal[0] / $Focal[1];
- else
- $Focal = 0;
- if (!$Focal || round($Focal) == "0") $Focal = 0;
- if (round($Focal) == 0) {
- $Focal = "N/A";
- } else {
- $Focal = round($Focal) . "mm";
- }
- $exif_data['Focal Length'] = $Focal;
-
- $captured = $exif['DateTime'];
- if (!$captured) $captured = "N/A";
- $exif_data['Captured'] = $captured;
-
- return $exif_data;
-}
-?> \ No newline at end of file
diff --git a/lib/image.php b/lib/image.php
deleted file mode 100644
index 3a23a1932..000000000
--- a/lib/image.php
+++ /dev/null
@@ -1,23 +0,0 @@
-<?php
- /**
- * Tidypics Image class
- *
- */
-
-
- class TidypicsImage extends ElggFile
- {
- protected function initialise_attributes()
- {
- parent::initialise_attributes();
-
- $this->attributes['subtype'] = "image";
- }
-
- public function __construct($guid = null)
- {
- parent::__construct($guid);
- }
- }
-
-?> \ No newline at end of file
diff --git a/lib/resize.php b/lib/resize.php
deleted file mode 100644
index 8561e1f4a..000000000
--- a/lib/resize.php
+++ /dev/null
@@ -1,539 +0,0 @@
-<?php
- /**
- * Elgg tidypics library of resizing functions
- *
- */
-
-
- /**
- * Create thumbnails using PHP GD Library
- *
- * @param ElggFile holds the image that was uploaded
- * @param string folder to store thumbnail in
- * @param string name of the thumbnail
- * @return bool true on success
- */
- function tp_create_gd_thumbnails($file, $prefix, $filestorename)
- {
- global $CONFIG;
-
- $image_sizes = get_plugin_setting('image_sizes', 'tidypics');
- if (!$image_sizes) {
- register_error(elgg_echo('tidypics:nosettings'));
- forward($_SERVER['HTTP_REFERER']);
- return false;
- }
- $image_sizes = unserialize($image_sizes);
-
- $thumb = new ElggFile();
-
- // tiny thumbail
- $thumb->setFilename($prefix."thumb".$filestorename);
- $thumbname = $thumb->getFilenameOnFilestore();
- $rtn_code = tp_gd_resize( $file->getFilenameOnFilestore(),
- $thumbname,
- $image_sizes['thumb_image_width'],
- $image_sizes['thumb_image_height'],
- true);
- if (!$rtn_code)
- return false;
- $file->thumbnail = $prefix."thumb".$filestorename;
-
-
- // album thumbnail
- $thumb->setFilename($prefix."smallthumb".$filestorename);
- $thumbname = $thumb->getFilenameOnFilestore();
- $rtn_code = tp_gd_resize( $file->getFilenameOnFilestore(),
- $thumbname,
- $image_sizes['small_image_width'],
- $image_sizes['small_image_height'],
- true);
- if (!$rtn_code)
- return false;
- $file->smallthumb = $prefix."smallthumb".$filestorename;
-
-
- // main image
- $thumb->setFilename($prefix."largethumb".$filestorename);
- $thumbname = $thumb->getFilenameOnFilestore();
- $rtn_code = tp_gd_resize( $file->getFilenameOnFilestore(),
- $thumbname,
- $image_sizes['large_image_width'],
- $image_sizes['large_image_height'],
- false);
- if (!$rtn_code)
- return false;
- $file->largethumb = $prefix."largethumb".$filestorename;
-
- unset($thumb);
-
- return true;
- }
-
- /**
- * Writes resized version of an already uploaded image - original from Elgg filestore.php
- * Saves it in the same format as uploaded
- *
- * @param string $input_name The name of the file on the disk
- * @param string $output_name The name of the file to be written
- * @param int $maxwidth The maximum width of the resized image
- * @param int $maxheight The maximum height of the resized image
- * @param true|false $square If set to true, will take the smallest of maxwidth and maxheight and use it to set the dimensions on all size; the image will be cropped.
- * @return bool true on success or false on failure
- */
- function tp_gd_resize($input_name, $output_name, $maxwidth, $maxheight, $square = false, $x1 = 0, $y1 = 0, $x2 = 0, $y2 = 0) {
-
- // Get the size information from the image
- $imgsizearray = getimagesize($input_name);
- if (!imgsizearray)
- return false;
-
- // Get width and height
- $width = $imgsizearray[0];
- $height = $imgsizearray[1];
- $newwidth = $width;
- $newheight = $height;
-
- // Square the image dimensions if we're wanting a square image
- if ($square) {
- if ($width < $height) {
- $height = $width;
- } else {
- $width = $height;
- }
-
- $newwidth = $width;
- $newheight = $height;
-
- }
-
- if ($width > $maxwidth) {
- $newheight = floor($height * ($maxwidth / $width));
- $newwidth = $maxwidth;
- }
- if ($newheight > $maxheight) {
- $newwidth = floor($newwidth * ($maxheight / $newheight));
- $newheight = $maxheight;
- }
-
- $accepted_formats = array(
- 'image/jpeg' => 'jpeg',
- 'image/pjpeg' => 'jpeg',
- 'image/png' => 'png',
- 'image/x-png' => 'png',
- 'image/gif' => 'gif'
- );
-
- // make sure the function is available
- $function = "imagecreatefrom" . $accepted_formats[$imgsizearray['mime']];
- if (!is_callable($function))
- return false;
-
-
- // load old image
- $oldimage = $function($input_name);
- if (!$oldimage)
- return false;
-
- // allocate the new image
- $newimage = imagecreatetruecolor($newwidth, $newheight);
- if (!$newimage)
- return false;
-
- // Crop the image if we need a square
- if ($square) {
- if ($x1 == 0 && $y1 == 0 && $x2 == 0 && $y2 ==0) {
- $widthoffset = floor(($imgsizearray[0] - $width) / 2);
- $heightoffset = floor(($imgsizearray[1] - $height) / 2);
- } else {
- $widthoffset = $x1;
- $heightoffset = $y1;
- $width = ($x2 - $x1);
- $height = $width;
- }
- } else {
- if ($x1 == 0 && $y1 == 0 && $x2 == 0 && $y2 ==0) {
- $widthoffset = 0;
- $heightoffset = 0;
- } else {
- $widthoffset = $x1;
- $heightoffset = $y1;
- $width = ($x2 - $x1);
- $height = ($y2 - $y1);
- }
- }
-
- if ($square) {
- $newheight = $maxheight;
- $newwidth = $maxwidth;
- }
-
- $rtn_code = imagecopyresampled($newimage, $oldimage, 0,0,$widthoffset,$heightoffset,$newwidth,$newheight,$width,$height);
- if (!rtn_code)
- return $rtn_code;
-
- switch ($imgsizearray['mime']) {
- case 'image/jpeg':
- case 'image/pjpeg':
- $rtn_code = imagejpeg($newimage, $output_name, 85);
- break;
- case 'image/png':
- case 'image/x-png':
- $rtn_code = imagepng($newimage, $output_name);
- break;
- case 'image/gif':
- $rtn_code = imagegif($newimage, $output_name);
- break;
- }
-
- imagedestroy($newimage);
- imagedestroy($oldimage);
-
- return $rtn_code;
- }
-
-
- /**
- * Create thumbnails using PHP ImageMagick Library
- *
- * @param ElggFile holds the image that was uploaded
- * @param string folder to store thumbnail in
- * @param string name of the thumbnail
- * @return bool true on success
- */
- function tp_create_imagick_thumbnails($file, $prefix, $filestorename)
- {
- $image_sizes = get_plugin_setting('image_sizes', 'tidypics');
- if (!$image_sizes) {
- register_error(elgg_echo('tidypics:nosettings'));
- return false;
- }
- $image_sizes = unserialize($image_sizes);
-
- $thumb = new ElggFile();
-
-
- // tiny thumbnail
- $thumb->setFilename($prefix."thumb".$filestorename);
- $thumbname = $thumb->getFilenameOnFilestore();
- $rtn_code = tp_imagick_resize( $file->getFilenameOnFilestore(),
- $thumbname,
- $image_sizes['thumb_image_width'],
- $image_sizes['thumb_image_height'],
- true);
- if (!$rtn_code)
- return false;
- $file->thumbnail = $prefix."thumb".$filestorename;
-
-
- // album thumbnail
- $thumb->setFilename($prefix."smallthumb".$filestorename);
- $thumbname = $thumb->getFilenameOnFilestore();
- $rtn_code = tp_imagick_resize( $file->getFilenameOnFilestore(),
- $thumbname,
- $image_sizes['small_image_width'],
- $image_sizes['small_image_height'],
- true);
- if (!$rtn_code)
- return false;
- $file->smallthumb = $prefix."smallthumb".$filestorename;
-
-
- // main image
- $thumb->setFilename($prefix."largethumb".$filestorename);
- $thumbname = $thumb->getFilenameOnFilestore();
- $rtn_code = tp_imagick_resize( $file->getFilenameOnFilestore(),
- $thumbname,
- $image_sizes['large_image_width'],
- $image_sizes['large_image_height'],
- false);
- if (!$rtn_code)
- return false;
- $file->largethumb = $prefix."largethumb".$filestorename;
-
- unset($thumb);
-
- return true;
- }
-
-
- /**
- * Resize using PHP ImageMagick Library
- *
- * Writes resized version of an already uploaded image
- *
- *
- * @param string $input_name The name of the file input field on the submission form
- * @param string $output_name The name of the file to be written
- * @param int $maxwidth The maximum width of the resized image
- * @param int $maxheight The maximum height of the resized image
- * @param true|false $square If set to true, will take the smallest of maxwidth and maxheight and use it to set the dimensions on all size; the image will be cropped.
- * @return bool true on success
- */
- function tp_imagick_resize($input_name, $output_name, $maxwidth, $maxheight, $square = false, $x1 = 0, $y1 = 0, $x2 = 0, $y2 = 0) {
-
- // Get the size information from the image
- $imgsizearray = getimagesize($input_name);
- if (!$imgsizearray)
- return false;
-
-
- // Get width and height
- $width = $imgsizearray[0];
- $height = $imgsizearray[1];
- $newwidth = $width;
- $newheight = $height;
-
- // initial guess at final dimensions for new image (doesn't check for squareness yet
- if ($newwidth > $maxwidth) {
- $newheight = floor($newheight * ($maxwidth / $newwidth));
- $newwidth = $maxwidth;
- }
- if ($newheight > $maxheight) {
- $newwidth = floor($newwidth * ($maxheight / $newheight));
- $newheight = $maxheight;
- }
-
- // Handle squareness for both original and new image
- if ($square) {
- if ($width < $height) {
- $height = $width;
- } else {
- $width = $height;
- }
-
- if ($maxheight == $maxwidth) {
- // if input arguments = square, no need to use above calculations (which can have round-off errors)
- $newwidth = $maxwidth;
- $newheight = $maxheight;
- } else {
- if ($newwidth < $newheight) {
- $newheight = $newwidth;
- } else {
- $newwidth = $newheight;
- }
- }
- }
-
-
- // Crop the original image - this needs to be checked over
- if ($square) {
- if ($x1 == 0 && $y1 == 0 && $x2 == 0 && $y2 ==0) {
- $xoffset = floor(($imgsizearray[0] - $width) / 2);
- $yoffset = floor(($imgsizearray[1] - $height) / 2);
- } else { // assume we're being passed good croping coordinates
- $xoffset = $x1;
- $yoffset = $y1;
- $width = ($x2 - $x1);
- $height = $width;
- }
- } else {
- if ($x1 == 0 && $y1 == 0 && $x2 == 0 && $y2 ==0) {
- $xoffset = 0;
- $yoffset = 0;
- } else {
- $xoffset = $x1;
- $yoffset = $y1;
- $width = ($x2 - $x1);
- $height = ($y2 - $y1);
- }
- }
-
-
- try {
- $img = new Imagick($input_name);
- } catch (ImagickException $e) {
- return false;
- }
-
- $img->cropImage($width, $height, $xoffset, $yoffset);
-
- // use the default IM filter (windowing filter), I think 1 means default blurring or number of lobes
- $img->resizeImage($newwidth, $newheight, imagick::FILTER_LANCZOS, 1);
- $img->setImagePage($newwidth, $newheight, 0, 0);
-
- if ($img->writeImage($output_name) != true) {
- $img->destroy();
- return false;
- }
-
- $img->destroy();
-
- return true;
- }
-
- /**
- * Create thumbnails using ImageMagick executables
- *
- * @param ElggFile holds the image that was uploaded
- * @param string folder to store thumbnail in
- * @param string name of the thumbnail
- * @return bool true on success
- */
- function tp_create_imagick_cmdline_thumbnails($file, $prefix, $filestorename)
- {
- global $CONFIG;
-
- $mime = $file->getMimeType();
-
- $image_sizes = get_plugin_setting('image_sizes', 'tidypics');
- if (!$image_sizes) {
- register_error(elgg_echo('tidypics:nosettings'));
- return array();
- }
- $image_sizes = unserialize($image_sizes);
-
- $thumblarge = tp_imagick_cmdline_resize($file->getFilenameOnFilestore(),
- "largethumb",
- $image_sizes['large_image_width'],
- $image_sizes['large_image_height'],
- false);
-
- $thumbsmall = tp_imagick_cmdline_resize($file->getFilenameOnFilestore(),
- "smallthumb",
- $image_sizes['small_image_width'],
- $image_sizes['small_image_height'],
- true);
-
- $thumbnail = tp_imagick_cmdline_resize($file->getFilenameOnFilestore(),
- "thumb",
- $image_sizes['thumb_image_width'],
- $image_sizes['thumb_image_height'],
- true);
-
- if ($thumbnail) {
- $thumb = new ElggFile();
- $thumb->setMimeType($mime);
- $thumb->setFilename($prefix."thumb".$filestorename);
- $file->thumbnail = $prefix."thumb".$filestorename;
- }
-
- if ($thumbsmall) {
- $thumb = new ElggFile();
- $thumb->setMimeType($mime);
- $thumb->setFilename($prefix."smallthumb".$filestorename);
- $file->smallthumb = $prefix."smallthumb".$filestorename;
- }
-
- if ($thumblarge) {
- $thumb = new ElggFile();
- $thumb->setMimeType($mime);
- $thumb->setFilename($prefix."largethumb".$filestorename);
- $file->largethumb = $prefix."largethumb".$filestorename;
- }
-
- return array( "thumbnail" => $thumbnail,
- "thumbsmall" => $thumbsmall,
- "thumblarge" => $thumblarge);
- }
-
- /*
- * Gets the jpeg contents of the resized version of an already uploaded image
- * (Returns false if the uploaded file was not an image)
- *
- * @param string $input_name The name of the file input field on the submission form
- * @param string $prefix The text to prefix to the existing filename
- * @param int $maxwidth The maximum width of the resized image
- * @param int $maxheight The maximum height of the resized image
- * @param true|false $square If set to true, will take the smallest of maxwidth and maxheight and use it to set the dimensions on all size; the image will be cropped.
- * @return false|mixed The contents of the resized image, or false on failure
- */
- function tp_imagick_cmdline_resize($input_name, $prefix, $maxwidth, $maxheight, $square = false, $x1 = 0, $y1 = 0, $x2 = 0, $y2 = 0) {
-
- $params = array(
- "input_name"=>$input_name,
- "output_name"=>$output_name,
- "maxwidth"=>$maxwidth,
- "maxheight"=>$maxheight,
- "square"=>$square,
- "x1"=>$x1,
- "y1"=>$y1,
- "x2"=>$x2,
- "y2"=>$y2);
-
- $path = pathinfo($input_name);
- $output_name = $path["dirname"] . "/$prefix" . $path["filename"] . "." . $path["extension"];
-
- // Get the size information from the image
- if ($imgsizearray = getimagesize($input_name)) {
-
- // Get width and height
- $width = $imgsizearray[0];
- $height = $imgsizearray[1];
- $newwidth = $width;
- $newheight = $height;
-
- // Square the image dimensions if we're wanting a square image
- if ($square) {
- if ($width < $height) {
- $height = $width;
- } else {
- $width = $height;
- }
-
- $newwidth = $width;
- $newheight = $height;
-
- }
-
- if ($width > $maxwidth) {
- $newheight = floor($height * ($maxwidth / $width));
- $newwidth = $maxwidth;
- }
- if ($newheight > $maxheight) {
- $newwidth = floor($newwidth * ($maxheight / $newheight));
- $newheight = $maxheight;
- }
-
- $accepted_formats = array(
- 'image/jpeg' => 'jpeg',
- 'image/png' => 'png',
- 'image/gif' => 'gif'
- );
- // If it's a file we can manipulate ...
- if (array_key_exists($imgsizearray['mime'],$accepted_formats)) {
-
- // Crop the image if we need a square
- if ($square) {
- if ($x1 == 0 && $y1 == 0 && $x2 == 0 && $y2 ==0) {
- $widthoffset = floor(($imgsizearray[0] - $width) / 2);
- $heightoffset = floor(($imgsizearray[1] - $height) / 2);
- } else {
- $widthoffset = $x1;
- $heightoffset = $y1;
- $width = ($x2 - $x1);
- $height = $width;
- }
- } else {
- if ($x1 == 0 && $y1 == 0 && $x2 == 0 && $y2 ==0) {
- $widthoffset = 0;
- $heightoffset = 0;
- } else {
- $widthoffset = $x1;
- $heightoffset = $y1;
- $width = ($x2 - $x1);
- $height = ($y2 - $y1);
- }
- }
-
- // Resize and return the image contents!
- if ($square) {
- $newheight = $maxheight;
- $newwidth = $maxwidth;
- }
- $im_path = get_plugin_setting('convert_command', 'tidypics');
- if(!$im_path) {
- $im_path = "/usr/bin/";
- }
- if(substr($im_path, strlen($im_path)-1, 1) != "/") $im_path .= "/";
- $command = $im_path . "convert \"$input_name\" -resize ".$newwidth."x".$newheight."^ -gravity center -extent ".$newwidth."x".$newheight." \"$output_name\"";
- system($command);
- return $output_name;
-
- }
- }
-
- return false;
- }
-
-?> \ No newline at end of file
diff --git a/lib/tidypics.php b/lib/tidypics.php
deleted file mode 100644
index d81b3ab2f..000000000
--- a/lib/tidypics.php
+++ /dev/null
@@ -1,55 +0,0 @@
-<?php
- /**
- * Elgg tidypics library of common functions
- *
- */
-
- /**
- * Get images for display on front page
- *
- * @param int number of images
- * @param int (optional) guid of owner
- * @return string of html for display
- *
- * To use with the custom index plugin, use something like this:
-
- if (is_plugin_enabled('tidypics')) {
-?>
- <!-- display latest photos -->
- <div class="index_box">
- <h2><a href="<?php echo $vars['url']; ?>pg/photos/world/"><?php echo elgg_echo("tidypics:mostrecent"); ?></a></h2>
- <div class="contentWrapper">
- <?php
- echo tp_get_latest_photos(5);
- ?>
- </div>
- </div>
-<?php
- }
-?>
-
- * Good luck
- */
- function tp_get_latest_photos($num_images, $owner_guid = 0)
- {
- $prev_context = set_context('front');
- $image_html = list_entities('object', 'image', $owner_guid, $num_images, false, false, false);
- set_context($prev_context);
- return $image_html;
- }
-
-
- /**
- * Get image directory path
- *
- * Each album gets a subdirectory based on its container id
- *
- * @return string path to image directory
- */
- function tp_get_img_dir()
- {
- $file = new ElggFile();
- return $file->getFilenameOnFilestore() . 'image/';
- }
-
-?> \ No newline at end of file
diff --git a/lib/watermark.php b/lib/watermark.php
deleted file mode 100644
index 330ae7b29..000000000
--- a/lib/watermark.php
+++ /dev/null
@@ -1,56 +0,0 @@
-<?php
-
-
-function tp_watermark($thumbs) {
- global $CONFIG;
-
- $user = get_user_entity_as_row($album->owner_guid);
- $username = $user->username;
-
- $im_path = get_plugin_setting('convert_command', 'tidypics');
- if(!$im_path) {
- $im_path = "/usr/bin/";
- }
- if(substr($im_path, strlen($im_path)-1, 1) != "/") $im_path .= "/";
-
- $viewer = get_loggedin_user();
- $watermark_text = get_plugin_setting('watermark_text', 'tidypics');
- $watermark_text = str_replace("%username%", $viewer->username, $watermark_text);
- $watermark_text = str_replace("%sitename%", $CONFIG->sitename, $watermark_text);
-
- if( $watermark_text ) { //get this value from the plugin settings
- if( $thumbs["thumblarge"] ) {
- $ext = ".png";
-
- $watermark_filename = strtolower($watermark_text);
- $watermark_filename = preg_replace("/[^\w-]+/", "-", $watermark_filename);
- $watermark_filename = trim($watermark_filename, '-');
-
- $user_stamp_base = tp_get_img_dir();
- $user_stamp_base .= strtolower($viewer->name . "_" . $watermark_filename . "_stamp");
- $user_stamp_base .= preg_replace("/[^\w-]+/", "-", $user_stamp_base);
-
- if( !file_exists( $user_stamp_base . $ext )) { //create the watermark if it doesn't exist
- $commands = array();
- $commands[] = $im_path . 'convert -size 300x50 xc:grey30 -pointsize 20 -gravity center -draw "fill grey70 text 0,0 \''. $watermark_text . '\'" "'. $user_stamp_base . '_fgnd' . $ext . '"';
- $commands[] = $im_path . 'convert -size 300x50 xc:black -pointsize 20 -gravity center -draw "fill white text 1,1 \''. $watermark_text . '\' text 0,0 \''. $watermark_text . '\' fill black text -1,-1 \''. $watermark_text . '\'" +matte ' . $user_stamp_base . '_mask' . $ext;
- $commands[] = $im_path . 'composite -compose CopyOpacity "' . $user_stamp_base . "_mask" . $ext . '" "' . $user_stamp_base . '_fgnd' . $ext . '" "' . $user_stamp_base . $ext . '"';
- $commands[] = $im_path . 'mogrify -trim +repage "' . $user_stamp_base . $ext . '"';
- $commands[] = 'rm "' . $user_stamp_base . '_mask' . $ext . '"';
- $commands[] = 'rm "' . $user_stamp_fgnd . '_mask' . $ext . '"';
-
- foreach( $commands as $command ) {
- exec( $command );
- }
- }
- //apply the watermark
- $commands = array();
- $commands[] = $im_path . 'composite -gravity south -geometry +0+10 "' . $user_stamp_base . $ext . '" "' . $thumbs["thumblarge"] . '" "' . $thumbs["thumblarge"] . '_watermarked"';
- $commands[] = "mv \"$thumbs[thumblarge]" . "_watermarked\" \"$thumbs[thumblarge]\"";
- foreach( $commands as $command ) {
- exec( $command );
- }
- }
- }
-}
-?> \ No newline at end of file