We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 17460
    • 14 Posts
    Hi

    I’ve performance problems with the DR+PhpThumb combo. When DR creates thumbnails from .jpg sources, the performance is okay. After a page-reload I see the cached pictures very quickly.

    But the processing of .gif sources is slow. It takes about 1 sec just to display the thumb-file (even from cache). And the linked Thickbox needs about 5 sec to display the large image.

    Does anyone else have performance problems with GIF-images? Is there a workaround to improve gif processing performance?
      • 27749
      • 53 Posts
      Quote from: Lammikko at Mar 05, 2010, 08:14 AM

      @smiley: How much content do you have and how big the original images are?

      Hi,
      it’s strange:
      - I create a plain template - html, body, content
      - I do not enter any images (DR just running in behind)
      - I can enter a 1,2 Lorem Ipsum without problems, I can even add some html P and SPANs and it runs well. Even validates..
      - Then I enter 300 Kb of html formatted content which also validates when DR is turned off, but when turned on, modx outputs blank page.
      - Also the cache file is 0kb

      UPDATE:
      - all quotes unified "
      - all shitespaces stripped
      - it must be some kind of special character (diacritics probably) since when I turn the TinyMCE cleanup on and set entity encoding to named it works.
      - now only need to find out what character causes this mess when enterign raw text..
        • 1611
        • 591 Posts
        Ok, Folks! I’ve found the solution.
        If you have situation when images are not shown, and it gets 404 error when you request direct link about http://localhost/images/71b66d67ca7fc17921edd6d88ffb77db/thumb_glav.jpg.

        The solution!

        First, take PhpThumb patch to run on PHP 5.3 https://sourceforge.net/tracker/?func=detail&aid=2991128&group_id=106407&atid=643974
        Copy it to folder /assets/snippets/phpthumb/

        Second is .htaccess file!
        There is a line at the new modx’s .htaccess, that switches off handling of images, and it’s BEFORE the place where Direct Resize documentation prescript to paste Direct Resize rules. See code below.
        <br />Options +FollowSymlinks<br />RewriteEngine On<br />RewriteBase /<br /><br /># Fix Apache internal dummy connections from breaking [(site_url)] cache<br />RewriteCond %{HTTP_USER_AGENT} ^.*internal\ dummy\ connection.*$ [NC]<br />RewriteRule .* - [F,L]<br /><br /># Rewrite domain.com -> www.domain.com -- used with SEO Strict URLs plugin<br />#RewriteCond %{HTTP_HOST} .<br />#RewriteCond %{HTTP_HOST} !^www\.example\.com [NC]<br />#RewriteRule (.*) http://www.example.com/$1 [R=301,L]<br />[color=red]↓ ← Paste here[/color]<br /># DirectResize  Friendly URLs part<br />RewriteCond %{REQUEST_FILENAME}	!-f<br />RewriteRule ^images/([a-z0-9]{32})/.*\.(png|gif|jpe{0,1}g)$ assets/plugins/directresize/furl.php?q=$1 [NC,L,QSA]<br /><br /># Exclude /assets and /manager directories and images from rewrite rules<br />RewriteRule ^(manager|assets)/*$ - [L]<br />[color=red]↓↓↓ That’s the line. It switches off image handling[/color]<br />RewriteRule \.(jpg|jpeg|png|gif|ico)$ - [L]<br />[color=red]← Here the place to past coming from documentation. Do not paste here![/color]<br /># For Friendly URLs<br />RewriteCond %{REQUEST_FILENAME} !-f<br />RewriteCond %{REQUEST_FILENAME} !-d<br />RewriteRule ^(.*)$ index.php?q=$1 [L,QSA]<br /><br /># Reduce server overhead by enabling output compression if supported.<br />#php_flag zlib.output_compression On<br />#php_value zlib.output_compression_level 5<br />
          • 26931
          • 2,314 Posts
          Hey Andrey, thanks for posting the fix! smiley
            • 23510
            • 168 Posts
            Hi

            I’m hoping someone can help. Images processed by directresize are broken. It was working before. Nothing is wrong with phpthumb. Demos work. If I go to

            http://enterprisestlucia.com/home/images/6600a3d7fb7365a73b0ce66d64622f4c/thumb_bannerad.jpg

            I get a 404.

            However, going to http://enterprisestlucia.com/home/assets/plugins/directresize/furl.php?q=6600a3d7fb7365a73b0ce66d64622f4c displays the image. Something is broken somewhere - not sure what.
              • 23510
              • 168 Posts
              Update - fixed

              The problem was with godaddy. I needed to add:

              Options -MultiViews

              to my htaccess. What has me pissed is that it was working before WITHOUT that line and let me to think the problem was something I did.
                • 6228
                • 249 Posts
                For anyone interested, I refactored and minimized DirectResize for an Evo 1.0.3 site project.

                My new version isn’t for everyone; it has no phx, lightbox or template support (at the moment). But it does do a fast and very efficient job of resizing, resampling and caching images.

                If anyone has a dire need for a simple and stable thumbnail generator, feel free to pm me for a copy of the plugin. It’s still beta; once properly debugged and documented hopefully the repository will accept it smiley

                - Mike
                  lo9on.com

                  MODx Evolution/Revolution | Remote Desktop Training | Development
                  • 3232
                  • 380 Posts
                  Quote from: Bytesource at May 18, 2009, 02:18 AM

                  Quote from: Bytesource at May 17, 2009, 02:23 PM

                  I finally found out why DirectResize seemed to ignore my configuration file.
                  Unfortunately not. Now whenever I open a document in the modx manager the following warning pops up:

                  DirectResize - OnDocFormPrerender
                  An error occurred while loading. Please see the event log for more information


                  In the event log at Reports/System Events I then found the following logs for DirectResize - Plugin:

                  • Use of undefined constant which_editor - assumed ’which_editor’
                  • Use of undefined constant DIRECTRESIZE_PATH - assumed ’DIRECTRESIZE_PATH’

                  Apart from these error messages, DirectResize seems to work as usual. However, there is definitely something wrong here, otherwise I would not get a warning every time I open or save a document.

                  Any idea what might be the problem?

                  Best regards,

                  Stefan

                  Edit:
                  When I go to Resources/Manage Resources/Plugins/DirectResize --> Configuration and remove the content DirectResize &config = Configuration; string;thumb the error messages stop and DirectResize seems to just use the default configuration set in directResize.php

                  The name of my configuration file is thumb.config.php.
                  <?php
                  
                  $dr_global["path"] = "assets/images/sovonex";
                  
                  $dr_local["tpl_thumb"]["all"] = "[+dr.shortcut.source2thumb+]";
                  
                  $dr_local["thumbonly"]["all"] = true;
                  
                  $dr_local["thumb_quality"]["all"] = 95;
                  
                  ?>


                  Could it be that there is something wrong with the file name (upper/lower case error) or the content (my command of php is quite limited so I just did some copy&paste here)?



                  Did you ever find a solution to this? I am moving a site to a different server and on this new server I get the same exact system log error "Use of undefined constant which_editor - assumed ’which_editor’"
                    • 6228
                    • 249 Posts
                    betoranaldi, those look like easily correctible syntax errors. In the MODx plugin code:

                    Replace:
                    define(DIRECTRESIZE_PATH, "assets/plugins/directresize/");
                    define(DIRECTRESIZE_GALLERYDIR, "assets/drgalleries/");
                    
                    With
                    define('DIRECTRESIZE_PATH', "assets/plugins/directresize/");
                    define('DIRECTRESIZE_GALLERYDIR', "assets/drgalleries/");
                    
                    And replace:
                    if (($modx->config[which_editor] != "none" && empty($_POST)) || (isset($_POST[which_editor]) && $_POST[which_editor]!="none"))
                    
                    With
                    if (($modx->config['which_editor'] != "none" && empty($_POST)) || (isset($_POST['which_editor']) && $_POST['which_editor']!="none"))
                      lo9on.com

                      MODx Evolution/Revolution | Remote Desktop Training | Development
                      • 3232
                      • 380 Posts
                      Quote from: cyclissmo at Jun 15, 2010, 11:50 PM

                      betoranaldi, those look like easily correctible syntax errors. In the MODx plugin code:

                      Replace:
                      define(DIRECTRESIZE_PATH, "assets/plugins/directresize/");
                      define(DIRECTRESIZE_GALLERYDIR, "assets/drgalleries/");
                      
                      With
                      define('DIRECTRESIZE_PATH', "assets/plugins/directresize/");
                      define('DIRECTRESIZE_GALLERYDIR', "assets/drgalleries/");
                      
                      And replace:
                      if (($modx->config[which_editor] != "none" && empty($_POST)) || (isset($_POST[which_editor]) && $_POST[which_editor]!="none"))
                      
                      With
                      if (($modx->config['which_editor'] != "none" && empty($_POST)) || (isset($_POST['which_editor']) && $_POST['which_editor']!="none"))


                      Thank you, I feel like an idiot now. I was looking in every file except the plugin itself.