Simpleviewer module

alecmyers

Joined: 2006-08-01
Posts: 4342
Posted: Thu, 2009-02-12 16:33

URL-encoding the & can't "break your gallery2 installation" because it's not *in* gallery that you url-encode it. You need to use "%26" in the javascript in your webpage, not the bare & character. If you link directly to the URL in your browser to test it you need to un-encode it and use the & char again; I've tested the corrected version of your link and the module's working correctly:
http://galerie.cvjm-nuernberg.de/main.php?g2_view=simpleviewersource.XMLOut&g2_itemId=119

If you correct the syntax in your HTML/javascript and url-encode (as instructed) then it will work.

 
habakuk

Joined: 2006-03-24
Posts: 28
Posted: Thu, 2009-02-12 20:58

Thanks for your reply.

I tried it again with

Quote:
<script type="text/javascript">
var fo = new SWFObject("viewer.swf", "viewer", "100%", "100%", "8", "#181818");
fo.addVariable("xmlDataPath", "http://galerie.cvjm-nuernberg.de/main.php?g2_view=simpleviewersource.XMLOut%26g2_itemId=119");
fo.write("flashcontent");
</script>

But I still get the error "Gallery not found".

I am not completely mistaken, then the the url-encoded version of the url should work exactly the same way as the not encoded. But with http://galerie.cvjm-nuernberg.de/main.php?g2_view=simpleviewersource.XMLOut%26g2_itemId=119 I get an error message of my gallery2:

Quote:
Error (ERROR_BAD_PARAMETER) : simpleviewersource.XMLOut&amp;g2_itemId=119 can't be parsed
* in modules/core/classes/GalleryView.class at line 149 (GalleryCoreApi::error)
* in main.php at line 325 (GalleryView::loadView)
* in main.php at line 104
* in main.php at line 88
* in main.php at line 3

Ciao!
Stefan

 
alecmyers

Joined: 2006-08-01
Posts: 4342
Posted: Thu, 2009-02-12 21:04
Quote:
the url-encoded version of the url should work exactly the same way as the not encoded

Not true; your supposition fails by demonstration. But I think that's irrelevant, actually.

Send me the url (by pm if you prefer) of the simpleviewer page which is giving the error.

 
habakuk

Joined: 2006-03-24
Posts: 28
Posted: Thu, 2009-02-12 21:17

Thanks again.

My testsite is here: http://www.kunstrasenfestival.de/imagetest.html

Ciao!
Stefan

 
alecmyers

Joined: 2006-08-01
Posts: 4342
Posted: Thu, 2009-02-12 21:32

Looks like you're falling foul of Adobe's cross domain xml security policy: the simpleviewer code is being loaded from one domain and the xml source is in another. See this post and the ones following for appropriate advice:
http://gallery.menalto.com/node/85127#comment-298860

Actually ignore that link, just go here:
http://kb.adobe.com/selfservice/viewContent.do?externalId=tn_14213

 
habakuk

Joined: 2006-03-24
Posts: 28
Posted: Thu, 2009-02-12 21:47

Thank you very much! It works now - with a little php skript:

Quote:
<?php

$data=file_get_contents("http://galerie.cvjm-nuernberg.de/main.php?g2_view=simpleviewersource.XMLOut&g2_itemId=119");

// now return the XML for SimpleViewer
header("Content-Type: text/xml");
print $data;
exit;
?>

Ciao!
Stefan

 
alecmyers

Joined: 2006-08-01
Posts: 4342
Posted: Thu, 2009-02-12 21:51

I don't understand why you'd rather install a php hack (that only works for one album) instead of putting a crossdomain.xml policy file in the right place. But hey, whatever works for you.

 
habakuk

Joined: 2006-03-24
Posts: 28
Posted: Thu, 2009-02-12 21:55

Because I didn't read it to the end...

It works with crossdomain.xml, too.

Ciao!
Stefan

 
brewster1134

Joined: 2009-02-11
Posts: 29
Posted: Thu, 2009-02-12 23:02

Is it possible to show the item description from gallery2 as the caption like on the simpleviewer low res demo?
http://www.airtightinteractive.com/simpleviewer/examples/lores/

 
alecmyers

Joined: 2006-08-01
Posts: 4342
Posted: Thu, 2009-02-12 23:08

Instead of the item filename?

try changing from line 128 of XMLOut.inc from

                $myFilename = $myItem->getTitle();
	    	echo ("<image><filename>$myItemId</filename><caption>$myFilename</caption></image>\n");

to

                $myDescription = $myItem->getDescription();
	    	echo ("<image><filename>$myItemId</filename><caption>$myDescription</caption></image>\n");
 
brewster1134

Joined: 2009-02-11
Posts: 29
Posted: Fri, 2009-02-13 03:36

perfect! well...almost perfect...
it makes the line breaks into 2 line breaks...do you know a simple way to make that display correctly?

btw....im super impressed with how quick and accurate you are! TY!

 
alecmyers

Joined: 2006-08-01
Posts: 4342
Posted: Fri, 2009-02-13 09:33
Quote:
it makes the line breaks into 2 line breaks

Post an example please.

 
brewster1134

Joined: 2009-02-11
Posts: 29
Posted: Fri, 2009-02-13 17:50

so from the description field, i have:
line 1
line 2

but it renders in the slide show with an extra line break:
line 1

line 2

 
alecmyers

Joined: 2006-08-01
Posts: 4342
Posted: Fri, 2009-02-13 18:06

I mean, post a screen shot.

To be frank, I'm not really sure this is a real problem. Couldn't it just be the line spacing of the text in simpleviewer? Nobody is adding extra line breaks anywhere.

 
brewster1134

Joined: 2009-02-11
Posts: 29
Posted: Fri, 2009-02-13 18:45

in XMLOut.inc:

$myDescription = $myItem->getDescription();
echo ("<image><filename>$myItemId</filename><caption>$myDescription</caption></image>\n");

edit photo page:
[img]http://kylehittmeier.com/editPhoto.jpg[/img]

simpleviewer:
[img]http://kylehittmeier.com/simpleviewer.jpg[/img]

 
alecmyers

Joined: 2006-08-01
Posts: 4342
Posted: Fri, 2009-02-13 18:53

Have a look in your database with phpMyAdmin and see what the description field actually contains. There's a lot of (potential) different formats, with different line endings like <br> and "\n\r" and stuff.

If you can figure out that it is in fact an extra line then you could reformat the string inbetween the two lines of XMLOut.inc that you modified; php's got lots of string formatting functions that might help.

 
brewster1134

Joined: 2009-02-11
Posts: 29
Posted: Fri, 2009-02-13 19:04

in the DB, i dont see any line endings....
it just shows:
Oil on Canvas
48&quot; x 36&quot;

 
alecmyers

Joined: 2006-08-01
Posts: 4342
Posted: Fri, 2009-02-13 19:17

Play around with the php string formatting commands then; alternatively you could purchase the simpleviewer source, and see what the line spacing for that field is.

 
brewster1134

Joined: 2009-02-11
Posts: 29
Posted: Fri, 2009-02-13 20:10

got it!
$myDescription = str_replace("\r", "", "$myDescription");

so now i am having trouble figuring out why the title & description are not showing up on the slideshow page.
i think its this piece from album.tpl. should that be showing up?

        <div class="gbBlock gcBackground1">
          <table style="width: 100%">
            <tr>
              <td>
                {if !empty($theme.item.title)}
                <h2> {$theme.item.title|markup} </h2>
                {/if}
                {if !empty($theme.item.description)}
                <p class="giDescription">
                  {$theme.item.description|markup}
                </p>
                {/if}
              </td>
              <td style="width: 30%">
                {g->block type="core.ItemInfo"
                          item=$theme.item
                          showDate=false
                          showSize=false
                          showOwner=$theme.params.showAlbumOwner
                          class="giInfo"}
              </td>
            </tr>
          </table>
        </div>
 
alecmyers

Joined: 2006-08-01
Posts: 4342
Posted: Fri, 2009-02-13 20:32

Have we suddenly switched to looking at source code outside the simpleviewersource module? I don't think simpleviewersource includes a file called album.tpl.

If so, you've stepped outside the bounds of my expertise, at least for a thread with this title.

 
brewster1134

Joined: 2009-02-11
Posts: 29
Posted: Sat, 2009-02-14 00:22

that is true, admin.tpl is outside of the simpleviewer module, its part of the matrix template. But for some reason, when going to the simpleviewer slideshow, that part of the template is no longer rendered. Is the simpleviewer module disabling it?

 
alecmyers

Joined: 2006-08-01
Posts: 4342
Posted: Sat, 2009-02-14 00:27

It's not so much disabling it as not having anything to do with it whatsoever. The "slideshow" is just basically a blank page with the simpleviewer embedded in the middle. The HTML for that is in Slideshow.tpl.

 
Jigoro

Joined: 2005-09-12
Posts: 14
Posted: Fri, 2009-03-06 04:15

Hi,

I just tried out this module and I think it's quite nice, although it does not really work "out of the box" (version 0.2.6 when I tried).

I have done a few changes to the files so that it works for me. There are some bug fixes, some customization. I thought I would contribute back the patch file so that it might be useful for someone :)

Note that I also had to define all the simpleviewer parameters with values for my root album (could not leave them "unset") otherwise it does not work; probably some warning issued by the XMLOUT script...

You can see the result there: http://cowaddict.org/voyages/simpleview/46626

It would be nice if the "Open in new window" link from simpleviewer's right-click menu could send the user to the gallery page, not the image directly. I am not sure if it is possible though...

Bests,

 
alecmyers

Joined: 2006-08-01
Posts: 4342
Posted: Fri, 2009-03-06 07:54

Hi Jigoro,

Please tell me about the problems you had with the module

Thanks

EDIT: OK, I've accepted some of your corrections - thanks for pointing them out. I'll get the repository updated asap.

Anyone using this module is recommended to update to the latest code (no version number change) and thanks to Jigoro for the fault-finding.

 
Jigoro

Joined: 2005-09-12
Posts: 14
Posted: Fri, 2009-03-06 08:26

Mostly "undefined index" and warnings like these... In several places actually.
Also, I had to define values for all parameters in the top album, otherwise it just does not work.

Sorry I did not keep the exact messages, but the following parts of my patch were fixes for me (in addition to defining values for all parameters).

Best regards,

--- simpleviewersource.ori/classes/SimpleviewerParameterMapHelper.class 2009-03-06 04:38:01.000000000 +0100
+++ simpleviewersource/classes/SimpleviewerParameterMapHelper.class 2009-03-06 03:33:46.000000000 +0100
@@ -148,7 +148,7 @@
while ($result = $searchResults->nextResult()) {
$params[]=array('id'=>$result[0],'paramValue'=>$result[1]);
}
- return array(null, $params[0]);
+ return array(null, $params ? $params[0] : null);
}

--- simpleviewersource.ori/SimpleviewerSourceItemEdit.inc 2009-03-06 04:38:01.000000000 +0100
+++ simpleviewersource/SimpleviewerSourceItemEdit.inc 2009-03-06 04:25:57.000000000 +0100
@@ -48,6 +48,8 @@
GalleryCoreApi::requireOnce('modules/simpleviewersource/classes/SimpleviewerParameterMapHelper.class');
foreach ( $params as $myTuple ) {
trim($myTuple['paramName']);
+ if (!isset($myTuple['paramValue']))
+ $myTuple['paramValue'] = "";
/* parameters must have a non-blank name */
if ( strlen($myTuple['paramName']) && strlen($myTuple['paramValue']) && !($myTuple['id']) ) {
/* create the parameter */
@@ -63,7 +65,7 @@
}
}
/* dead parameters */
- if ($myTuple['delete']) {
+ if (isset($myTuple['delete']) && $myTuple['delete']) {
$ret = SimpleviewerParameterMapHelper::deleteParam($myTuple['id']);
if ($ret) {
return array($ret, null);
@@ -116,7 +118,7 @@
if ($ret) {
return array ($ret,null);
}
- $form['custom'][]= array('id' => $aParam[id], 'paramName' => $myParamName, 'paramValue' => $aParam[paramValue]);
+ $form['custom'][]= array('id' => $aParam['id'], 'paramName' => $myParamName, 'paramValue' => $aParam['paramValue']);
}

$form['custom'][] = array('id' => "", 'paramName' => null, 'paramValue' => null);
--- simpleviewersource.ori/XMLOut.inc 2009-03-06 04:38:01.000000000 +0100
+++ simpleviewersource/XMLOut.inc 2009-03-06 04:22:43.000000000 +0100
@@ -93,8 +93,8 @@
'useAuthToken' => false,
'htmlEntities' => true));
$fnParams['imagePath']=$urlgen->generateUrl( array( 'view' => 'simpleviewersource.DownloadMax',
- 'maxImageHeight' => $svParams['maxImageHeight'],
- 'maxImageWidth' => $svParams['maxImageWidth'],
+ 'maxImageHeight' => $fnParams['maxImageHeight'],
+ 'maxImageWidth' => $fnParams['maxImageWidth'],
'itemId'=>'' ),
array( 'forceFullUrl' => true,
'forceSessionId'=>false,

 
alecmyers

Joined: 2006-08-01
Posts: 4342
Posted: Fri, 2009-03-06 08:39

Hi Jigoro,

Yes, I see the problems you refer to.

Quote:
Also, I had to define values for all parameters in the top album, otherwise it just does not work.

That's not my experience though. It's necessary to define a small subset of the parameters in the root album.

I'm not accepting the change of link from "slideshow" to "slideshow SV", or the replacement of the title with the item summary (in the Simpleviewer caption) but these are really matters of taste. Thanks for all the others. It's a long time since I wrote that code!

The latest revision is now 1726, which all being well will be available in the repository in about 6 hours' time.

 
Jigoro

Joined: 2005-09-12
Posts: 14
Posted: Fri, 2009-03-06 10:27

Sure, no problem, as I wrote in my first message, a part of this patch is just customization for me :) I was just lazy to edit the patch, sorry for this!

Thank you for your quick response :)

Best regards

 
alecmyers

Joined: 2006-08-01
Posts: 4342
Posted: Fri, 2009-03-06 10:42
Quote:
Thank you for your quick response

Could you do me a favour and check the new version when it's available?

I also rolled in a couple of changes which mean that there's no longer an HTTP redirect when downloading each image, it's served on the first request.

 
Jigoro

Joined: 2005-09-12
Posts: 14
Posted: Fri, 2009-03-06 12:31
alecmyers wrote:
Could you do me a favour and check the new version when it's available?

Sure, but I won't be able to do it before Monday. I'll send a status then.

 
Jigoro

Joined: 2005-09-12
Posts: 14
Posted: Mon, 2009-03-09 03:11

Ok, I updated and there are still some issues (I did not report them previous time, sorry):

Notice: Undefined variable: fnvParams in /home2/apache2/www/photos/modules/simpleviewersource/XMLOut.inc on line 96
Notice: Undefined index: maxImageWidth in /home2/apache2/www/photos/modules/simpleviewersource/XMLOut.inc on line 97

Looks like just changing "fnvParams" to "fnParams" fixed the issue for me...

Hope this helps ^^

 
alecmyers

Joined: 2006-08-01
Posts: 4342
Posted: Mon, 2009-03-09 08:26

thanks - fixed in revision 1730.

 
siteqwester

Joined: 2008-04-26
Posts: 9
Posted: Sat, 2009-07-25 03:31

Help!??!!
Showing my newbe status here... installed and am running SimpleViewer just fine (have external pages calling pics from G2 & internally in G2), but have decide to disable SimpleViewer from within Gallery 2 and just use the standard "photo" page. I have deleted the directory called "xml_slideshow" in lib/directory, but SimpleViewer still shows when going to a picture's photo page? Any help is much appreciated...

 
alecmyers

Joined: 2006-08-01
Posts: 4342
Posted: Sat, 2009-07-25 17:37

uninstall the module from the plugins page

 
siteqwester

Joined: 2008-04-26
Posts: 9
Posted: Mon, 2009-08-03 00:00

Nope... uninstalled, deleted, reinstalled, activated... only affects my external viewer pages. Can't remember how I set it up , but, any ideas what I may have done??? I am using Extreme theme and don't see anything in photo.tpl.......................

Just figured it out... Extreme theme's photo page has very similar look to Simpleviewer

...Sorry, my dumbness

 
LastQuark

Joined: 2007-07-25
Posts: 4
Posted: Sat, 2009-10-03 19:37

How can I get the latest revision 1730? Thanks.

 
alecmyers

Joined: 2006-08-01
Posts: 4342
Posted: Sat, 2009-10-03 20:10

1730 is the one in the repository.

 
LastQuark

Joined: 2007-07-25
Posts: 4
Posted: Sun, 2009-10-04 06:03

My dumbness. It's great to see it in the repository.

I installed this years ago and it was working great. I just re-installed it due to hardware upgrade and I had a tough time getting it to work. The problem? I used my old Simpleviewer v1.8. This version does not work. There may be a workaround but I didn't bother. Simpleviewer v1.9 works straight out of the box.

Excellent work, Alec.

 
AlainC.
AlainC.'s picture

Joined: 2006-11-13
Posts: 50
Posted: Sat, 2010-02-06 11:13

Hello,

I just started to use the simpleviewer plugin for my website, great module, thanks for that..

I have 3 questions:

1) I would like to have displayed the Description of the image with the Item filename (below it), is it possible?
What do I have to change in the XMLout code?

2) How can I change the font color for the Item filename? I tried lot of different thinks, none of them worked.

3) I would like to get rid of the navigations arrows that are displayed on the pictures, is it possible, and if yes how?

Thanks in advance for your answer and help
Regards

Alain

 
alecmyers

Joined: 2006-08-01
Posts: 4342
Posted: Sat, 2010-02-06 12:52

2) and 3) are questions about Simpleviewer that I can't answer - I refer you to the Airtight Interactive website where Simpleviewer comes from.

1) Simpleviewer has a filename and caption field in the xml for each image, you can choose what simpleviwersource puts in them in XMLOut.inc lines 128 and 129 that currently read

	    	$myFilename = $myItem->getTitle();
	    	$myCaption = $myItem->getSummary();

Make the obvious substitutions for any field that takes your fancy in http://gallery.menalto.com/apidoc/GalleryCore/Classes/GalleryItem.html

How and where they're displayed is a function of Simpleviewer, not the simpleviewersource module, so you'll have to refer to the Airtight Interactive website for that.

 
AlainC.
AlainC.'s picture

Joined: 2006-11-13
Posts: 50
Posted: Sat, 2010-02-06 20:03

Thank you so much Alec for your quick answer, I have tried to get displayed the file name, and the Description, but I cannot get it working..
I got either the Item file name or the description but cannot to get both displayed...
or when I try the code below I got "gallery not found"

Quote:
if ( GalleryUtilities::isA($myItem, 'GalleryPhotoItem') ) {
$myFilename = $myItem->getTitle();
$myDescription = $myItem->getDescription()

echo ("<image><filename>$myItemId</filename><caption>$myFilename</caption><caption>$myDescription</caption></image>\n");
if(isset($moduleParams['maxItems']) && !(--$moduleParams['maxItems'])) {
break;

I must do something completely wrong, but figure out what it is
If you can help me?
Thanks a lot
regards
Alain

 
alecmyers

Joined: 2006-08-01
Posts: 4342
Posted: Sat, 2010-02-06 20:24
Quote:
$myDescription = $myItem->getDescription()

Missing semi-colon:

Quote:
$myDescription = $myItem->getDescription();

 
AlainC.
AlainC.'s picture

Joined: 2006-11-13
Posts: 50
Posted: Sun, 2010-02-07 13:39

thanks, I added the missing semi-colon in the code, so with the following code

Quote:
if ( GalleryUtilities::isA($myItem, 'GalleryPhotoItem') ) {
$myFilename = $myItem->getTitle();
$myDescription = $myItem->getDescription();

echo ("<image><filename>$myItemId</filename><caption>$myFilename</caption><caption>$myDescription</caption></image>\n");
if(isset($moduleParams['maxItems']) && !(--$moduleParams['maxItems'])) {
break;
}

}

I get the Item file name displayed, but still cannot get the Description.
I must have done something wrong , probably somewhere in theses lines

Quote:

echo ("<image><filename>$myItemId</filename><caption>$myFilename</caption><caption>$myDescription</caption></image>\n");
if(isset($moduleParams['maxItems']) && !(--$moduleParams['maxItems']))

But I can't figure out what...
Regards
Alain

 
nextlevelp

Joined: 2010-04-14
Posts: 9
Posted: Mon, 2010-04-19 00:53

hello! I do get simpleviewer to load up the images as "X" what is wrong? what should I do?

 
nextlevelp

Joined: 2010-04-14
Posts: 9
Posted: Mon, 2010-04-19 00:57

this is the simpleviewer installed

http://www.nextlevelmarket.com/simpleviewer/

 
alecmyers

Joined: 2006-08-01
Posts: 4342
Posted: Mon, 2010-04-19 09:09

Which version of Simpleviewer are you using?

 
nextlevelp

Joined: 2010-04-14
Posts: 9
Posted: Mon, 2010-04-19 22:28

Thank you for your response!

I am using simpleviewer 2.1 I believe. Having a hard time finding the version, but for sure it is 2.x and up.

I have gotten simpleviewer correctly setup and configured.

gallery2 is working fine when using the simpleviewer module within itself:

http://www.nextlevelmarket.com/gallery/ … 2_itemId=7

But when using simpleviewer to feed from an external gallery "gallery2" its not showing any pictures.

My guess is that perhaps its loading from the incorrect thumbnail/images folders? the images load as a big "X" mark.

You can view this at this link:

http://www.nextlevelmarket.com/simpleviewer/

Any suggestions on what might be wrong?

 
alecmyers

Joined: 2006-08-01
Posts: 4342
Posted: Mon, 2010-04-19 22:46

Try unescaping the %26 back to an & in the line where you tell simpleviewer what the url for the xml data source is, in the code for that page.

 
nextlevelp

Joined: 2010-04-14
Posts: 9
Posted: Mon, 2010-04-19 23:24

Woow thank you so much for your quick response!!

I will give it a shoot.

Thanks!

 
nextlevelp

Joined: 2010-04-14
Posts: 9
Posted: Tue, 2010-04-20 03:51

hmmm actually when I changed it from the %26 to an & it gave me:

"Gallery XML not found"

Thank you very much though! I know it must be in the way that xml data is being called....

 
nextlevelp

Joined: 2010-04-14
Posts: 9
Posted: Tue, 2010-04-20 04:49

This is how I got my index.html calling for the swf.

<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/swfobject/2.2/swfobject.js"></script>
<script type="text/javascript">
var flashvars = {};
flashvars.galleryURL = "http://www.nextlevelmarket.com/gallery/main.php?g2_view=simpleviewersource.XMLOut%26g2_itemId=7";
var params = {};
params.allowfullscreen = true;
params.allowscriptaccess = "always";
params.bgcolor = "222222";
swfobject.embedSWF("simpleviewer.swf", "flashContent", "100%", "100%", "9.0.124", false, flashvars, params);
</script>