aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGreg Froese <greg.froese@gmail.com>2009-05-18 12:57:59 +0000
committerGreg Froese <greg.froese@gmail.com>2009-05-18 12:57:59 +0000
commit70ad5de3a1d4fffc8b3d97c301194bb0258b4c68 (patch)
tree765e5d8b7081fd3373df0fb89d33a237a0239fce
parentdd81b02a85596a913c4a42fba655766b61334eb1 (diff)
downloadelgg-70ad5de3a1d4fffc8b3d97c301194bb0258b4c68.tar.gz
elgg-70ad5de3a1d4fffc8b3d97c301194bb0258b4c68.tar.bz2
fixed watermarking after code re-org and added most recently viewed option
-rw-r--r--actions/upload.php11
-rw-r--r--friendmostviewed.php11
-rw-r--r--languages/en.php1
-rw-r--r--lib/resize.php4
-rw-r--r--mostviewedimages.php2
-rw-r--r--start.php8
-rw-r--r--yourmostviewed.php2
7 files changed, 21 insertions, 18 deletions
diff --git a/actions/upload.php b/actions/upload.php
index 7aa87dc2b..1657210ed 100644
--- a/actions/upload.php
+++ b/actions/upload.php
@@ -144,8 +144,8 @@
*/
} else { // ImageMagick command line
-
- if (tp_create_imagick_cmdline_thumbnails($file, $prefix, $filestorename) != true) {
+ $thumbs = tp_create_imagick_cmdline_thumbnails($file, $prefix, $filestorename);
+ if(!count($thumbs)) {
trigger_error('Tidypics warning: failed to create thumbnails', E_USER_WARNING);
}
@@ -163,8 +163,9 @@
$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( $thumblarge ) {
+ if( $thumbs["thumblarge"] ) {
$ext = ".png";
$watermark_filename = strtolower($watermark_text);
@@ -190,8 +191,8 @@
}
//apply the watermark
$commands = array();
- $commands[] = $im_path . 'composite -gravity south -geometry +0+10 "' . $user_stamp_base . $ext . '" "' . $thumblarge . '" "' . $thumblarge . '_watermarked"';
- $commands[] = "mv \"$thumblarge" . "_watermarked\" \"$thumblarge\"";
+ $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 );
}
diff --git a/friendmostviewed.php b/friendmostviewed.php
index 4f832b228..8f6299c0d 100644
--- a/friendmostviewed.php
+++ b/friendmostviewed.php
@@ -31,18 +31,9 @@
global $CONFIG;
$prefix = $CONFIG->dbprefix;
$max = 24;
- //grab the top views (metadata 'tp_views') for $max number of entities
- //ignores entity subtypes
- $sql = "SELECT md.entity_guid, md.owner_guid, md.enabled, ms.string AS views from " . $prefix . "entities ent
- INNER JOIN " . $prefix . "metadata md ON md.entity_guid = ent.guid
- INNER JOIN " . $prefix . "metastrings ms ON md.value_id = ms.id
- INNER JOIN " . $prefix . "metastrings ms2 ON md.name_id = ms2.id AND ms2.string = 'tp_views'
- WHERE ent.owner_guid = " . $user->guid . "
- ORDER BY (views+0) DESC LIMIT $max";
-
$sql = "SELECT ent.guid, count( * ) AS views
- FROM `my_elggentities` ent
+ FROM " . $prefix . "entities ent
INNER JOIN " . $prefix . "entity_subtypes sub ON ent.subtype = sub.id
AND sub.subtype = 'image'
INNER JOIN " . $prefix . "annotations ann1 ON ann1.entity_guid = ent.guid
diff --git a/languages/en.php b/languages/en.php
index 0faf96324..0c7fa3efa 100644
--- a/languages/en.php
+++ b/languages/en.php
@@ -26,6 +26,7 @@
'tidypics:enablephotos' => 'Enable Group Photo Albums',
'tidypics:editprops' => 'Edit Image Properties',
'tidypics:mostviewed' => 'Most viewed images',
+ 'tidypics:recentlyviewed' => 'Recently viewed images',
'tidypics:mostrecent' => 'Most recent images',
'tidypics:yourmostviewed' => 'Your most viewed images',
'tidypics:yourmostrecent' => 'Your most recent images',
diff --git a/lib/resize.php b/lib/resize.php
index 1c28c49de..f9b7843e5 100644
--- a/lib/resize.php
+++ b/lib/resize.php
@@ -155,7 +155,9 @@
$file->largethumb = $prefix."largethumb".$filestorename;
}
- return true;
+ return array( "thumbnail" => $thumbnail,
+ "thumbsmall" => $thumbsmall,
+ "thumblarge" => $thumblarge);
}
/*
diff --git a/mostviewedimages.php b/mostviewedimages.php
index 5bbbcf5e7..9d2831bf7 100644
--- a/mostviewedimages.php
+++ b/mostviewedimages.php
@@ -17,7 +17,7 @@
//$annotations = get_annotations(0, "object", "image", "tp_view", "", "", 5000);
$sql = "SELECT ent.guid, count( * ) AS views
- FROM `my_elggentities` ent
+ FROM " . $prefix . "entities ent
INNER JOIN " . $prefix . "entity_subtypes sub ON ent.subtype = sub.id
AND sub.subtype = 'image'
INNER JOIN " . $prefix . "annotations ann1 ON ann1.entity_guid = ent.guid
diff --git a/start.php b/start.php
index f0c6a22f9..4a50c5092 100644
--- a/start.php
+++ b/start.php
@@ -147,6 +147,9 @@
add_submenu_item( elgg_echo('tidypics:mostrecent'),
$CONFIG->wwwroot . 'pg/photos/mostrecent',
'tidypics-z');
+ add_submenu_item( elgg_echo('tidypics:recentlyviewed'),
+ $CONFIG->wwwroot . 'pg/photos/recentlyviewed',
+ 'tidypics-z');
}
@@ -243,6 +246,11 @@
if (isset($page[1])) set_input('guid',$page[1]);
include($CONFIG->pluginspath . "tidypics/friendmostrecent.php");
break;
+
+ case "recentlyviewed":
+ if (isset($page[1])) set_input('guid',$page[1]);
+ include($CONFIG->pluginspath . "tidypics/recentlyviewed.php");
+ break;
}
}
else
diff --git a/yourmostviewed.php b/yourmostviewed.php
index 84cc2ca10..18936bd69 100644
--- a/yourmostviewed.php
+++ b/yourmostviewed.php
@@ -15,7 +15,7 @@
$max = 24;
$sql = "SELECT ent.guid, count( * ) AS views
- FROM `my_elggentities` ent
+ FROM " . $prefix . "entities ent
INNER JOIN " . $prefix . "entity_subtypes sub ON ent.subtype = sub.id
AND sub.subtype = 'image'
INNER JOIN " . $prefix . "annotations ann1 ON ann1.entity_guid = ent.guid