{ Hi! I'm Mike }
I'm a core developer with The Horde Project and a founding parter of Horde LLC - the company behind the world's most flexible groupware platform. This is my personal blog full of random thoughts about development and life in general.
July 4, 2008

Embedding Ansel galleries with javascript

<p>Ansel now has support for displaying a gallery as a &quot;widget&quot; within things like blog posts or portals.&nbsp; All that is needed is the ability to include javascript in your editor.&nbsp; For example, the following images were embedded in this post with code like the following included directly in the post:</p> 
  <code>&lt;script type="text/javascript" src="path/to/ansel/xrequest.php.php?
requestType=Embed/gallery_id={gallery id}/container=anseldiv1"&gt;
&lt;/script&gt;
&lt;div id="anseldiv1"&gt;&lt;/div&gt;</code>
<script src="http://portal.theupstairsroom.com/horde/ansel/xrequest.php?requestType=Embed/gallery_id=3318/container=ansel1" type="text/javascript"></script><div id="ansel1"></div>
  <p>There are also a number of options available for passing to the widget. For example, you can add a <em>start</em> and <em>count</em> parameter to determine how many images to include, and which one to start counting at.&nbsp; You can also select to use the mini thumbnails (the default), the larger thumbnails or even the 'pretty' thumbnails that Ansel can display by setting the <em>thumbsize</em> parameter to <em>thumb </em>or<em> prettythumb</em>.</p>
<script type="text/javascript" src="http://portal.theupstairsroom.com/horde/ansel/xrequest.php?requestType=Embed/gallery_id=13/container=anseldiv2/thumbsize=prettythumb/start=14/count=12/perpage=3"></script><div id="anseldiv2"></div><style type="text/css"> #anseldiv2 .anselGalleryWidget img {border:none;}</style>
  <p>For an example of what this would look like on a Blogger site, take a look at my <a href="http://mrubinsk.blogspot.com/" target="_blank">Blogger sandbox</a>.&nbsp; </p>
  <p>Like all new features, there is still some work to be done, and a number of different 'views' will be available such as a small slideshow and an image carousel. </p>
  <p>Stay tuned!<br /></p>