okapi r777: added gpx thumbnail images option
This commit is contained in:
@ -799,7 +799,7 @@ class Okapi
|
||||
{
|
||||
public static $data_store;
|
||||
public static $server;
|
||||
public static $revision = 769; # This gets replaced in automatically deployed packages
|
||||
public static $revision = 777; # This gets replaced in automatically deployed packages
|
||||
private static $okapi_vars = null;
|
||||
|
||||
/** Get a variable stored in okapi_vars. If variable not found, return $default. */
|
||||
|
@ -87,7 +87,7 @@ class WebService
|
||||
|
||||
$images = $request->get_parameter('images');
|
||||
if (!$images) $images = 'descrefs:nonspoilers';
|
||||
if (!in_array($images, array('none', 'descrefs:nonspoilers', 'descrefs:all', 'ox:all')))
|
||||
if (!in_array($images, array('none', 'descrefs:thumblinks', 'descrefs:nonspoilers', 'descrefs:all', 'ox:all')))
|
||||
throw new InvalidParam('images', "'$images'");
|
||||
$vars['images'] = $images;
|
||||
|
||||
|
@ -51,14 +51,20 @@
|
||||
<p>Which images to include (and how to include them). One of the following values:</p>
|
||||
<ul>
|
||||
<li><b>none</b> - no images will be included,</li>
|
||||
<li><b>descrefs:thumblinks</b> - all images will be included as "thumbnail"
|
||||
<img> references at the end of each cache description, with a
|
||||
replacement image used for spoilers; the thumbnails are linked to the
|
||||
large images,</li>
|
||||
<li><b>descrefs:nonspoilers</b> - all non-spoiler images will be included
|
||||
as <img> references at the end of each cache description,</li>
|
||||
as <img> references at the end of each cache description,</li>
|
||||
<li><b>descrefs:all</b> - all images will be included (including spoilers)
|
||||
as <img> references at the end of each cache description,</li>
|
||||
as <img> references at the end of each cache description,</li>
|
||||
<li><b>ox:all</b> - all images will be included (including spoilers)
|
||||
as Garmin's <ox:image> references.</li>
|
||||
as Garmin's <ox:image> references.</li>
|
||||
</ul>
|
||||
<p>Note: When using "descrefs:" mode, remember to set <b>ns_ground</b> to <b>true</b>.</p>
|
||||
<p>Note: When using "descrefs:" mode, remember to set <b>ns_ground</b> to <b>true</b>.
|
||||
The default value is "descrefs:nonspoilers" for compatibilty reasons, but for
|
||||
most applications "descrefs:thumblinks" will be the better choice.</p>
|
||||
<p>Note: When using "ox:" mode, remember to set <b>ns_ox</b> to <b>true</b>. You must also
|
||||
include JPEG files along the GPX for this to work properly - see
|
||||
services/caches/formatters/garmin for more information.</p>
|
||||
|
@ -71,27 +71,36 @@ http://www.gsak.net/xmlv1/5 http://www.gsak.net/xmlv1/5/gsak.xsd
|
||||
</ul>
|
||||
<? } ?>
|
||||
<?= Okapi::xmlescape($c['description']) ?>
|
||||
<? if ((strpos($vars['images'], "descrefs:") === 0) && count($c['images']) > 0) { /* Does user want us to include <img> references in cache descriptions? */ ?>
|
||||
<?
|
||||
<? if ((strpos($vars['images'], "descrefs:") === 0) && count($c['images']) > 0) { /* Does user want us to include <img> references in cache descriptions? */
|
||||
if ($vars['images'] == "descrefs:thumblinks") { ?>
|
||||
<h2><?= _("Images") ?> (<?= count($c['images']) ?>)</h2>
|
||||
<div>
|
||||
<? foreach ($c['images'] as $img) { ?>
|
||||
<div style='float:left; padding:6px'><a href='<?= Okapi::xmlescape($img['url']) ?>'><img src='<?= Okapi::xmlescape($img['thumb_url']) ?>'></a><br>
|
||||
<?= Okapi::xmlescape($img['caption']) ?></div>
|
||||
<? } ?>
|
||||
</div>
|
||||
<? } else {
|
||||
# We will split images into two subcategories: spoilers and nonspoilers.
|
||||
$spoilers = array();
|
||||
$nonspoilers = array();
|
||||
foreach ($c['images'] as $img)
|
||||
if ($img['is_spoiler']) $spoilers[] = $img;
|
||||
else $nonspoilers[] = $img;
|
||||
?>
|
||||
<? if (count($nonspoilers) > 0) { ?>
|
||||
<h2><?= _("Images") ?> (<?= count($nonspoilers) ?>)</h2>
|
||||
<? foreach ($nonspoilers as $img) { ?>
|
||||
<p><img src='<?= Okapi::xmlescape($img['url']) ?>'><br>
|
||||
<?= Okapi::xmlescape($img['caption']) ?></p>
|
||||
?>
|
||||
<? if (count($nonspoilers) > 0) { ?>
|
||||
<h2><?= _("Images") ?> (<?= count($nonspoilers) ?>)</h2>
|
||||
<? foreach ($nonspoilers as $img) { ?>
|
||||
<p><img src='<?= Okapi::xmlescape($img['url']) ?>'><br>
|
||||
<?= Okapi::xmlescape($img['caption']) ?></p>
|
||||
<? } ?>
|
||||
<? } ?>
|
||||
<? } ?>
|
||||
<? if (count($spoilers) > 0 && $vars['images'] == 'descrefs:all') { ?>
|
||||
<h2><?= _("Spoilers") ?> (<?= count($spoilers) ?>)</h2>
|
||||
<? foreach ($spoilers as $img) { ?>
|
||||
<p><img src='<?= Okapi::xmlescape($img['url']) ?>'><br>
|
||||
<?= Okapi::xmlescape($img['caption']) ?></p>
|
||||
<? if (count($spoilers) > 0 && $vars['images'] == 'descrefs:all') { ?>
|
||||
<h2><?= _("Spoilers") ?> (<?= count($spoilers) ?>)</h2>
|
||||
<? foreach ($spoilers as $img) { ?>
|
||||
<p><img src='<?= Okapi::xmlescape($img['url']) ?>'><br>
|
||||
<?= Okapi::xmlescape($img['caption']) ?></p>
|
||||
<? } ?>
|
||||
<? } ?>
|
||||
<? } ?>
|
||||
<? } ?>
|
||||
|
@ -118,7 +118,8 @@
|
||||
<li>
|
||||
<p><b>willattends</b> - in case of Event Caches, this is the number of
|
||||
"Will attend" log entries. In case of any other cache type, it will
|
||||
be <b>null</b></p>
|
||||
be <b>zero</b> (not null, for <a href='https://code.google.com/p/opencaching-api/issues/detail?id=233'>backward
|
||||
compatibility</a>),</p>
|
||||
</li>
|
||||
<li class='deprecated'>
|
||||
<b>size</b> - deprecated
|
||||
|
Reference in New Issue
Block a user