function handlePhoto() { $gridimage_id = intval($this->params[0]); $_GET['key'] = $this->params[1]; $image = new GridImage(); if ($image->loadFromId($gridimage_id, 1)) { #FIXME title1,title2,comment1,comment2 if ($image->moderation_status == 'geograph' || $image->moderation_status == 'accepted') { $this->beginResponse(); if ($this->output == 'json') { require_once '3rdparty/JSON.php'; $json = new Services_JSON(); $obj = new EmptyClass(); $obj->title = $image->title; $obj->grid_reference = $image->grid_reference; $obj->profile_link = $image->profile_link; $obj->realname = $image->realname; $details = $image->getThumbnail(120, 120, 2); $obj->imgserver = $details['server']; $obj->thumbnail = $details['url']; $obj->image = $image->_getFullpath(); $obj->sizeinfo = $image->_getFullSize(); $obj->sizeinfo[3] = "0"; $obj->taken = $image->imagetaken; $obj->submitted = strtotime($image->submitted); $obj->category = $image->category; $obj->comment = $image->comment; $obj->wgs84_lat = $image->wgs84_lat; $obj->wgs84_long = $image->wgs84_long; print $json->encode($obj); } else { echo '<status state="ok"/>'; echo '<title>' . xmlentities($image->title) . '</title>'; echo '<gridref>' . htmlentities($image->grid_reference) . '</gridref>'; echo "<user profile=\"http://{$_SERVER['HTTP_HOST']}{$image->profile_link}\">" . xmlentities($image->realname) . '</user>'; echo preg_replace('/alt=".*?" /', '', $image->getFull()); $details = $image->getThumbnail(120, 120, 2); echo '<thumbnail>' . $details['server'] . $details['url'] . '</thumbnail>'; echo '<taken>' . htmlentities($image->imagetaken) . '</taken>'; echo '<submitted>' . htmlentities($image->submitted) . '</submitted>'; echo '<category>' . xmlentities($image->imageclass) . '</category>'; echo '<comment><![CDATA[' . xmlentities($image->comment) . ']]></comment>'; $size = $image->_getFullSize(); //uses cached_size if (!empty($size[4])) { echo "<original width=\"{$size[4]}\" height=\"{$size[5]}\"/>"; } } $this->endResponse(); } else { $this->error("Image {$gridimage_id} unavailable ({$image->moderation_status})"); } } else { $this->error("Invalid image id {$gridimage_id}"); } }
require_once 'geograph/gridimage.class.php'; $image = new GridImage(); $ok = $image->loadFromId($_REQUEST['id']); if (!$ok || $image->moderation_status == 'rejected') { //clear the image $image = new GridImage(); header("HTTP/1.0 410 Gone"); header("Status: 410 Gone"); $template = "static_404.tpl"; } else { $image->altUrl = $image->_getOriginalpath(true, false, '_640x640'); $image->originalUrl = $image->_getOriginalpath(true, false); $image->originalSize = filesize($_SERVER['DOCUMENT_ROOT'] . $image->originalUrl); $style = $USER->getStyle(); $smarty->assign('maincontentclass', 'content_photo' . $style); $imagesize = $image->_getFullSize(); $sizes = array(); $widths = array(); $heights = array(); $showorig = false; if ($image->original_width) { $smarty->assign('original_width', $image->original_width); $smarty->assign('original_height', $image->original_height); $uploadmanager = new UploadManager(); list($destwidth, $destheight, $maxdim, $changedim) = $uploadmanager->_new_size($image->original_width, $image->original_height); if ($changedim) { $showorig = true; foreach ($CONF['show_sizes'] as $cursize) { list($destwidth, $destheight, $destdim, $changedim) = $uploadmanager->_new_size($image->original_width, $image->original_height, $cursize); if (!$changedim) { break;