aboutsummaryrefslogtreecommitdiff
path: root/start.php
diff options
context:
space:
mode:
authorSem <sembrestels@riseup.net>2013-11-07 06:01:06 +0100
committerSem <sembrestels@riseup.net>2013-11-07 06:01:06 +0100
commit3ea9610796770bb2ba54d3c8c0f465a22eb9e3c8 (patch)
tree127226272974af37f9e49f3702ed74891c091881 /start.php
parentb02119c597a1d806e7910e63ba20139234249fa0 (diff)
downloadelgg-3ea9610796770bb2ba54d3c8c0f465a22eb9e3c8.tar.gz
elgg-3ea9610796770bb2ba54d3c8c0f465a22eb9e3c8.tar.bz2
Making video thumbnails faster (thanks to ura soul).
Diffstat (limited to 'start.php')
-rw-r--r--start.php37
1 files changed, 25 insertions, 12 deletions
diff --git a/start.php b/start.php
index 2094ffacc..6f94b97d0 100644
--- a/start.php
+++ b/start.php
@@ -270,22 +270,35 @@ function videolist_embed_get_items($hook, $type, $value, $params) {
* @return string Relative URL
*/
function videolist_icon_url_override($hook, $type, $returnvalue, $params) {
- $videolist_item = $params['entity'];
- /* @var ElggObject $videolist_item */
- $size = $params['size'];
- if($videolist_item->getSubtype() != 'videolist_item'){
- return $returnvalue;
- }
-
- // tiny thumbnails are too small to be useful, so give a generic video icon
- if ($size != 'tiny' && isset($videolist_item->thumbnail)) {
- return elgg_get_site_url() . "mod/videolist/thumbnail.php?guid=" . $videolist_item->guid;
+ // if someone already set this, quit
+ if ($return_value) {
+ return null;
}
- if (in_array($size, array('tiny', 'small', 'medium'))){
- return "mod/videolist/graphics/videolist_icon_{$size}.png";
+ $videolist_item = $params['entity'];
+ $size = $params['size'];
+
+ if (!elgg_instanceof($videolist_item, 'object', 'videolist_item')) {
+ return null;
}
+
+ // tiny thumbnails are too small to be useful, so give a generic video icon
+ try {
+ if ($size != 'tiny' && isset($videolist_item->thumbnail)) {
+ $owner = $videolist_item->getOwnerEntity();
+ $owner_guid = $owner->getGUID();
+ $join_date = $owner->getTimeCreated();
+ return "mod/videolist/thumbnail.php?joindate=$join_date&guid={$videolist_item->guid}&owner_guid=$owner_guid&size=$size";
+ }
+ } catch (InvalidParameterException $e) {
+ elgg_log("Unable to get videolist icon for video with GUID {$videolist_item->guid}", 'ERROR');
+ return "mod/videolist/graphics/videolist_icon_{$size}.png";
+ }
+ if (in_array($size, array('tiny', 'small', 'medium'))){
+ return "mod/videolist/graphics/videolist_icon_{$size}.png";
+ }
+ return null;
}
/**