com.lokorin.lokorin.modules
[ class tree: com.lokorin.lokorin.modules ] [ index: com.lokorin.lokorin.modules ] [ all elements ]

Source for file module_images.php

Documentation is available at module_images.php

  1. <?php
  2. /*
  3. * Lokorin.com
  4. * Copyright 2004-2006
  5. * Licensed under the GNU LGPL. See COPYING for full terms.
  6. */
  7. /**
  8. * A project module that displays all images connected to a project.
  9. * @author Andreas Launila
  10. * @version $Revision: 1.9 $
  11. * @package com.lokorin.lokorin.modules
  12. * @license http://www.gnu.org/copyleft/lesser.html GNU Lesser General Public License
  13. */
  14.  
  15. /**
  16. * For access to common constants and functions.
  17. */
  18. require_once('common.php');
  19. doInclude('lib_images');
  20. doInclude('lib_projects');
  21. CssHandler::getInstance()->includeCss('gallery');
  22.  
  23. /**
  24. * The maximum width, in pixels, that the images displayed in the gallery
  25. * should be allowed to have. Any images that have a larger width will be
  26. * resized to this width.
  27. * @var integer
  28. * @access private
  29. */
  30. define('GALLERY_THUMB_WIDTH', 280);
  31. /**
  32. * The maximum size, in kilobytes, that the images displayed in the gallery
  33. * should be allowed to be. Any images larger than these get their quality
  34. * reduced so they meet this condition.
  35. * @var integer
  36. * @access private
  37. */
  38. define('GALLERY_THUMB_SIZE', 15);
  39.  
  40. try {
  41. $project = getProjectBasedOnDir();
  42. Page::getInstance()->setProject($project);
  43. } catch(Exception $e) {
  44. logFatalException($e);
  45. }
  46.  
  47. Page::getInstance()->setTitle('Images');
  48.  
  49. $images = $project->getImages();
  50.  
  51. //Construct the output.
  52. $left = true;
  53. foreach($images as $imageName => $description) {
  54. if($left == true) {
  55. echo '<div class="galleryRow"><div class="galleryLeft">';
  56. } else {
  57. echo '<div class="galleryRight">';
  58. }
  59. echo getImage($imageName, $description,
  60. GALLERY_THUMB_WIDTH, GALLERY_THUMB_SIZE, GALLERY_THUMB_WIDTH,
  61. GALLERY_THUMB_SIZE);
  62. echo '<p>'.$description.'</p></div>'."\n";
  63. if($left == false) {
  64. echo '</div>';
  65. }
  66. $left = !$left;
  67. }
  68. if($left == false) {
  69. echo '</div>';
  70. }
  71.  
  72. Page::getInstance()->display();
  73. ?>

Documentation generated on Sun, 16 Apr 2006 21:04:01 +0200 by phpDocumentor 1.3.0RC4