/** * Get image data */ public function process_image_data($result) { $mc = RMUtilities::module_config('galleries'); $users = array(); $ret = array(); $tf = new RMTimeFormatter(0, "%M%/%d%/%Y%"); $db = Database::getInstance(); $i = 0; while ($row = $db->fetchArray($result)) { $img = new GSImage(); $img->assignVars($row); if (!isset($users[$img->owner()])) { $users[$img->owner()] = new GSUser($img->owner(), 1); } $imglink = $users[$img->owner()]->userURL() . ($mc['urlmode'] ? 'img/' . $img->id() . '/' : '&img=' . $img->id()); $ret[$i] = array('id' => $img->id(), 'title' => $img->title(), 'thumbnail' => $users[$img->owner()]->filesURL() . '/ths/' . $img->image(), 'thumbuser' => $users[$img->owner()]->filesURL() . '/' . ($mc['user_format_mode'] ? 'formats/user_' : 'ths/') . $img->image(), 'thumbsrh' => $users[$img->owner()]->filesURL() . '/' . ($mc['search_format_mode'] ? 'formats/srh_' : 'ths/') . $img->image(), 'image' => $users[$img->owner()]->filesURL() . '/' . $img->image(), 'by' => sprintf(__('by %s', 'galleries'), '<a href="' . $users[$img->owner()]->userUrl() . '">' . $users[$img->owner()]->uname() . '</a>'), 'link' => $imglink, 'created' => $tf->format($img->created()), 'public' => $img->isPublic(), 'desc' => $img->desc()); // Format resize if (!$img->userFormat() && $mc['user_format_mode']) { $format = $mc['user_format_values']; GSFunctions::resizeImage($format[0], $users[$img->owner()]->filesPath() . '/' . $img->image(), $users[$img->owner()]->filesPath() . '/formats/user_' . $img->image(), $format[1], $format[2]); $img->setUserFormat(1, 1); } if (!$img->searchFormat() && $mc['search_format_mode']) { $format = $mc['search_format_values']; GSFunctions::resizeImage($format[0], $users[$img->owner()]->filesPath() . '/' . $img->image(), $users[$img->owner()]->filesPath() . '/formats/srh_' . $img->image(), $format[1], $format[2]); $img->setSearchFormat(1, 1); } if ($mc['search_format_mode']) { $ret[$i]['viewmore'] = sprintf(__('Ver <a href="%s">más fotos</a>.', 'galleries'), $users[$img->owner()]->userURL()); $ret[$i]['avatar'] = RMEvents::get()->run_event('rmcommon.get.avatar', $users[$img->owner()]->userVar('email'), 0, $users[$img->owner()]->userVar('user_avatar')); $tags = $img->tags(true); $tagurl = self::get_url() . ($mc['urlmode'] ? 'explore/tags/tag/' : '?explore=tags&tag='); $strtag = ''; foreach ($tags as $tag) { $strtag .= $strtag == '' ? "<a href=\"{$tagurl}" . $tag->getVar('nameid') . "\">" . $tag->tag() . "</a>" : ", <a href=\"{$tagurl}" . $tag->getVar('nameid') . "\">" . $tag->tag() . "</a>"; } $ret[$i]['tags'] = $strtag; } $i++; } RMTemplate::get()->add_local_script('photos.js', 'galleries'); if (!$mc['quickview']) { return $ret; } if (RMFunctions::plugin_installed('lightbox')) { RMLightbox::get()->add_element('.pic_qview a'); RMLightbox::get()->render(); } return $ret; }