3 require_once('Photo.php');
4 require_once('view/acl_selectors.php');
6 function photos_init(&$a) {
10 $r = q("SELECT * FROM `user` WHERE `nickname` = '%s' LIMIT 1",
17 $a->data['user'] = $r[0];
19 $albums = q("SELECT distinct(`album`) AS `album` FROM `photo` WHERE `uid` = %d",
20 intval($a->data['user']['uid'])
24 $a->data['albums'] = $albums;
26 $o .= '<h4><a href="' . $a->get_baseurl() . '/profile/' . $a->data['user']['nickname'] . '">' . $a->data['user']['username'] . '</a></h4>';
27 $o .= '<h4>' . '<a href="' . $a->get_baseurl() . '/photos/' . $a->data['user']['nickname'] . '">' . t('Photo Albums') . '</a></h4>';
30 foreach($albums as $album) {
31 if((! strlen($album['album'])) || ($album['album'] == t('Contact Photos')))
33 $o .= '<li>' . '<a href="photos/' . $a->argv[1] . '/album/' . bin2hex($album['album']) . '" />' . $album['album'] . '</a></li>';
37 $a->page['aside'] .= $o;
45 function photos_post(&$a) {
49 notice( t('Permission denied.') . EOL );
55 $r = q("SELECT `contact`.* `user`.`nickname` FROM `contact` LEFT JOIN `user` ON `user`.`uid` = `contact`.`uid`
56 WHERE `user`.`uid` = %d AND `self` = 1 LIMIT 1",
57 intval($_SESSION['uid'])
60 $contact_record = $r[0];
63 if(($a->argc > 2) && ($a->argv[1] == 'album')) {
64 $album = hex2bin($a->argv[2]);
66 if($album == t('Profile Photos') || $album == t('Contact Photos')) {
67 goaway($a->get_baseurl() . '/' . $_SESSION['photo_return']);
71 $r = q("SELECT count(*) FROM `photo` WHERE `album` = '%s' AND `uid` = %d",
73 intval($_SESSION['uid'])
76 notice( t('Album not found.') . EOL);
77 goaway($a->get_baseurl() . '/' . $_SESSION['photo_return']);
81 $newalbum = notags(trim($_POST['albumname']));
82 if($newalbum != $album) {
83 q("UPDATE `photo` SET `album` = '%s' WHERE `album` = '%s' AND `uid` = %d",
86 intval($_SESSION['uid'])
88 $newurl = str_replace(bin2hex($album),bin2hex($newalbum),$_SESSION['photo_return']);
89 goaway($a->get_baseurl() . '/' . $newurl);
93 if($_POST['dropalbum'] == t('Delete Album')) {
96 $r = q("SELECT distinct(`resource-id`) as `rid` FROM `photo` WHERE `uid` = %d AND `album` = '%s'",
102 $res[] = "'" . dbesc($rr['rid']) . "'" ;
106 goaway($a->get_baseurl() . '/' . $_SESSION['photo_return']);
107 return; // NOTREACHED
109 $str_res = implode(',', $res);
111 q("DELETE FROM `photo` WHERE `resource-id` IN ( $str_res ) AND `uid` = %d",
114 $r = q("SELECT `parent-uri` FROM `item` WHERE `resource-id` IN ( $str_res ) AND `uid` = %d",
119 q("UPDATE `item` SET `deleted` = 1, `changed` = '%s' WHERE `parent-uri` = '%s' AND `uid` = %d",
120 dbesc(datetime_convert()),
121 dbesc($rr['parent-uri']),
125 $drop_id = intval($rr['id']);
126 $php_path = ((strlen($a->config['php_path'])) ? $a->config['php_path'] : 'php');
128 // send the notification upstream/downstream as the case may be
131 proc_close(proc_open("\"$php_path\" \"include/notifier.php\" \"drop\" \"$drop_id\" & ",
137 goaway($a->get_baseurl() . '/photos/' . $a->data['user']['nickname']);
138 return; // NOTREACHED
141 if(($a->argc > 1) && (x($_POST,'delete')) && ($_POST['delete'] == t('Delete Photo'))) {
142 $r = q("SELECT `id` FROM `photo` WHERE `uid` = %d AND `resource-id` = '%s' LIMIT 1",
147 q("DELETE FROM `photo` WHERE `uid` = %d AND `resource-id` = '%s'",
149 dbesc($r[0]['resource-id'])
151 $i = q("SELECT * FROM `item` WHERE `resource-id` = '%s' AND `uid` = %d LIMIT 1",
152 dbesc($r[0]['resource-id']),
156 q("UPDATE `item` SET `deleted` = 1, `edited` = '%s', `changed` = '%s' WHERE `parent-uri` = '%s' AND `uid` = %d",
157 dbesc(datetime_convert()),
158 dbesc(datetime_convert()),
163 $url = $a->get_baseurl();
164 $drop_id = intval($i[0]['id']);
165 $php_path = ((strlen($a->config['php_path'])) ? $a->config['php_path'] : 'php');
167 // send the notification upstream/downstream as the case may be
170 proc_close(proc_open("\"$php_path\" \"include/notifier.php\" \"drop\" \"$drop_id\" & ",
175 goaway($a->get_baseurl() . '/' . $_SESSION['photo_return']);
176 return; // NOTREACHED
181 if(($a->argc > 1) && (x($_POST,'desc') !== false)) {
182 $desc = notags(trim($_POST['desc']));
183 $tags = notags(trim($_POST['tags']));
184 $item_id = intval($_POST['item_id']);
185 $resource_id = $a->argv[1];
187 $p = q("SELECT * FROM `photo` WHERE `resource-id` = '%s' AND `uid` = %d ORDER BY `scale` DESC",
192 $r = q("UPDATE `photo` SET `desc` = '%s' WHERE `resource-id` = '%s' AND `uid` = %d",
201 $basename = basename($filename);
203 // Create item container
205 $body = '[url=' . $a->get_baseurl() . '/photos/' . $a->data['user']['nickname'] . '/image/' . $p[0]['resource-id'] . ']'
206 . '[img]' . $a->get_baseurl() . '/photo/' . $p[0]['resource-id'] . '-' . $p[0]['scale'] . '.jpg' . '[/img]'
209 $uri = item_new_uri($a->get_hostname(),get_uid());
211 $r = q("INSERT INTO `item` (`uid`, `type`, `resource-id`, `contact-id`,
212 `owner-name`,`owner-link`,`owner-avatar`, `created`,
213 `edited`, `changed`, `uri`, `parent-uri`, `title`, `body`, `allow_cid`, `allow_gid`, `deny_cid`, `deny_gid`)
214 VALUES( %d, '%s', '%s', %d, '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s' )",
217 dbesc($p[0]['resource-id']),
218 intval($contact_record['id']),
219 dbesc($contact_record['name']),
220 dbesc($contact_record['url']),
221 dbesc($contact_record['thumb']),
222 dbesc(datetime_convert()),
223 dbesc(datetime_convert()),
224 dbesc(datetime_convert()),
229 dbesc($p[0]['allow_cid']),
230 dbesc($p[0]['allow_gid']),
231 dbesc($p[0]['deny_cid']),
232 dbesc($p[0]['deny_gid'])
237 $r = q("SELECT `id` FROM `item` WHERE `uri` = '%s' LIMIT 1",
241 $item_id = $r[0]['id'];
242 q("UPDATE `item` SET `parent` = %d, `last-child` = 1 WHERE `id` = %d LIMIT 1",
249 $r = q("UPDATE `item` SET `tag` = '%s', `edited` = '%s', `changed` = '%s' WHERE `id` = %d AND `uid` = %d LIMIT 1",
251 dbesc(datetime_convert()),
252 dbesc(datetime_convert()),
257 goaway($a->get_baseurl() . '/' . $_SESSION['photo_return']);
258 return; // NOTREACHED
264 if(! x($_FILES,'userfile'))
267 if($_POST['partitionCount'])
270 $java_upload = false;
272 $album = notags(trim($_POST['album']));
273 $newalbum = notags(trim($_POST['newalbum']));
275 if(! strlen($album)) {
276 if(strlen($newalbum))
279 $album = datetime_convert('UTC',date_default_timezone_get(),'now', 'Y');
282 $r = q("SELECT * FROM `photo` WHERE `album` = '%s' AND `uid` = %d",
286 if((! count($r)) || ($album == t('Profile Photos')))
292 $str_group_allow = perms2str($_POST['group_allow']);
293 $str_contact_allow = perms2str($_POST['contact_allow']);
294 $str_group_deny = perms2str($_POST['group_deny']);
295 $str_contact_deny = perms2str($_POST['contact_deny']);
297 $src = $_FILES['userfile']['tmp_name'];
298 $filename = basename($_FILES['userfile']['name']);
299 $filesize = intval($_FILES['userfile']['size']);
301 $imagedata = @file_get_contents($src);
302 $ph = new Photo($imagedata);
304 if(! ($image = $ph->getImage())) {
305 notice( t('Unable to process image.') . EOL );
312 $width = $ph->getWidth();
313 $height = $ph->getHeight();
317 $photo_hash = hash('md5',uniqid(mt_rand(),true));
319 $r = $ph->store(get_uid(), 0, $photo_hash, $filename, $album, 0 , 0, $str_contact_allow, $str_group_allow, $str_contact_deny, $str_group_deny);
322 notice( t('Image upload failed.') . EOL );
326 if($width > 640 || $height > 640) {
327 $ph->scaleImage(640);
328 $ph->store(get_uid(), 0, $photo_hash, $filename, $album, 1, 0, $str_contact_allow, $str_group_allow, $str_contact_deny, $str_group_deny);
332 if($width > 320 || $height > 320) {
333 $ph->scaleImage(320);
334 $ph->store(get_uid(), 0, $photo_hash, $filename, $album, 2, 0, $str_contact_allow, $str_group_allow, $str_contact_deny, $str_group_deny);
338 $basename = basename($filename);
340 // Create item container
342 $body = '[url=' . $a->get_baseurl() . '/photos/' . $contact_record['nickname'] . '/image/' . $photo_hash . ']'
343 . '[img]' . $a->get_baseurl() . "/photo/{$photo_hash}-{$smallest}.jpg" . '[/img]'
346 $uri = item_new_uri($a->get_hostname(), get_uid());
348 $r = q("INSERT INTO `item` (`uid`, `type`, `resource-id`, `contact-id`,`owner-name`,`owner-link`,`owner-avatar`, `created`,
349 `edited`, `changed`, `uri`, `parent-uri`, `title`, `body`, `allow_cid`, `allow_gid`, `deny_cid`, `deny_gid`, `visible`)
350 VALUES( %d, '%s', '%s', %d, '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', %d )",
354 intval($contact_record['id']),
355 dbesc($contact_record['name']),
356 dbesc($contact_record['url']),
357 dbesc($contact_record['thumb']),
358 dbesc(datetime_convert()),
359 dbesc(datetime_convert()),
360 dbesc(datetime_convert()),
365 dbesc($str_contact_allow),
366 dbesc($str_group_allow),
367 dbesc($str_contact_deny),
368 dbesc($str_group_deny),
373 $r = q("SELECT `id` FROM `item` WHERE `uri` = '%s' LIMIT 1",
377 q("UPDATE `item` SET `parent` = %d, `last-child` = 1 WHERE `id` = %d LIMIT 1",
385 goaway($a->get_baseurl() . '/' . $_SESSION['photo_return']);
386 return; // NOTREACHED
390 return; // NOTREACHED
396 function photos_content(&$a) {
400 // photos/name/upload
401 // photos/name/album/xxxxx
402 // photos/name/album/xxxxx/edit
403 // photos/name/image/xxxxx
404 // photos/name/image/xxxxx/edit
407 if(! x($a->data,'user')) {
408 notice( t('No photos selected') . EOL );
412 $_SESSION['photo_return'] = $a->cmd;
419 $datatype = $a->argv[2];
420 $datum = $a->argv[3];
422 elseif(($a->argc > 2) && ($a->argv[2] == 'upload'))
423 $datatype = 'upload';
425 $datatype = 'summary';
433 // Setup permissions structures
436 $owner_uid = $a->data['user']['uid'];
439 $contact_id = $_SESSION['visitor_id'];
440 $groups = init_groups_visitor($contact_id);
443 // default permissions - anonymous user
445 $sql_extra = " AND `allow_cid` = '' AND `allow_gid` = '' AND `deny_cid` = '' AND `deny_gid` = '' ";
447 // Profile owner - everything is visible
449 if(local_user() && (get_uid() == $owner_uid)) {
452 elseif(remote_user()) {
453 // authenticated visitor - here lie dragons
454 $gs = '<<>>'; // should be impossible to match
456 foreach($groups as $g)
457 $gs .= '|<' . intval($g) . '>';
459 $sql_extra = sprintf(
460 " AND ( `allow_cid` = '' OR `allow_cid` REGEXP '<%d>' )
461 AND ( `deny_cid` = '' OR NOT `deny_cid` REGEXP '<%d>' )
462 AND ( `allow_gid` = '' OR `allow_gid` REGEXP '%s' )
463 AND ( `deny_gid` = '' OR NOT `deny_gid` REGEXP '%s') ",
465 intval($_SESSION['visitor_id']),
466 intval($_SESSION['visitor_id']),
477 if($datatype == 'upload') {
478 if( ! (local_user() && (get_uid() == $a->data['user']['uid']))) {
479 notice( t('Permission denied.'));
482 $albumselect = '<select id="photos-upload-album-select" name="album" size="4">';
484 $albumselect .= '<option value="" selected="selected" > </option>';
485 if(count($a->data['albums'])) {
486 foreach($a->data['albums'] as $album) {
487 if(($album['album'] == '') || ($album['album'] == t('Contact Photos')))
489 $albumselect .= '<option value="' . $album['album'] . '">' . $album['album'] . '</option>';
492 $albumselect .= '</select>';
493 $tpl = file_get_contents('view/photos_upload.tpl');
494 $o .= replace_macros($tpl,array(
495 '$pagename' => t('Upload Photos'),
496 '$sessid' => session_id(),
497 '$newalbum' => t('New album name: '),
498 '$existalbumtext' => t('or existing album name: '),
499 '$filestext' => t('Select files to upload: '),
500 '$albumselect' => $albumselect,
501 '$permissions' => t('Permissions'),
502 '$aclselect' => populate_acl($a->user),
503 '$archive' => $a->get_baseurl() . '/jumploader_z.jar',
504 '$nojava' => t('Use the following controls only if the Java uploader (above) fails to launch.'),
505 '$uploadurl' => $a->get_baseurl() . '/photos',
506 '$submit' => t('Submit')
513 if($datatype == 'album') {
515 $album = hex2bin($datum);
517 $r = q("SELECT `resource-id`, max(`scale`) AS `scale` FROM `photo` WHERE `uid` = %d AND `album` = '%s'
518 $sql_extra GROUP BY `resource-id`",
519 intval($a->data['user']['uid']),
523 $a->set_pager_total(count($r));
526 $r = q("SELECT `resource-id`, max(`scale`) AS `scale` FROM `photo` WHERE `uid` = %d AND `album` = '%s'
527 $sql_extra GROUP BY `resource-id` ORDER BY `created` DESC LIMIT %d , %d",
528 intval($a->data['user']['uid']),
530 intval($a->pager['start']),
531 intval($a->pager['itemspage'])
534 $o .= '<h3>' . $album . '</h3>';
537 if(($album != t('Profile Photos')) && ($album != t('Contact Photos'))) {
538 if(local_user() && (get_uid() == $a->data['user']['uid'])) {
539 $edit_tpl = file_get_contents('view/album_edit.tpl');
540 $o .= replace_macros($edit_tpl,array(
541 '$nametext' => t('New album name: '),
543 '$hexalbum' => bin2hex($album),
544 '$submit' => t('Submit'),
545 '$dropsubmit' => t('Delete Album')
551 if(($album != t('Profile Photos')) && ($album != t('Contact Photos'))) {
552 if(local_user() && (get_uid() == $a->data['user']['uid'])) {
553 $o .= '<div id="album-edit-link"><a href="'. $a->get_baseurl() . '/photos/'
554 . $a->data['user']['nickname'] . '/album/' . bin2hex($album) . '/edit' . '">'
555 . t('Edit Album') . '</a></div>';
559 $tpl = file_get_contents('view/photo_album.tpl');
562 $o .= replace_macros($tpl,array(
564 '$photolink' => $a->get_baseurl() . '/photos/' . $a->data['user']['nickname'] . '/image/' . $rr['resource-id'],
565 '$phototitle' => t('View Photo'),
566 '$imgsrc' => $a->get_baseurl() . '/photo/' . $rr['resource-id'] . '-' . $rr['scale'] . '.jpg',
567 '$imgalt' => $rr['filename']
571 $o .= '<div id="photo-album-end"></div>';
577 if($datatype == 'image') {
579 require_once('security.php');
580 require_once('bbcode.php');
582 // fetch image, item containing image, then comments
584 $ph = q("SELECT * FROM `photo` WHERE `uid` = %d AND `resource-id` = '%s'
585 $sql_extra ORDER BY `scale` ASC ",
586 intval($a->data['user']['uid']),
591 notice( t('Photo not available') . EOL );
596 $hires = $lores = $ph[0];
598 if($ph[1]['scale'] == 2) {
599 // original is 640 or less, we can display it directly
600 $hires = $lores = $ph[0];
609 $o .= '<h3>' . '<a href="' . $a->get_baseurl() . '/photos/' . $a->data['user']['nickname'] . '/album/' . bin2hex($ph[0]['album']) . '">' . $ph[0]['album'] . '</a></h3>';
611 if(local_user() && ($ph[0]['uid'] == get_uid())) {
612 $o .= '<div id="photo-edit-link-wrap" ><a id="photo-edit-link" href="' . $a->get_baseurl() . '/photos/' . $a->data['user']['nickname'] . '/image/' . $datum . '/edit' . '">' . t('Edit photo') . '</a></div>';
616 $o .= '<a href="' . $a->get_baseurl() . '/photo/'
617 . $hires['resource-id'] . '-' . $hires['scale'] . '.jpg" title="'
618 . t('View Full Size') . '" ><img src="' . $a->get_baseurl() . '/photo/'
619 . $lores['resource-id'] . '-' . $lores['scale'] . '.jpg' . '" /></a>';
622 // Do we have an item for this photo?
624 $i1 = q("SELECT * FROM `item` WHERE `resource-id` = '%s' $sql_extra LIMIT 1",
629 $r = q("SELECT COUNT(*) AS `total`
630 FROM `item` LEFT JOIN `contact` ON `contact`.`id` = `item`.`contact-id`
631 WHERE `parent-uri` = '%s' AND `uri` != '%s' AND `item`.`deleted` = 0
632 AND NOT `item`.`type` IN ( 'remote', 'net-comment')
633 AND `contact`.`blocked` = 0 AND `contact`.`pending` = 0
635 dbesc($i1[0]['uri']),
641 $a->set_pager_total($r[0]['total']);
644 $r = q("SELECT `item`.*, `item`.`id` AS `item_id`,
645 `contact`.`name`, `contact`.`photo`, `contact`.`url`,
646 `contact`.`thumb`, `contact`.`dfrn-id`, `contact`.`self`,
647 `contact`.`id` AS `cid`, `contact`.`uid` AS `contact-uid`
648 FROM `item` LEFT JOIN `contact` ON `contact`.`id` = `item`.`contact-id`
649 WHERE `parent-uri` = '%s' AND `uri` != '%s' AND `item`.`deleted` = 0
650 AND NOT `item`.`type` IN ( 'remote', 'net-comment')
651 AND `contact`.`blocked` = 0 AND `contact`.`pending` = 0
653 ORDER BY `parent` DESC, `id` ASC LIMIT %d ,%d ",
654 dbesc($i1[0]['uri']),
655 dbesc($i1[0]['uri']),
656 intval($a->pager['start']),
657 intval($a->pager['itemspage'])
662 $o .= '<div id="photo-caption" >' . $ph[0]['desc'] . '</div>';
664 if(count($i1) && strlen($i1[0]['tag'])) {
665 // parse tags and add links
666 $o .= '<div id="in-this-photo-text">' . t('In this photo: ') . '</div>';
667 $o .= '<div id="in-this-photo">' . $i1[0]['tag'] . '</div>';
671 $edit_tpl = file_get_contents('view/photo_edit.tpl');
672 $o .= replace_macros($edit_tpl, array(
673 '$id' => $ph[0]['id'],
674 '$resource_id' => $ph[0]['resource-id'],
675 '$capt_label' => t('Caption'),
676 '$caption' => $ph[0]['desc'],
677 '$tag_label' => t('Tags'),
678 '$tags' => $i1[0]['tag'],
679 '$item_id' => ((count($i1)) ? $i1[0]['id'] : 0),
680 '$submit' => t('Submit'),
681 '$delete' => t('Delete Photo')
687 // pull out how many people like the photo
689 $cmnt_tpl = file_get_contents('view/comment_item.tpl');
690 $tpl = file_get_contents('view/photo_item.tpl');
691 $return_url = $a->cmd;
693 if(can_write_wall($a,$a->data['user']['uid'])) {
694 if($i1[0]['last-child']) {
695 $o .= replace_macros($cmnt_tpl,array(
696 '$return_path' => $return_url,
697 '$type' => 'wall-comment',
698 '$id' => $i1[0]['id'],
699 '$parent' => $i1[0]['id'],
700 '$profile_uid' => $a->data['user']['uid'],
709 foreach($r as $item) {
713 $redirect_url = $a->get_baseurl() . '/redir/' . $item['cid'] ;
715 if(can_write_wall($a,$a->data['user']['uid'])) {
716 if($item['last-child']) {
717 $comment = replace_macros($cmnt_tpl,array(
718 '$return_path' => $return_url,
719 '$type' => 'wall-comment',
720 '$id' => $item['item_id'],
721 '$parent' => $item['parent'],
722 '$profile_uid' => $a->data['user']['uid'],
728 $profile_url = $item['url'];
730 if(local_user() && ($item['contact-uid'] == get_uid())
731 && ($item['rel'] == DIRECTION_IN || $item['rel'] == DIRECTION_BOTH) && (! $item['self'] ))
732 $profile_url = $redirect_url;
734 $profile_name = ((strlen($item['author-name'])) ? $item['author-name'] : $item['name']);
735 $profile_avatar = ((strlen($item['author-avatar'])) ? $item['author-avatar'] : $item['thumb']);
736 $profile_link = $profile_url;
740 if(($item['contact-id'] == $_SESSION['visitor_id']) || ($item['uid'] == get_uid()))
741 $drop = replace_macros(file_get_contents('view/wall_item_drop.tpl'), array('$id' => $item['id']));
744 $o .= replace_macros($template,array(
745 '$id' => $item['item_id'],
746 '$profile_url' => $profile_link,
747 '$name' => $profile_name,
748 '$thumb' => $profile_avatar,
749 '$title' => $item['title'],
750 '$body' => bbcode($item['body']),
751 '$ago' => relative_date($item['created']),
752 '$indent' => (($item['parent'] != $item['item_id']) ? ' comment' : ''),
754 '$comment' => $comment
764 // Default - show recent photos with upload link (if applicable)
766 $r = q("SELECT `resource-id`, max(`scale`) AS `scale` FROM `photo` WHERE `uid` = %d AND `album` != '%s'
767 $sql_extra GROUP BY `resource-id`",
768 intval($a->data['user']['uid']),
769 dbesc( t('Contact Photos'))
772 $a->set_pager_total(count($r));
775 $r = q("SELECT `resource-id`, `album`, max(`scale`) AS `scale` FROM `photo` WHERE `uid` = %d AND `album` != '%s'
776 $sql_extra GROUP BY `resource-id` ORDER BY `created` DESC LIMIT %d , %d",
777 intval($a->data['user']['uid']),
778 dbesc( t('Contact Photos')),
779 intval($a->pager['start']),
780 intval($a->pager['itemspage'])
783 $o .= '<h3>' . t('Recent Photos') . '</h3>';
785 if( local_user() && (get_uid() == $a->data['user']['uid'])) {
786 $o .= '<div id="photo-top-links"><a id="photo-top-upload-link" href="'. $a->get_baseurl() . '/photos/'
787 . $a->data['user']['nickname'] . '/upload' . '">' . t('Upload New Photos') . '</a></div>';
790 $tpl = file_get_contents('view/photo_top.tpl');
793 $o .= replace_macros($tpl,array(
795 '$photolink' => $a->get_baseurl() . '/photos/' . $a->data['user']['nickname']
796 . '/image/' . $rr['resource-id'],
797 '$phototitle' => t('View Photo'),
798 '$imgsrc' => $a->get_baseurl() . '/photo/'
799 . $rr['resource-id'] . '-' . $rr['scale'] . '.jpg',
800 '$albumlink' => $a->get_baseurl . '/photos/'
801 . $a->data['user']['nickname'] . '/album/' . bin2hex($rr['album']),
802 '$albumname' => $rr['album'],
803 '$albumalt' => t('View Album'),
804 '$imgalt' => $rr['filename']
808 $o .= '<div id="photo-top-end"></div>';