Skip to content

Commit

Permalink
https://github.com/open768/curiosity_browser/issues/117
Browse files Browse the repository at this point in the history
  • Loading branch information
sunil committed Oct 10, 2024
1 parent 55c1b68 commit c25e57e
Show file tree
Hide file tree
Showing 4 changed files with 37 additions and 11 deletions.
25 changes: 16 additions & 9 deletions js/pages/solmosaic.js
Original file line number Diff line number Diff line change
Expand Up @@ -68,17 +68,24 @@ class cSolMosaic {
static onMosaicResponse(poHttp) {
var oDiv = cJquery.element(cSolMosaicPageConstants.MOSAIC_ID)
oDiv.empty()
oDiv.append('i Got something')
}

static onClickMosaicButton() {
const oParams = {}
{
oParams[cSpaceUrlParams.SOL] = this.current_sol
oParams[cSpaceUrlParams.MISSION] = cMission.ID
const oData = poHttp.response
if (oData.mos == null) {
oDiv.append(cRender.messagebox('unable to create highlight'))
return
}
const sUrl = cBrowser.buildUrl('solmosaic.php', oParams)
cBrowser.openWindow(sUrl, 'solmosaic')

const sImgUrl = cBrowser.buildUrl(cAppLocations.mosaicer, oData)
const oImg = $('<img>', { src: sImgUrl, class: 'image' })
const oThis = this
oImg.click(() => oThis.onClickMosaic(oData))
oDiv.append(oImg)
}

//***************************************************************
static onClickMosaic(poData) {
const sUrl = cBrowser.buildUrl('solhigh.php', { s: poData[cSpaceUrlParams.SOL] })
cBrowser.openWindow(sUrl, 'index')
}

//***************************************************************
Expand Down
2 changes: 2 additions & 0 deletions php/app-config/app-config.php
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ class cAppLocations {
static $cropper = null;
static $images = null;
static $appconfig = null;
static $mosaicer = null;

static function init() {
global $home;
Expand All @@ -76,6 +77,7 @@ static function init() {
self::$thumbnailer = cAppGlobals::$jsThumbNailer;
self::$images = cAppGlobals::$jsImages;
self::$cropper = cAppGlobals::$jsCropper;
self::$mosaicer = cAppGlobals::$jsMosaicer;
self::$appconfig = "$home/php/app-config/app-config.php";
}
}
Expand Down
15 changes: 15 additions & 0 deletions php/images/mosaicer.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<?php
$home = "../..";
require_once "$home/php/fragments/app-common.php";
require_once cAppGlobals::$ckPhpInc . "/image.php";

$sKey = cHeader::get(cAppUrlParams::MOSAIC_PARAM, true);
try {
$oBlob = cMosaicer::get($sKey);
$sMime = $oBlob->mime_type;

header("Content-Type: $sMime");
echo $oBlob->blob;
} catch (Exception $e) {
cHeader::redirect(cAppLocations::$images . "/browser/nothumb.png");
}
6 changes: 4 additions & 2 deletions php/rest/solmosaic.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,15 @@
$sSol = cHeader::get(cSpaceUrlParams::SOL, true, true);
$sMission = cHeader::get(cSpaceUrlParams::MISSION, true);
$oResult = cSpaceImageMosaic::get_sol_high_mosaic($sSol);

$sKey = null;
if ($oResult !== null) $sKey = $oResult->key;
cDebug::vardump($oResult);

//############################### response ####################
include cAppGlobals::$appPhpFragments . "/rest_header.php";
$aOut = []; {
$aOut[cSpaceUrlParams::SOL] = $sSol;
$aOut[cSpaceUrlParams::MISSION] = $sMission;
$aOut[cAppUrlParams::MOSAIC_PARAM] = $oResult->key;
$aOut[cAppUrlParams::MOSAIC_PARAM] = $sKey;
}
cCommon::write_json((object)$aOut);

0 comments on commit c25e57e

Please sign in to comment.