Hello,
I’ve probably discovered a bug in the toJSON function. Maybe I’m just doing something wrong but what I’m trying to accomplish does not work. It’s hard to explain by words, so I made a short video. I’m using the rc3 of Revo.
http://downloads.josefbrandl.com/posts/2010-08-19/jsonbug.mov 10MB
[Edit:]
I’ve tested it with php’s json_encode and it doesn’t work either. Here’s my code:
<?php
$settings = array(
'parentId' => 31,
'thumbWidth' => 110,
'thumbHeight' => 110,
'thumbSpacingX' => 12,
'thumbSpacingY' => 12,
'thumbBorder' => 3,
'bigWidth' => 1024,
'bigHeight' => 1024,
);
$modx->regClientStartupScript('http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js');
$modx->regClientStartupScript('http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.4/jquery-ui.min.js');
$modx->regClientStartupScript('assets/components/ggViewer/ggViewer.js');
include_once ($modx->getOption('core_path') . "components/gallerygear/gallerygear.class.php");
$gg = new GalleryGear();
$data['settings'] = $settings;
foreach($gg->getPhotos($settings['parentId']) as $photo) {
$thumb = $photo->setResizedPhoto('crop', $settings['thumbWidth'], $settings['thumbHeight']);
$big = $photo->setResizedPhoto('fullShrinkOnly', $settings['bigWidth'], $settings['bigHeight']);
$data['photos'][] = array(
$thumb->getWebURL(),
$big->getWebURL()
);
}
return '<ul class="ggViewer">' . json_encode($data) . '</ul>';
?>
My workaround was simply to define some keys. But I still don’t understand why it doesn’t work.
thanks
JB