We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 3232
    • 380 Posts
    What happened to the old forum posts?

    A few months ago I was having an issue with directresize and it not working in php 5.3 dues to deprecations. I believe I found a solution at http://modxcms.com/forums/index.php?topic=19236.165 but decided to revisit it when I had a little more time on my hands.

    Fast forward to today, the post is gone and it appears I am out of luck. Does anyone know what needs to be changed in this plugin in order to get it working under php 5.3?

      • 3749
      • 24,544 Posts
      What is the error message you're getting?

      Do you have DirectResize 1.1-rc2?
        Did I help you? Buy me a beer
        Get my Book: MODX:The Official Guide
        MODX info for everyone: http://bobsguides.com/modx.html
        My MODX Extras
        Bob's Guides is now hosted at A2 MODX Hosting
        • 3232
        • 380 Posts
        This is actually for Evo, which 1.1 isn't compatible with (that is what I am assuming) I ended up taking .9 and converting all of the deprecated functions. Will post the file here later tonight.
          • 3232
          • 380 Posts
          If anyone else is looking for it, attached is the updated plugin (v.9) that is compatible with PHP 5.3
            • 6038
            • 228 Posts
            christianhanvey Reply #5, 15 years ago
            I couldn't see the attachment Brian mentioned available, but I have also managed to adapt DirectResize 0.8 to work with php5.3 - basically by going through the main class and replacing all outdated ereg functions with preg equivalents - for example:

            open file assets/plugins/directresize/directresize.php
            find:
            $imgHTMLHeight = ereg_replace("[^0123456789]","",$array[0]);

            change to:
            $imgHTMLHeight = preg_replace("/[^0123456789]/","",$array[0]);


            I'm not sure if the changes are exactly the same for 0.9, but they may well be.
              • 9995
              • 1,613 Posts
              fourroses666 Reply #6, 15 years ago
              im looking for a fix too for phpthumb.

              i get a error on this line:
              $PHPTHUMB_CONFIG['document_root'] = realpath((getenv('DOCUMENT_ROOT') && ereg('^'.preg_quote(realpath(getenv('DOCUMENT_ROOT'))), realpath(__FILE__))) ? getenv('DOCUMENT_ROOT') : str_replace(dirname(@$_SERVER['PHP_SELF']), '', str_replace(DIRECTORY_SEPARATOR, '/', dirname(__FILE__))));


              Maybe someone knows how i can fix this?

              Looks like the fix is still open..
              http://sourceforge.net/tracker/?group_id=106407&atid=643974
              [ed. note: fourroses666 last edited this post 15 years ago.]
                Evolution user, I like the back-end speed and simplicity smiley
                • 3749
                • 24,544 Posts
                Quote from: fourroses666 at Nov 06, 2011, 05:09 PM
                im looking for a fix too for phpthumb.

                Try this (untested) :
                $PHPTHUMB_CONFIG['document_root'] = realpath((getenv('DOCUMENT_ROOT') && preg_match('#^'.preg_quote(realpath(getenv('DOCUMENT_ROOT'))) . '#', realpath(__FILE__))) ? getenv('DOCUMENT_ROOT') : str_replace(dirname(@$_SERVER['PHP_SELF']), '', str_replace(DIRECTORY_SEPARATOR, '/', dirname(__FILE__))));


                Also, see this: http://devthought.com/2009/06/09/fix-ereg-is-deprecated-errors-in-php-53/. I used '#' as the delimiter rather than a slash because it's looking at a path.
                  Did I help you? Buy me a beer
                  Get my Book: MODX:The Official Guide
                  MODX info for everyone: http://bobsguides.com/modx.html
                  My MODX Extras
                  Bob's Guides is now hosted at A2 MODX Hosting
                  • 9995
                  • 1,613 Posts
                  fourroses666 Reply #8, 15 years ago
                  Thanks, the error is gone, but i can't see any images sad
                  <img src="" />


                  any suggestions?

                  really need to scale/resize my EVO images
                    Evolution user, I like the back-end speed and simplicity smiley
                    • 3749
                    • 24,544 Posts
                    There may be a number of ereg and ereg_replace calls in the file. They all need to be fixed. I know that's the case with directresize.

                      Did I help you? Buy me a beer
                      Get my Book: MODX:The Official Guide
                      MODX info for everyone: http://bobsguides.com/modx.html
                      My MODX Extras
                      Bob's Guides is now hosted at A2 MODX Hosting
                      • 9995
                      • 1,613 Posts
                      gladly its fixed laugh

                      thanks for your effort Bob.

                      https://forums.modx.com/index.php?topic=43077.0
                        Evolution user, I like the back-end speed and simplicity smiley