Ignore:
Timestamp:
04/01/11 15:35:07 (8 years ago)
Author:
gogo
Message:

Reduce roundtrips for image thumbnails.
See:

https://github.com/sleemanj/mootools-filemanager/commit/b39b68cda2d7c9f06cdaaeb2aa6556965ae99604

Location:
branches/MootoolsFileManager-Update/plugins/MootoolsFileManager
Files:
11 edited

Legend:

Unmodified
Added
Removed
  • branches/MootoolsFileManager-Update/plugins/MootoolsFileManager/backend.php

    r1302 r1304  
    119119      'maxUploadSize' => size_to_bytes($IMConfig['max_images_upload_size']),       
    120120      'suggestedMaxImageDimension' => $IMConfig['suggested_images_image_dimension'], 
    121                    
     121      'thumbnailsMustGoThroughBackend' => FALSE,           
    122122      'filter'        => 'image/',             
    123123    )); 
     
    147147      'maxUploadSize' => size_to_bytes($IMConfig['max_files_upload_size']),       
    148148      'suggestedMaxImageDimension' => $IMConfig['suggested_files_image_dimension'], 
    149              
     149      'thumbnailsMustGoThroughBackend' => FALSE,       
    150150     // 'filter'        => $IMConfig['files_filter'], 
    151151             
  • branches/MootoolsFileManager-Update/plugins/MootoolsFileManager/mootools-filemanager/.git/COMMIT_EDITMSG

    r1303 r1304  
    1 Make preview image (250 thumb) work with POST type propagateData.  There are 2 ways I could have done this, either just used getThumb() to obtain the thumb250, or hijack onThumbnail() to do the work.  I chose the latter because it more closely aligns with the previous logic even if it is a larger diff to do it. 
     1Add an option "thumbnailsMustGoThroughBackend" to FileManager.php, it defaults to true (current behaviour).  When set to false, IF and only if a thumbnail of the correct size has been created already, then onView will return the direct thumbnail url, otherwise it will still go through the onThumbnail event to get the thumbnail (the first time).  This is a means to reduce the roundtrips required whe using the POST type of propagateData, it also would reduce server load for normal GET type setups because it cuts down drastically on PHP execution requests and all that entails. 
    22 
    33# Please enter the commit message for your changes. Lines starting 
    44# with '#' will be ignored, and an empty message aborts the commit. 
    55# On branch master 
    6 # Your branch is ahead of 'origin/master' by 1 commit. 
     6# Your branch is ahead of 'origin/master' by 2 commits. 
    77# 
    88# Changes to be committed: 
     
    1010# 
    1111#       modified:   Assets/Connector/FileManager.php 
     12#       modified:   Source/FileManager.js 
    1213# 
    1314# Untracked files: 
  • branches/MootoolsFileManager-Update/plugins/MootoolsFileManager/mootools-filemanager/.git/FETCH_HEAD

    r1302 r1304  
    1 4032882436175bde9c335b9ad75f81a208c7c98e                branch 'master' of git://github.com/sleemanj/mootools-filemanager 
     1b39b68cda2d7c9f06cdaaeb2aa6556965ae99604                branch 'master' of git://github.com/sleemanj/mootools-filemanager 
  • branches/MootoolsFileManager-Update/plugins/MootoolsFileManager/mootools-filemanager/.git/ORIG_HEAD

    r1302 r1304  
    1 9a926918afdcddb1a7555ef685e7acb6523a7192 
     1b39b68cda2d7c9f06cdaaeb2aa6556965ae99604 
  • branches/MootoolsFileManager-Update/plugins/MootoolsFileManager/mootools-filemanager/.git/logs/HEAD

    r1303 r1304  
    334032882436175bde9c335b9ad75f81a208c7c98e 794418a4483a3bc4dcc6fd4d631dafb328c518c3 James Sleeman <james@gogo.co.nz> 1301666698 +1300     commit: Initial ability to *optionally* POST the propagateData instead of GET'ing it, thumbnails are supported in the list view but not yet in the preview/details, probably need to have onDetails actually generate the thumb(s), this would be fine since if you're calling onDetails one assumes you will be rather shortly hitting up the image anyway. 
    44794418a4483a3bc4dcc6fd4d631dafb328c518c3 b08f652f527a193c89233ac17a8b65d980f5dab2 James Sleeman <james@gogo.co.nz> 1301669667 +1300     commit: Make preview image (250 thumb) work with POST type propagateData. There are 2 ways I could have done this, either just used getThumb() to obtain the thumb250, or hijack onThumbnail() to do the work. I chose the latter because it more closely aligns with the previous logic even if it is a larger diff to do it. 
     5b08f652f527a193c89233ac17a8b65d980f5dab2 b39b68cda2d7c9f06cdaaeb2aa6556965ae99604 James Sleeman <james@gogo.co.nz> 1301671697 +1300     commit: Add an option "thumbnailsMustGoThroughBackend" to FileManager.php, it defaults to true (current behaviour). When set to false, IF and only if a thumbnail of the correct size has been created already, then onView will return the direct thumbnail url, otherwise it will still go through the onThumbnail event to get the thumbnail (the first time). This is a means to reduce the roundtrips required whe using the POST type of propagateData, it also would reduce server load for normal GET type setups because it cuts down drastically on PHP execution requests and all that entails. 
  • branches/MootoolsFileManager-Update/plugins/MootoolsFileManager/mootools-filemanager/.git/logs/refs/heads/master

    r1303 r1304  
    334032882436175bde9c335b9ad75f81a208c7c98e 794418a4483a3bc4dcc6fd4d631dafb328c518c3 James Sleeman <james@gogo.co.nz> 1301666698 +1300     commit: Initial ability to *optionally* POST the propagateData instead of GET'ing it, thumbnails are supported in the list view but not yet in the preview/details, probably need to have onDetails actually generate the thumb(s), this would be fine since if you're calling onDetails one assumes you will be rather shortly hitting up the image anyway. 
    44794418a4483a3bc4dcc6fd4d631dafb328c518c3 b08f652f527a193c89233ac17a8b65d980f5dab2 James Sleeman <james@gogo.co.nz> 1301669667 +1300     commit: Make preview image (250 thumb) work with POST type propagateData. There are 2 ways I could have done this, either just used getThumb() to obtain the thumb250, or hijack onThumbnail() to do the work. I chose the latter because it more closely aligns with the previous logic even if it is a larger diff to do it. 
     5b08f652f527a193c89233ac17a8b65d980f5dab2 b39b68cda2d7c9f06cdaaeb2aa6556965ae99604 James Sleeman <james@gogo.co.nz> 1301671697 +1300     commit: Add an option "thumbnailsMustGoThroughBackend" to FileManager.php, it defaults to true (current behaviour). When set to false, IF and only if a thumbnail of the correct size has been created already, then onView will return the direct thumbnail url, otherwise it will still go through the onThumbnail event to get the thumbnail (the first time). This is a means to reduce the roundtrips required whe using the POST type of propagateData, it also would reduce server load for normal GET type setups because it cuts down drastically on PHP execution requests and all that entails. 
  • branches/MootoolsFileManager-Update/plugins/MootoolsFileManager/mootools-filemanager/.git/refs/heads/master

    r1303 r1304  
    1 b08f652f527a193c89233ac17a8b65d980f5dab2 
     1b39b68cda2d7c9f06cdaaeb2aa6556965ae99604 
  • branches/MootoolsFileManager-Update/plugins/MootoolsFileManager/mootools-filemanager/.git/refs/remotes/origin/master

    r1302 r1304  
    1 4032882436175bde9c335b9ad75f81a208c7c98e 
     1b39b68cda2d7c9f06cdaaeb2aa6556965ae99604 
  • branches/MootoolsFileManager-Update/plugins/MootoolsFileManager/mootools-filemanager/Assets/Connector/FileManager.php

    r1303 r1304  
    555555                        'DestroyIsAuthorized_cb' => null, 
    556556                        'MoveIsAuthorized_cb' => null, 
     557                        'thumbnailsMustGoThroughBackend' => true, // If set true (default) all thumbnail requests go through the backend (onThumbnail), if false, thumbnails will "shortcircuit" if they exist, saving roundtrips when using POST type propagateData 
    557558                        'URIpropagateData' => null 
    558559                ), (is_array($options) ? $options : array())); 
     
    776777                                 * a generic icon image instead). 
    777778                                 */ 
     779                                 
     780                                unset($thumb48, $thumb250); 
     781                                if(!$this->options['thumbnailsMustGoThroughBackend']) 
     782        { 
     783          try 
     784          { 
     785            $thumb48  = $this->getThumb ($legal_url, $file, 48, 48, true); 
     786            $thumb250 = $this->getThumb ($legal_url, $file, 250, 250, true); 
     787          } 
     788          catch(Exception $E) 
     789          { 
     790            // Fallback to event request 
     791          } 
     792        } 
     793                                if(!isset($thumb48)) 
    778794                                $thumb48 = $this->mkEventHandlerURL(array( 
    779795                                                'event' => 'thumbnail', 
     
    784800                                                'filter' => $mime_filter 
    785801                                        )); 
     802                                         
     803        if(!isset($thumb250)) 
    786804                                $thumb250 = $this->mkEventHandlerURL(array( 
    787805                                                'event' => 'thumbnail', 
     
    27982816         *                             thumbnail. 
    27992817         */ 
    2800         public function getThumb($legal_url, $path, $width, $height) 
     2818        public function getThumb($legal_url, $path, $width, $height, $onlyIfExists = FALSE) 
    28012819        { 
    28022820                $thumb = $this->generateThumbName($legal_url, $width); 
     
    28042822                if (!is_file($thumbPath)) 
    28052823                { 
     2824      if($onlyIfExists) return FALSE; 
     2825       
    28062826                        if (!file_exists(dirname($thumbPath))) 
    2807                         { 
     2827                        {         
    28082828                                @mkdir(dirname($thumbPath), $this->options['chmod'], true); 
    28092829                        } 
  • branches/MootoolsFileManager-Update/plugins/MootoolsFileManager/mootools-filemanager/Source/FileManager.js

    r1302 r1304  
    15241524            new FileManager.Request({ 
    15251525              url: file.thumbnail + '&asJson=1', 
    1526               onComplete: function(j) { 
    1527                 console.log(list_row.getElement('span.fm-thumb-bg')); 
     1526              onComplete: function(j) {                 
    15281527                if(!j || !j.status) 
    15291528                { 
Note: See TracChangeset for help on using the changeset viewer.