Support Forums | Demo Gallery [1.x] [2.x] | Downloads | News | Site Map ]
Nuked Gallery
  Create a FREE account or Login   As a guest, you don't have access to our FULL navigation system.
 Forum FAQForum FAQ   StatisticsStatistics   SearchSearch   UsergroupsUsergroups   FavoritesFavorites  

Upgrade instructions (0.5.10 to 0.5.11)
Goto page Previous  1, 2, 3
 
Post new topic   Reply to topic    NukedGallery.net Forum Index » phpBB Integration » phpBB2 / Gallery 2 Integration View previous topicPrinter friendly versionView next topic
Author Message
PoPoutdoor

Wizard
Wizard


Joined: Jan 20, 2006
Posts: 109

PostPosted: Sat Mar 29, 2008 12:43 am    Post subject: Re: Upgrade instructions (0.5.10 to 0.5.11) Reply with quote

I'm busy on living right now, the g2image resized image selection mod will not finished soon. The beta code will be ready by next week if my plan goes smooth.

For the current g2Image pop-up part, code doesn't check forum user's access right.
The next version needs to addrees the Guest viewable issue, I think a major rewrite on this part will be easier.

FYI: Check out the G2 module GetURLs, GetUrlsHelper.class code have everything about generate resized image URLs and Guest view access right.
Back to top
Offline View user's profile Send private message
AdBot
   Post subject: Re: Upgrade instructions (0.5.10 to 0.5.11)  

Back to top
PoPoutdoor

Wizard
Wizard


Joined: Jan 20, 2006
Posts: 109

PostPosted: Sun Apr 06, 2008 5:35 pm    Post subject: Re: Upgrade instructions (0.5.10 to 0.5.11) Reply with quote

FIX: Lightbox display - language neutal mod

Change of the close button ('X' image) is higher than original one, last code doesn't address this.

Updates:

Code: › #
#-----[ FIND ]----------------------------------
#
#imageData #numberDisplay{ display: block; clear: left; padding-bottom: 1.0em;   }         
#imageData #bottomNavClose{ width: 66px; float: right;  padding-bottom: 0.7em;   }   
#
#-----[ REPLACE WITH ]----------------------------
#
#imageData #numberDisplay{ display: block; clear: left; padding-bottom: 5px; }
#imageData #bottomNavClose{ width: 26px; float: right; margin-bottom: 9px; }


jettyrat,

About the return URL:

phpbb2 doesn't used "g2_GALLERYSID=...", is it better to filtered out before passing to the javascripts?

The g2image resizes image mod almost finished, except the language part and User/Guest display mode toggle control.

Features:

1. Add permissions check
2. Add Guest display mode, which returns Guest viewable item URL only.
3. Lightbox displays resizes which fits within the browser inner-display area.


I have to get some sleeps now, mod instructions will be post later.
Back to top
Offline View user's profile Send private message
PoPoutdoor

Wizard
Wizard


Joined: Jan 20, 2006
Posts: 109

PostPosted: Mon Apr 07, 2008 6:39 am    Post subject: [beta] G2image with permission check and resizes support Reply with quote

Note: Beta code, do not used for production site.

1. Concepts from G2 module GetURLs, GetUrlsHelper.class.

2. Copyright: GPL

3.. The code changes based on my phpbb2 only mod, should work on patching original.

4. I don't know how to deal with the language part, just use print $string to display messages changed/aded.

Maybe someone can fix that part and fix my poor English descriptions too Wink

5. [lburl] tags shows image fits the inner browser display area on 1024x768 screen.

Maybe we can change browser to full-screen mode with lightbox, then we can display larger resized image without scroll bars.

6. Current code can't change the Display mode as Gallery2 do.

Maybe someone can make that works.

7. Hidden images will not shown in the image selections.


Mod instruction:.

Code: › #
#-----[ OPEN ]------------------------------------
#
g2image/g2image.php

#
#-----[ FIND ]------------------------------------
#
require_once('init.php');
session_start();
#
#-----[ REPLACE WITH ]----------------------------
#
session_start();
require_once('init.php');
#
#-----[ FIND ]------------------------------------
#
     // These are the universal image insertion options
     $message['thumbnail_image'] = T_('Thumbnail with link to image');
     $message['thumbnail_album'] = T_('Thumbnail with link to parent album');
     $message['thumbnail_lightbox'] = T_('Thumbnail with LightBox link to Fullsized Image');
    $message['thumbnail_custom_url'] = T_('Thumbnail with link to custom URL (from text box below)');
    $message['thumbnail_only'] = T_('Thumbnail only - no link');
     $message['fullsize_image'] = T_('Fullsized image with link to Gallery page for image');
     $message['fullsize_only'] = T_('Fullsized image only - no link');
     $message['link_image'] = T_('Text link to image');
     $message['link_album'] = T_('Text link to parent album');
#
#-----[ REPLACE WITH ]----------------------------
#
     // These are the universal image insertion options
     $message['thumbnail_image'] = T_('Thumbnail with link to image');
     $message['thumbnail_album'] = T_('Thumbnail with link to parent album');
   $message['thumbnail_only'] = T_('Thumbnail only - no link');
    if ($g2ic_options['guest_view']) {
       $message['thumbnail_lightbox'] = 'Thumbnail with LightBox link to Max. screen size Image';
       $message['fullsize_image'] = 'Max. Resized image with link to Gallery page for image';
       $message['fullsize_only'] = T_('Max. Resized image only - no link');
    }
    else {
        $message['thumbnail_lightbox'] = T_('Thumbnail with LightBox link to Fullsized Image');
        $message['fullsize_image'] = T_('Fullsized image with link to Gallery page for image');
        $message['fullsize_only'] = T_('Fullsized image only - no link');
    }
    $message['thumbnail_custom_url'] = T_('Thumbnail with link to custom URL (from text box below)');
     $message['link_image'] = T_('Text link to image');
     $message['link_album'] = T_('Text link to parent album');
#
#-----[ FIND ]------------------------------------
#
     // Make the universal message array
     $imginsert_selectoptions = array(
        'thumbnail_image' => array(
           'text'  => $message['thumbnail_image'] ),
        'thumbnail_album' => array(
           'text'  => $message['thumbnail_album'] ),
        'thumbnail_lightbox' => array(
           'text'  => $message['thumbnail_lightbox'] ),
       'thumbnail_custom_url' => array(
          'text'  => $message['thumbnail_custom_url'] ),
       'thumbnail_only' => array(
          'text'  => $message['thumbnail_only'] ),
        'fullsize_image' => array(
           'text'  => $message['fullsize_image'] ),
        'fullsize_only' => array(
           'text'  => $message['fullsize_only'] ),
        'link_image' => array(
           'text'  => $message['link_image'] ),
        'link_album'  => array(
           'text'  => $message['link_album'] ),
     );
#
#-----[ REPLACE WITH ]----------------------------
#
     // Make the universal message array
     $imginsert_selectoptions = array(
        'thumbnail_image' => array(
           'text'  => $message['thumbnail_image'] ),
        'thumbnail_album' => array(
           'text'  => $message['thumbnail_album'] ),
       'thumbnail_only' => array(
          'text'  => $message['thumbnail_only'] ),
        'thumbnail_lightbox' => array(
           'text'  => $message['thumbnail_lightbox'] ),
        'fullsize_image' => array(
           'text'  => $message['fullsize_image'] ),
        'fullsize_only' => array(
           'text'  => $message['fullsize_only'] ),
       'thumbnail_custom_url' => array(
          'text'  => $message['thumbnail_custom_url'] ),
        'link_image' => array(
           'text'  => $message['link_image'] ),
        'link_album'  => array(
           'text'  => $message['link_album'] ),
     );
#
#-----[ FIND ]------------------------------------
#
  function g2ic_get_item_info($item_id) {
    global $gallery;
#
#-----[ REPLACE WITH ]----------------------------
#
  function g2ic_get_item_info($item_id) {
    global $gallery, $g2ic_options;
#
#-----[ FIND ]------------------------------------
#
     $urlGenerator =& $gallery->getUrlGenerator();
#
#-----[ AFTER, ADD ]------------------------------
#
 
    // User permission check
    $userId = $gallery->getActiveUserId();
    if ($g2ic_options['guest_view']) {
       list ($error, $GuestId) = GalleryCoreApi::getPluginParameter('module', 'core', 'id.anonymousUser');
       // FIXME: Do we need error handling for this?
       $userId = $GuestId;
    }
 
    // get the item permissions
    list ($error, $acl) = GalleryCoreApi::getPermissions($item_id, $userId, false);
 
    $canViewThumb = false;
    $canViewResized = false;
    $canViewOriginal = false;
    // Note: array_key_exists (PHP 4 >= 4.0.7, PHP 5), use key_exists()  in PHP 4.0.6.
    if (array_key_exists('core.view', $acl)) {
       $canViewThumb = true;
    }
    if (array_key_exists('core.viewAll', $acl)) {
       $canViewResized = true;
       $canViewOriginal = true;
    }
    else {
       if (array_key_exists('core.viewResizes', $acl)) {
          $canViewResized = true;
       }
       if (array_key_exists('core.viewSource', $acl)) {
          $canViewOriginal = true;
       }
    }
#
#-----[ FIND ]------------------------------------
#
        foreach ($items as $item) {
#
#-----[ AFTER, ADD ]------------------------------
#
          // permission check
          // FIXME: hidden image not shown
          if ( !$canViewThumb || (!$canViewResized && !$canViewOriginal) ) {
             return false;   // skip those without any view permissions
          }

#
#-----[ FIND ]------------------------------------
#
           $item_info['fullsize_img'] = $urlGenerator->generateUrl(array('view' => 'core.DownloadItem', 'itemId' => $item->getid()), array('forceFullUrl' => true));

#
#-----[ REPLACE WITH ]----------------------------
#
          // Get original image url
          if ($canViewOriginal) {
             $item_info['fullsize_img'] = $urlGenerator->generateUrl(array('view' => 'core.DownloadItem', 'itemId' => $item->getid()), array('forceFullUrl' => true));
             if (!$canViewResized && $item->getHeight() <= $g2ic_options['resize_maxH'] && $item->getWidth() <= $g2ic_options['resize_maxW'])
                $item_info['dspsize_img'] = $item_info['fullsize_img'];
          }
 
          // Get max display size resized image url
          if ($canViewResized) {
             list ($error, $imgs) = GalleryCoreApi::fetchDerivativesBySourceIds(array($item_id));   // <- all resizes + thumb
             //list ($error, $resizes) = GalleryCoreApi::fetchResizesByItemIds(array($item_id));
             // FIXME: Assume resizes size in ascending order
             if (!$error && isset($resizes[$item_id])) {
                $i = count($resizes[$item_id]);
 
                // Full-sized not permitted to view, assign the max resize image url
                if (!isset($item_info['fullsize_img'])) {
                   $item_info['fullsize_img'] = $urlGenerator->generateUrl(array('view' => 'core.DownloadItem', 'itemId' => $resizes[$item_id][$i-1]->getid()), array('forceFullUrl' => true));
                }
                else {   // Add Original to Resizes if user can view
                   array_push($resizes[$item_id], $item);
                   $i++;
                }
 
                while ($i--) {
                   if ($resizes[$item_id][$i]->getHeight() <= $g2ic_options['resize_maxH'] && $resizes[$item_id][$i]->getWidth() <= $g2ic_options['resize_maxW']) {
                     $item_info['dspsize_img'] = $urlGenerator->generateUrl(array('view' => 'core.DownloadItem', 'itemId' => $resizes[$item_id][$i]->getid()), array('forceFullUrl' => true));
                      break;
                   }
                }
             }
          }

#
#-----[ FIND ]------------------------------------
#
              print T_('Error loading thumbnails');

           }

#
#-----[ AFTER, ADD ]------------------------------
#

         // If Display size resized not set, assign to thumbnail image url
         if (!isset($item_info['dspsize_img'])) {
            $item_info['dspsize_img'] = $item_info['thumbnail_src'];
         }

#
#-----[ FIND ]------------------------------------
#
   . '        d = new dTree("d");' . "\n";

#
#-----[ REPLACE WITH ]----------------------------
#
   . '        var d = new dTree("d");' . "\n";

#
#-----[ FIND ]------------------------------------
#
   . '        <legend>' . T_('Display Options') . '</legend>' . "\n"
#
#-----[ REPLACE WITH ]----------------------------
#
   . '        <legend>' . T_('Display Options');

   // Display Guest viewable
   if ($g2ic_options['guest_view']) {
      $html .= ' (Guest View)';
   }
   $html .= '</legend>' . "\n"

#
#-----[ FIND ]------------------------------------
#
           break; // Have gone past the range for this page

#
#-----[ AFTER, ADD ]------------------------------
#
      $item_info = g2ic_get_item_info($image_id);
      // User have no rights to view image or hidden, don't display this
      if (!$item_info) {
         continue;
      }


#
#-----[ FIND ]------------------------------------
#
      $item_info = g2ic_get_item_info($image_id);

        $html .= g2ic_make_html_img($item_info) . "\n";
#
#-----[ REPLACE WITH ]----------------------------
#
        $html .= g2ic_make_html_img($item_info) . "\n";
#
#-----[ FIND ]------------------------------------
#
        // hidden fields
        $html .= '    <input type="hidden" name="thumbnail_src" value="' . $item_info['thumbnail_src'] . '" />' . "\n"
#
#-----[ AFTER, ADD ]------------------------------
#
      . '    <input type="hidden" name="dspsize_img" value="' . $item_info['dspsize_img'] . '" />' . "\n"
#
#-----[ FIND ]------------------------------------
#
   . $item_info['fullsize_img'] . '">' . "\n"
#
#-----[ REPLACE WITH ]----------------------------
#
   . $item_info['dspsize_img'] . ';">' . "\n"
#
#-----[ OPEN ]------------------------------------------
#
g2image/init.php

#
#-----[ FIND ]------------------------------------
#
$g2ic_images_per_page = 15;
#
#-----[ AFTER, ADD ]------------------------------
#

// This sets the returned URLs be guest viewable image .  If set to TRUE,
// returned URLs is guest viewable.  If set to FALSE, g2image returns URLs of
// full size and max. resied image may not be viewable by guest.

$g2ic_images_guest_view = TRUE;

// Change this for limits of resized images.
// Default will fit the inner display area of browser under 1024x768 screen.

$g2ic_resize_img_height = 580;
$g2ic_resize_img_width = 980;

#
#-----[ FIND ]------------------------------------
#
  $g2ic_options['sortby'] = $g2ic_sortby;
#
#-----[ AFTER, ADD ]------------------------------
#
$g2ic_options['guest_view'] = $g2ic_images_guest_view;
$g2ic_options['resize_maxH'] = $g2ic_resize_img_height;
$g2ic_options['resize_maxW'] = $g2ic_resize_img_width;
#
#-----[ OPEN ]------------------------------------------
#
g2image/jscripts/functions.js

#
#-----[ FIND ]------------------------------------
#
     var thumbnail_src = new Array();
#
#-----[ AFTER, ADD ]------------------------------
#
   var dspsize_img = new Array();
#
#-----[ FIND ]------------------------------------
#
           image_url[i] = obj.image_url[i].value;
#
#-----[ AFTER, ADD ]------------------------------
#
         dspsize_img[i] = obj.dspsize_img[i].value;
#
#-----[ FIND ]------------------------------------
#
        thumbnail_src[0] = obj.thumbnail_src.value;
#
#-----[ AFTER, ADD ]------------------------------
#
      dspsize_img[0] = obj.dspsize_img.value;
#
#-----[ FIND ]------------------------------------
#
               htmlCode += '[lburl=' + fullsize_img[i] + ']';
#
#-----[ REPLACE WITH ]----------------------------
#
               htmlCode += '[lburl=' + dspsize_img[i] + ']';
#
#-----[ SAVE/CLOSE ALL FILES ]---------------------
#
# EoM


Edit: Fix typo


Last edited by PoPoutdoor on Mon Apr 07, 2008 12:22 pm; edited 1 time in total
Back to top
Offline View user's profile Send private message
jettyrat

Moderator
Moderator


Joined: Nov 28, 2005
Posts: 1050

PostPosted: Mon Apr 07, 2008 9:20 am    Post subject: Re: Upgrade instructions (0.5.10 to 0.5.11) Reply with quote

Wow, nice! I'll have to check that out later...I have real work to do now.

I've actually been thinking about abandoning g2image for the phpbb3 integration and adapting the mapAllGalleryLinks function in g2helper to do the same thing. I have it respecting Gallery permissions now for profile views.

Quote: › phpbb2 doesn't used "g2_GALLERYSID=...", is it better to filtered out before passing to the javascripts?
I filter it after the javascripts in the phpbb3 integration, before the message gets saved in the database. The js doesn't care if the sid is there or not. I use a piece of code modified from your fix posted earlier.
Code: ›       if (strpos($this->message, 'g2_GALLERYSID=') !== false)
      {
         $this->message = preg_replace('(\&g2_GALLERYSID=[a-f0-9]{32}|\&g2_GALLERYSID=TMP_SESSION_ID_DI_NOISSES_PMT)', '', $this->message);
      }
Back to top
Offline View user's profile Send private message
PoPoutdoor

Wizard
Wizard


Joined: Jan 20, 2006
Posts: 109

PostPosted: Mon Apr 07, 2008 12:32 pm    Post subject: Re: Upgrade instructions (0.5.10 to 0.5.11) Reply with quote

I haven't check the mapAllGalleryLinks function... reading the api document kills most of the time writing this acl/resizes feature Razz

Note: Typo in the beta code, updated now.
Back to top
Offline View user's profile Send private message
PoPoutdoor

Wizard
Wizard


Joined: Jan 20, 2006
Posts: 109

PostPosted: Tue Apr 08, 2008 12:58 pm    Post subject: [beta-2] G2image with permission check and resizes support Reply with quote

Edit: Last code works on my test servedr, but not my personal site. code now fixed. Razz

Update: Code cleanup, with g2-sid filtering from function.js

Code: › #
#-----[ OPEN ]------------------------------------
#
g2image/g2image.php

#
#-----[ FIND ]------------------------------------
#
require_once('init.php');
session_start();
#
#-----[ REPLACE WITH ]----------------------------
#
session_start();
require_once('init.php');
#
#-----[ FIND ]------------------------------------
#
   // These are the universal image insertion options
   $message['thumbnail_image'] = T_('Thumbnail with link to image');
   $message['thumbnail_album'] = T_('Thumbnail with link to parent album');
   $message['thumbnail_lightbox'] = T_('Thumbnail with LightBox link to Fullsized Image');
   $message['thumbnail_custom_url'] = T_('Thumbnail with link to custom URL (from text box below)');
   $message['thumbnail_only'] = T_('Thumbnail only no link');
   $message['fullsize_image'] = T_('Fullsized image with link to Gallery page for image');
   $message['fullsize_only'] = T_('Fullsized image only no link');
   $message['link_image'] = T_('Text link to image');
   $message['link_album'] = T_('Text link to parent album');
#
#-----[ REPLACE WITH ]----------------------------
#
   // These are the universal image insertion options
   $message['thumbnail_image'] = T_('Thumbnail with link to image');
   $message['thumbnail_album'] = T_('Thumbnail with link to parent album');
   $message['thumbnail_only'] = T_('Thumbnail only no link');
   if ($g2ic_options['guest_view']) {
      $message['thumbnail_lightbox'] = 'Thumbnail with LightBox link to Max. screen size Image';
      $message['fullsize_image'] = 'Max. Resized image with link to Gallery page for image';
      $message['fullsize_only'] = 'Max. Resized image only no link';
   }
   else {
      $message['thumbnail_lightbox'] = T_('Thumbnail with LightBox link to Fullsized Image');
      $message['fullsize_image'] = T_('Fullsized image with link to Gallery page for image');
      $message['fullsize_only'] = T_('Fullsized image only no link');
   }
   $message['thumbnail_custom_url'] = T_('Thumbnail with link to custom URL (from text box below)');
   $message['link_image'] = T_('Text link to image');
   $message['link_album'] = T_('Text link to parent album');
#
#-----[ FIND ]------------------------------------
#
   // Make the universal message array
   $imginsert_selectoptions = array(
      'thumbnail_image' => array(
         'text'  => $message['thumbnail_image'] ),
      'thumbnail_album' => array(
         'text'  => $message['thumbnail_album'] ),
      'thumbnail_lightbox' => array(
         'text'  => $message['thumbnail_lightbox'] ),
      'thumbnail_custom_url' => array(
         'text'  => $message['thumbnail_custom_url'] ),
      'thumbnail_only' => array(
         'text'  => $message['thumbnail_only'] ),
      'fullsize_image' => array(
         'text'  => $message['fullsize_image'] ),
      'fullsize_only' => array(
         'text'  => $message['fullsize_only'] ),
      'link_image' => array(
         'text'  => $message['link_image'] ),
      'link_album'  => array(
         'text'  => $message['link_album'] ),
   );
#
#-----[ REPLACE WITH ]----------------------------
#
   // Make the universal message array
   $imginsert_selectoptions = array(
      'thumbnail_image' => array(
         'text'  => $message['thumbnail_image'] ),
      'thumbnail_album' => array(
         'text'  => $message['thumbnail_album'] ),
      'thumbnail_only' => array(
         'text'  => $message['thumbnail_only'] ),
      'thumbnail_lightbox' => array(
         'text'  => $message['thumbnail_lightbox'] ),
      'fullsize_image' => array(
         'text'  => $message['fullsize_image'] ),
      'fullsize_only' => array(
         'text'  => $message['fullsize_only'] ),
      'thumbnail_custom_url' => array(
         'text'  => $message['thumbnail_custom_url'] ),
      'link_image' => array(
         'text'  => $message['link_image'] ),
      'link_album'  => array(
         'text'  => $message['link_album'] ),
   );
#
#-----[ FIND ]------------------------------------
#
  function g2ic_get_item_info($item_id) {
   global $gallery;

      :
      :
      :

   return $item_info;

}

#
#-----[ REPLACE WITH ]----------------------------
#
function g2ic_get_item_info($item_id) {
   global $gallery, $g2ic_options;

   $urlGenerator =& $gallery->getUrlGenerator();

   // User permission check
   $userId = $gallery->getActiveUserId();
   if ($g2ic_options['guest_view']) {
      list ($error, $GuestId) = GalleryCoreApi::getPluginParameter('module', 'core', 'id.anonymousUser');
      // FIXME: Do we need error handling for this?
      $userId = $GuestId;
   }

   // get the item permissions
   list ($error, $acl) = GalleryCoreApi::getPermissions($item_id, $userId, false);
   // FIXME: Do we need error handling for this?
   $canViewThumb = false;
   $canViewResized = false;
   $canViewOriginal = false;
   // Note: array_key_exists (PHP 4 >= 4.0.7, PHP 5), use key_exists()  in PHP 4.0.6.
   if (array_key_exists('core.view', $acl)) {
      $canViewThumb = true;
   }
   if (array_key_exists('core.viewAll', $acl)) {
      $canViewResized = true;
      $canViewOriginal = true;
   }
   else {
      if (array_key_exists('core.viewResizes', $acl)) {
         $canViewResized = true;
      }
      if (array_key_exists('core.viewSource', $acl)) {
         $canViewOriginal = true;
      }
   }

   list ($error,$items) = GalleryCoreApi::loadEntitiesById(array($item_id));
   if(!$error) {
      foreach ($items as $item) {
         // permission check
         // FIXME: hidden image not shown
         if ( !$canViewThumb || (!$canViewResized && !$canViewOriginal) ) {
            return false;   // skip those without any view permissions
         }

         // Get thumbnail
         list($error, $thumbnails) = GalleryCoreApi::fetchThumbnailsByItemIds(array($item->getid()));
         if(!$error) {
            $item_info['thumbnail_src'] = $urlGenerator->generateUrl(array('view' => 'core.DownloadItem', 'itemId' => $thumbnails[$item_id]->getid()), array('forceFullUrl' => true));
            $item_info['image_url'] = $urlGenerator->generateUrl(array('view' => 'core.ShowItem', 'itemId' => $item->getid()), array('forceFullUrl' => true));
            $item_info['id'] = $item_id;
            $item_info['title'] = $item->getTitle();
            $item_info['description'] = $item->getDescription();
            $item_info['summary'] = $item->getSummary();
            $item_info['thumbnail_width'] = $thumbnails[$item_id]->getWidth();
            $item_info['thumbnail_height'] =$thumbnails[$item_id]->getHeight();
         }
         else {
            print T_('Error loading thumbnails');
         }

         // Get resizes
         list ($error, $AllVersions) = GalleryCoreApi::fetchResizesByItemIds(array($item_id));
         if(!$error && isset($AllVersions[$item_id])) {
            // put original in array
            array_push($AllVersions[$item_id], $item);
            $i = count($AllVersions[$item_id]);
            // Original info
            if ($canViewOriginal) {
               $item_info['fullsize_img'] = $urlGenerator->generateUrl(array('view' => 'core.DownloadItem', 'itemId' => $item->getid()), array('forceFullUrl' => true));
               // If no view resizes permission, set max display size resized image url to full if not over sized
               if (!$canViewResized && $item->getHeight() <= $g2ic_options['resize_maxH'] && $item->getWidth() <= $g2ic_options['resize_maxW'])
                  $item_info['dspsize_img'] = $item_info['fullsize_img'];
            }

            // Max display size resized info
            if ($canViewResized) {
               // If no view Original permission, assign Full url to the max resize image
               if (!$canViewOriginal) {
                  $i--;
                  $item_info['fullsize_img'] = $urlGenerator->generateUrl(array('view' => 'core.DownloadItem', 'itemId' => $AllVersions[$item_id][$i-1]->getid()), array('forceFullUrl' => true));
               }
               // FIXME: Assume resizes size in ascending order
               while ($i--) {
                  if ($AllVersions[$item_id][$i]->getHeight() <= $g2ic_options['resize_maxH'] && $AllVersions[$item_id][$i]->getWidth() <= $g2ic_options['resize_maxW']) {
                     $item_info['dspsize_img'] = $urlGenerator->generateUrl(array('view' => 'core.DownloadItem', 'itemId' => $AllVersions[$item_id][$i]->getid()), array('forceFullUrl' => true));
                     break;
                  }
               }
            }
            else {
               print 'Error loading resizes';
            }
         }
      }

      // All resizes oversized or no view resizes permission, set max resize url to thumbnail
      if (!isset($item_info['dspsize_img'])) {
         $item_info['dspsize_img'] = $item_info['thumbnail_src'];
      }
   }
   else {
      print T_('Error loading album items');
   }

   if(empty($item_info['summary']))
      $item_info['summary'] = $item_info['title'];
   if(empty($item_info['description']))
      $item_info['description'] = $item_info['summary'];

   return $item_info;
}
#
#-----[ FIND ]------------------------------------
#
   . '        d = new dTree("d");' . "\n";

#
#-----[ REPLACE WITH ]----------------------------
#
   . '        var d = new dTree("d");' . "\n";

#
#-----[ FIND ]------------------------------------
#
   . '        <legend>' . T_('Display Options') . '</legend>' . "\n"
#
#-----[ REPLACE WITH ]----------------------------
#
   . '        <legend>' . T_('Display Options');
   // Display Guest viewable
   if ($g2ic_options['guest_view']) {
      $html .= ' (Guest View)';
   }
   $html .= '</legend>' . "\n"
#
#-----[ FIND ]------------------------------------
#
         break; // Have gone past the range for this page

#
#-----[ AFTER, ADD ]------------------------------
#
      $item_info = g2ic_get_item_info($image_id);
      // User have no rights to view image or hidden, don't display this
      if (!$item_info) {
         continue;
      }

#
#-----[ FIND ]------------------------------------
#
      $item_info = g2ic_get_item_info($image_id);

      $html .= g2ic_make_html_img($item_info) . "\n";
#
#-----[ REPLACE WITH ]----------------------------
#
      $html .= g2ic_make_html_img($item_info) . "\n";
#
#-----[ FIND ]------------------------------------
#
      // hidden fields
      $html .= '    <input type="hidden" name="thumbnail_src" value="' . $item_info['thumbnail_src'] . '" />' . "\n"
#
#-----[ AFTER, ADD ]------------------------------
#
      . '    <input type="hidden" name="dspsize_img" value="' . $item_info['dspsize_img'] . '" />' . "\n"
#
#-----[ FIND ]------------------------------------
#
   . $item_info['fullsize_img'] . '">' . "\n"
#
#-----[ REPLACE WITH ]----------------------------
#
   . $item_info['dspsize_img'] . ';">' . "\n"
#
#-----[ OPEN ]------------------------------------------
#
g2image/init.php

#
#-----[ FIND ]------------------------------------
#
$g2ic_images_per_page = 15;
#
#-----[ AFTER, ADD ]------------------------------
#

// This sets the returned URLs be guest viewable image .  If set to TRUE,
// returned URLs is guest viewable.  If set to FALSE, g2image returns URLs of
// full size and max. resied image may not be viewable by guest.

$g2ic_images_guest_view = TRUE;

// Change this for limits of resized images.
// Default will fit the inner display area of browser under 1024x768 screen.

$g2ic_resize_img_height = 580;
$g2ic_resize_img_width = 980;

#
#-----[ FIND ]------------------------------------
#
  $g2ic_options['sortby'] = $g2ic_sortby;
#
#-----[ AFTER, ADD ]------------------------------
#
$g2ic_options['guest_view'] = $g2ic_images_guest_view;
$g2ic_options['resize_maxH'] = $g2ic_resize_img_height;
$g2ic_options['resize_maxW'] = $g2ic_resize_img_width;
#
#-----[ OPEN ]------------------------------------------
#
g2image/jscripts/functions.js

#
#-----[ FIND ]------------------------------------
#
   var loop = '';
#
#-----[ AFTER, ADD ]------------------------------
#
   var spacing = '';
   var addpad = false;
#
#-----[ FIND ]------------------------------------
#
   var thumbnail_src = new Array();
#
#-----[ AFTER, ADD ]------------------------------
#
   var dspsize_img = new Array();
#
#-----[ FIND ]------------------------------------
#
      loop = obj.images.length;
#
#-----[ AFTER, ADD ]------------------------------
#
      spacing = " ";
#
#-----[ FIND ]------------------------------------
#
         image_url[i] = obj.image_url[i].value;
#
#-----[ AFTER, ADD ]------------------------------
#
         dspsize_img[i] = obj.dspsize_img[i].value;
#
#-----[ FIND ]------------------------------------
#
      thumbnail_src[0] = obj.thumbnail_src.value;
#
#-----[ AFTER, ADD ]------------------------------
#
      dspsize_img[0] = obj.dspsize_img.value;
#
#-----[ FIND ]------------------------------------
#
      if ((loop == 1) || obj.images[i].checked) {
#
#-----[ AFTER, ADD ]------------------------------
#
         addpad = true;
#
#-----[ FIND ]------------------------------------
#
               htmlCode += '[lburl=' + fullsize_img[i] + ']';
#
#-----[ REPLACE WITH ]----------------------------
#
               htmlCode += '[lburl=' + dspsize_img[i] + ']';
#
#-----[ FIND ]------------------------------------
#
               htmlCode += '[/img][/url]';
#
#-----[ REPLACE WITH ]----------------------------
#
               htmlCode += '[/img][/url]' + "\r";
               addpad = false;
#
#-----[ FIND ]------------------------------------
#
               htmlCode += '[img]' + fullsize_img[i];
               htmlCode += '[/img]';
#
#-----[ REPLACE WITH ]----------------------------
#
               htmlCode += '[img]' + fullsize_img[i];
               htmlCode += '[/img]' + "\r";
               addpad = false;
#
#-----[ FIND ]------------------------------------
#
            break;
         }
      }
   }
#
#-----[ REPLACE WITH ]----------------------------
#
         // Add space between tags, for better isolations of image views
         if (addpad) {
            htmlCode += spacing;
         }
      }
   }
   // Filter the G2 session string
   htmlCode = htmlCode.replace(/(\?|\&)g2_GALLERYSID=([a-f0-9]{32}|TMP_SESSION_ID_DI_NOISSES_PMT)/g, '');

#
#-----[ OPEN ]----------------------------------
#
includes/bbcode.php

#
#-----[ FIND ]----------------------------------
#
# if you don't have my mod, skip to next FIND
   // g2image G2 url rewrite support(for [img]...[/img] tags)
   $text = preg_replace('((\?)(g2_GALLERYSID=[a-f0-9]+|g2_GALLERYSID=TMP_SESSION_ID_DI_NOISSES_PMT))', '', $text);

#
#-----[ REPLACE WITH ]----------------------------
#
# delete lines

#
#-----[ FIND ]----------------------------------
#
      $text = preg_replace('((\&amp\;)(g2_GALLERYSID=[a-f0-9]+|g2_GALLERYSID=TMP_SESSION_ID_DI_NOISSES_PMT))', '', $text);
#
#-----[ REPLACE WITH ]----------------------------
#
# delete line

#
#-----[ SAVE/CLOSE ALL FILES ]---------------------
#
# EoM
Back to top
Offline View user's profile Send private message
PoPoutdoor

Wizard
Wizard


Joined: Jan 20, 2006
Posts: 109

PostPosted: Tue May 27, 2008 11:21 pm    Post subject: Re: Upgrade instructions (0.5.10 to 0.5.11) Reply with quote

Bug report

This is a long time issue for the timezone display code:

The timezone display code
Code: › $l_timezone = explode('.', $board_config['board_timezone']);

$l_timezone = (count($l_timezone) > 1 && $l_timezone[count($l_timezone)-1] != 0) ? $lang[sprintf('%.1f', $board_config['board_timezone'])] : $lang[number_format($board_config['board_timezone'])];


lang_gallery2.php
Code: › $lang = array_merge($lang, array(
  :
   'G2_FETCHPLUGINSTATUS_FAILED'   => 'fetchPluginStatus failed.',

));


Note: array_merge() change the numeric key which lead to incorrect timezone display.

Changes to fix:
Code: › $lang = $lang + array(
  :
   'G2_FETCHPLUGINSTATUS_FAILED'   => 'fetchPluginStatus failed.'
);
Back to top
Offline View user's profile Send private message
PoPoutdoor

Wizard
Wizard


Joined: Jan 20, 2006
Posts: 109

PostPosted: Fri Jun 20, 2008 2:39 pm    Post subject: Re: Upgrade instructions (0.5.10 to 0.5.11) Reply with quote

Bug fix for g2helper.inc

Code: › Replace ALL '$ret->getAsHtml()' with '$ret' [b]and[/b] ALL '$this->_errorHandler' with '$this->errorHandler'


Before the fix, the integration related erros doesn't display.
Back to top
Offline View user's profile Send private message
jettyrat

Moderator
Moderator


Joined: Nov 28, 2005
Posts: 1050

PostPosted: Fri Jun 20, 2008 4:08 pm    Post subject: Re: Upgrade instructions (0.5.10 to 0.5.11) Reply with quote

PoPoutdoor wrote: › Bug fix for g2helper.inc

Code: › Replace ALL '$ret->getAsHtml()' with '$ret' [b]and[/b] ALL '$this->_errorHandler' with '$this->errorHandler'


Before the fix, the integration related erros doesn't display.


$ret->getAsHtml() is the standard way to print gallery errors. I don't understand why that doesn't work?
Back to top
Offline View user's profile Send private message
PoPoutdoor

Wizard
Wizard


Joined: Jan 20, 2006
Posts: 109

PostPosted: Tue Jun 24, 2008 3:10 am    Post subject: Re: Upgrade instructions (0.5.10 to 0.5.11) Reply with quote

FYI:

The errorHandler() function calls phpbb2 error handling routine. When calling errorHandler(), non-existing getAsHtml() only shows blank page.

I catch this by checking server log, and the function not exists in integration package nor included in the code.
Back to top
Offline View user's profile Send private message
jettyrat

Moderator
Moderator


Joined: Nov 28, 2005
Posts: 1050

PostPosted: Tue Jun 24, 2008 8:58 am    Post subject: Re: Upgrade instructions (0.5.10 to 0.5.11) Reply with quote

Well, I don't have phpbb2 installed, but I think you are missing something there. If $ret is set then getAsHtml() should work because $ret is an object and getAsHtml is a method of that object. It should be passing text to the errorHandler function. There is no function by that name in the integration code because it is a status object returned by gallery when there is an error.
Back to top
Offline View user's profile Send private message
PoPoutdoor

Wizard
Wizard


Joined: Jan 20, 2006
Posts: 109

PostPosted: Thu Jul 03, 2008 11:56 pm    Post subject: Re: Upgrade instructions (0.5.10 to 0.5.11) Reply with quote

I see... but the '$this->_errorHandler' replacement is valid for the integration code.
Back to top
Offline View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    NukedGallery.net Forum Index » phpBB Integration » phpBB2 / Gallery 2 Integration View previous topicPrinter friendly versionView next topic
Goto page Previous  1, 2, 3

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
All times are GMT - 5 Hours

Powered by phpBB © phpBB Group



Sponsors: Web HostingDedicated ServersDomain NamesDomain Name RegistrationDedicated Web HostingSearch Engine OptimisationSEOWeb Design New YorkSEO Web DesignWeb hosting AustraliaSEO

6th year online! 2003-2008
Legal • Use of this site consitutes agreement to the Acceptable Use Policy
Hosted by Implosion WorksSourceForge.net Logo • Theme by TonicMedia