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

    I am not realy sure that understood 2nd question. What do you mean "decorated"? Do you need additional html-markup to your thumbs or what?

    With this config all classes will be copied from Tiny to thumb.

    before: <img src="assets/original.jpg" width="400" height="100" class="left" />

    after: <img src="some_cached_image" width="100" height="25" class="left" /> <-- "left" was copied

    And 1st question:

    Yes, DR can work without specifying width or height. You need to use $dr_local [ "thumb_use_defaults"] parameter.

    $dr_local["thumb_width"]["all"] = 100; // default dimensions
    $dr_local["thumb_height"]["all"] = 20;
    $dr_local ["thumb_use_defaults"]["all"] = 4; // override original dimensions
    


    With this parameters original width and height of the images will be overrrided by default from config. If you set

    $dr_local ["thumb_use_defaults"]["all"] = 1

    then DR will use thumb_width and humb_height only if original width and height are both empty.

    By default

    $dr_local ["thumb_use_defaults"] = 0

    and thumb_width and humb_height are not used.
      DirectResize 0.9 beta. PHPThumb, sets of configurations, configuration, binded to specific path. No backward compatibility. | DirectResize 0.9. PHPThumb, наборы параметров, параметры, привязанные к определенным путям. Без обратной совместимости.

      Unfortunately, DirectResize project is closed. If you want to continue development, PM me for access to project page on Google Code. К сожалению, проект DirectResize закрыт. Если вы желаете продолжить разработки, обращайтесь через ПМ для получения доступа к репозиторию на Google Code.

      [PLUGIN] DirectResize - as Maxigallery but for single images :: Download :: [url=http://modxcms.com/forums/index.php/topic,21490]
      • 4414
      • 63 Posts
      Hi Metaller,

      Thanks for your reply!

      Just to make sure I understood what you said: Adding $dr_local ["thumb_use_defaults"]["all"] = 4 to , for example thickbox.config.php I would be able to resize images in TinyMCE using the mouse and having DirectResize store these thumbnails?

      As for the CSS, what I want to do is pick different CSS classes from the TinyMCE style menu for different images just as I normally do. Therefore it would not help specifying a global CSS class in the DirectResize settings.

      Looking forward to your reply!

      Stefan
        • 19164
        • 1,215 Posts
        Hi.

        You can resize images in TinyMCE using the mouse with default settings of DR - just try, You can pick different CSS classes from the TinyMCE by default. You can add this classes form Tiny settings as you know. All this classes will be copied to thumbs, generated by DR.

        For example - you have this image in your source code

        <img src="assets/original.jpg" width="400" height="100"/>

        If you resized it with mouse - Tiny will change this code something like this:

        <img src="assets/original.jpg" width="100" height="25" />

        If you chose some class form Tiny dropdown menu - Tiny will added this class to source code -

        <img src="assets/original.jpg" width="400" height="100" class="some_class" />

        Save doc and go to your site.

        DR automatically generate thumb from this code with default settings and new option "thumbonly" from first post:

        <img src="some_cached_image" width="100" height="25" class="left" />

        As you see - final image has width and height, that you set by mouse and class that you select from dropdown menu.

        Unfortunately, with my knowledge of English i can’t to say more.
          DirectResize 0.9 beta. PHPThumb, sets of configurations, configuration, binded to specific path. No backward compatibility. | DirectResize 0.9. PHPThumb, наборы параметров, параметры, привязанные к определенным путям. Без обратной совместимости.

          Unfortunately, DirectResize project is closed. If you want to continue development, PM me for access to project page on Google Code. К сожалению, проект DirectResize закрыт. Если вы желаете продолжить разработки, обращайтесь через ПМ для получения доступа к репозиторию на Google Code.

          [PLUGIN] DirectResize - as Maxigallery but for single images :: Download :: [url=http://modxcms.com/forums/index.php/topic,21490]
          • 4414
          • 63 Posts

          Hi Metaller,

          Thanks to your detailed explanation everything has become much clearer now!

          I installed DirectResize as described in the Google translation of the 0.9 version’s readme file and changed thickbox.config.php to the following:
          <?php
          $dr_global["path"] = "
          assets/images/
          ";
          
          $dr_local["tpl_thumb"]["all"] = <<<HTML
          [+dr.shortcut.source2thumb+]
          HTML;
          
          $dr_local["thumbonly"]["all"] = true;
          
          $dr_local["thumb_width"]["all"] = 100; // default dimensions
          $dr_local["thumb_height"]["all"] = 20;
          $dr_local ["thumb_use_defaults"]["all"] = 4; // override original dimensions
          
          ?>

          Then I opened a page in TinyMCE, added some images and resized them using the mouse. However, after saving and opening the site in my browser non of the original images had been replaced by thumbnails. Image properties still showed something like 146px × 269px (scaled to 122px × 197px) and /assets/snippets/phpthumb/cache was empty.

          Maybe you have an idea of what went wrong here?

          By the way, your English is very good and definitely better than mine. Its just that I am not a PHP programmer so some of these settings are a bit confusing to me.

          Best regards,

          Stefan
            • 19164
            • 1,215 Posts
            Hi Stefan.

            You don’t need to use thumb_use_defaults with Tiny. Tiny always set width and height of the images.

            With $dr_local ["thumb_use_defaults"]["all"] = 4; source width and height are ignored and default thumb_width and thumb_height are used instead.

            1st Is DR is correctly installed and all eventsy correctly checked on plugin events tab?

            2nd Are the original images in assets/images/ folder or it subfolders? If not - add allowed pathes to $dr_global["path"] parameter on new lines.
              DirectResize 0.9 beta. PHPThumb, sets of configurations, configuration, binded to specific path. No backward compatibility. | DirectResize 0.9. PHPThumb, наборы параметров, параметры, привязанные к определенным путям. Без обратной совместимости.

              Unfortunately, DirectResize project is closed. If you want to continue development, PM me for access to project page on Google Code. К сожалению, проект DirectResize закрыт. Если вы желаете продолжить разработки, обращайтесь через ПМ для получения доступа к репозиторию на Google Code.

              [PLUGIN] DirectResize - as Maxigallery but for single images :: Download :: [url=http://modxcms.com/forums/index.php/topic,21490]
              • 4414
              • 63 Posts

              Hi Metaller,

              My image folder is indeed a subfolder of assets/image so I changed the $dr_global["path"] parameter accordingly and also removed the $ dr_local [ "thumb_use_defaults"] parameters as you can see here:
              <?php
              $dr_global["path"] = "
              assets/images/sovonex
              ";
              
              $dr_local["tpl_thumb"]["all"] = <<<HTML
              [+dr.shortcut.source2thumb+]
              HTML;
              
              $dr_local["thumbonly"]["all"] = true;
              
              ?>

              Unfortunately, DirectResize is still not working and phpthumb/cache is still empty.

              The following are the installation steps of my DirectResize install. Maybe you can find a mistake there:

              • Moved the directresize folder to assets/plugins
              • Moved the phpthumb folder to assets/snippets
              • sudo chmod 777 assets/snippets/phpthumb/cache
              • Copied the text of assets/plugins/directresize/directresize.php into the plugin code area of a newly set up DirectResize plugin in the modx manager (I later removed the "<?php" one line 1 and the "?>" at the end because I got the following error message: Parse error, unexpected ’<’)
              • Plugin "Configuration" settings: &config = Configuration; string; thickbox
              • Plugin "System Events" settings: OnWebPagePrerender, OnBeforeDocFormSave, OnDocFormPrerender

              Thanks again for your help so far!

              Stefan
                • 19164
                • 1,215 Posts
                No, you must to paste directResize.plugin.txt in the plugin code area, not directResize.php.

                Try it.
                  DirectResize 0.9 beta. PHPThumb, sets of configurations, configuration, binded to specific path. No backward compatibility. | DirectResize 0.9. PHPThumb, наборы параметров, параметры, привязанные к определенным путям. Без обратной совместимости.

                  Unfortunately, DirectResize project is closed. If you want to continue development, PM me for access to project page on Google Code. К сожалению, проект DirectResize закрыт. Если вы желаете продолжить разработки, обращайтесь через ПМ для получения доступа к репозиторию на Google Code.

                  [PLUGIN] DirectResize - as Maxigallery but for single images :: Download :: [url=http://modxcms.com/forums/index.php/topic,21490]
                  • 4414
                  • 63 Posts
                  Hi Metaller,

                  Your were right, of course! I somehow "lost" the file directResize.plugin.txt during copying the plugin to the server. Later when I could not find this file, I thought maybe you just meant directResize.php and that there was something wrong with the Google translation wink

                  Now finally everything is working fine! Thanks again for your great support!

                  Best regards,

                  Stefan
                    • 6561
                    • 139 Posts
                    I followed all installation instructions, but if I insert an image no thumbnail or link is created.

                    Is it like this:
                    - In TinyMCE when inserting an image, put a label in image field, e.g. alt="drlightbox"
                    - give the image a width and height (will be the width of the thumbnail)

                    Or am I missing something??

                    Also seems to be a typo in the readme:
                    # Create new plugin called DirecrResize and paste the contents of directResize.plugin.txt to it

                    has to be DirectResize I suppose?
                      • 6561
                      • 139 Posts
                      Hi, the plugin for resizing the images works now, but it does not generate any links. I’d like to automatically create thumbnail with link to big image using Slimbox effect.

                      I put the code below in default.config.php

                      And in TinyMCE I specified Width 80, Height 40 and gave ’Description’ (alt tag) the value ’drlightbox’. It does create a thumbnail now but no link...

                      The PHP code:

                      <?php
                      
                      $tpl = <<<HTML
                      <a href="[+dr.bigPath+]" rel="lightbox" title="[+dr.title+]">
                      	<img src="[+dr.thumbPath+]" width="[+dr.thumbWidth+]" height="[+dr.thumbHeight+]" />
                      </a>
                      HTML;
                      
                      $header  = 	'
                      <link rel="stylesheet" href="'.DIRECTRESIZE_PATH.'libs/slimbox/css/slimbox.css" type="text/css" media="screen" />
                      <script type="text/javascript" src="'.DIRECTRESIZE_PATH.'libs/slimbox/js/mootools.js"></script>
                      <script type="text/javascript" src="'.DIRECTRESIZE_PATH.'lang/english.slimbox.js"></script>
                      <script type="text/javascript" src="'.DIRECTRESIZE_PATH.'libs/slimbox/js/slimbox.js"></script>
                      ';
                      									
                      /*
                      Uncomment the line below if you use Maxigallery with slimbox effect in the same site
                      Ðàñêîììåíòèðóéòå ñòðîêó íèæå, åñëè âû èñïîëüçóåòå Maxigallery ñ ýôôåêòîì slimbox íà îäíîì ñàéòå
                      */
                      
                      $maxigallery_jscss_packs = "slimbox";
                      
                      $lightbox_mode = 2;
                      
                      $allow_from="assets/images";
                      
                      $resize_method = 0;
                      ?>
                      


                      The generated HTML:

                      <p><img class="thumbnail" src="/modx/image.php?src=/modx/assets/images/subfolder/myfile.jpg&w=140&h=105&aoe=1&hash=544d8474e6989334eb651954be58da8b" alt="" /></p>
                      


                      If I do ’view image’ in Firefox I get:
                      http://www.unexistingdomain.com/modx/image.php?src=/modx/assets/images/subfolder/myfile.jpg&w=80&h=40&aoe=1&hash=5e74408b86f7ce5bbf4f6e5d65282f17