We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
  • Anybody knows how to work phpthumb with PHP 5.3.0?

    Tried replacing ereg with preg_match but it outputs me the following error:
    MODx encountered the following error while attempting to parse the requested resource:
    « PHP Parse Error »
     
    PHP error debug
      Error:	preg_match() [function.preg-match]: No ending delimiter '^' found	 
      Error type/ Nr.:	Warning - 2	 
      File:	M:\xampp\htdocs\test\assets\snippets\phpthumb\phpThumb.config.php	 
      Line:	30	 
      Line 30 source:	$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__))));
      BASE - Web Design Studio
      MODX Ambassador

      Website
      • 22668
      • 718 Posts
      Hi laugh
      I have same problem right here and right now wink
      I’m not sure, but try to replace 30 string with new one

      Code updated.
      $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__))));


      Must work with PHP 5.2 and 5.3.
      Post here if it doesn’t.

      UPD Config file attached. PS. Don’t forget to modify settings for your needs.
        • 22668
        • 718 Posts
        Found working phpThumb package (php 5.3.0)
        (eregi, ereg, var vs public, etc - all done)
        Use at your own risk.

        (and, of course, don’t forget about the new line from my previous post)
        • I abandoned this for the near future (hopefully from MODx repository) smiley

          I’m now running on 5.2.10 and it’s all fine... good for me smiley
            BASE - Web Design Studio
            MODX Ambassador

            Website
            • 14617
            • 47 Posts
            Quote from: Paprikas at Dec 05, 2009, 07:51 PM

            Found working phpThumb package (php 5.3.0)
            (eregi, ereg, var vs public, etc - all done)
            Use at your own risk.

            (and, of course, don’t forget about the new line from my previous post)

            This worked for me. I just replaced all the files in the phpThumb dir. The package doesn’t have a config so it will not overwrite your config file.
            Thanks!
              • 22295
              • 153 Posts
              I can also confirm the attached yip by Paprikas works in php 5.3
              thanks
                • 22668
                • 718 Posts
                Added fix with config file to sourceforge.
                https://sourceforge.net/tracker/?func=detail&aid=2991128&group_id=106407&atid=643974
                  • 36805
                  • 354 Posts
                  Long time I have been thinking phpthumb is not actively maintained. Turns out i was wrong, however it moved to a new location without clear statement on the old site. (I had to find out by a tiny comment on the sourceforge page)

                  There you can get a recent official & compatible release.

                  EDIT: Before someone tries this, note that it is different library. Also it does not come with the important cache feature. Use Paprikas fix instead.
                    • 3932
                    • 19 Posts
                    Thank you, Paprikas!
                    It works for me!
                      • 9995
                      • 1,613 Posts
                      didn't work with me in first place, i added a /cache map into the snippets/phpthumb map and also change the snippet.

                      (uploaded this)
                      http://sourceforge.net/tracker/?func=detail&aid=2991128&group_id=106407&atid=643974

                      http://forums.modx.com/index.php?topic=50518.0
                      Manu, Reply #4, 10 months, 1 week ago [ed. note: fourroses666 last edited this post 12 years, 5 months ago.]
                        Evolution user, I like the back-end speed and simplicity smiley