We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 13218
    • 134 Posts
    Hi,
    after moving a working site from modxcloud to shared hosting, thumb creation stopped working.
    I was using phpthumbsup.
    To narrow down the problem i installed a fresh 2.2.11 with only phpthumbof. Same problem.

    The issue in detail:
    a thumb is created, but has the filesize 0.
    The original image is uploaded via file manager, has the correct permissions, is readable via php/getimagesize. Same file worked on modxcloud.
    Server has GD installed, no ImageMagick.

    Image is called like this:
    <img src="[[phpthumbof? &input=`assets/pic1.jpg` &options=`&h=150` &debug=`1` ]]">

    returns this:
    <img src="/assets/components/phpthumbof/cache/pic1.e0e3bbad469d6f30477db27e3127aff61.jpg">


    Debug message is this:
     [2014-02-19 17:00:53] (DEBUG @ /index.php) 
    <br />Execution time: 0.0001 s
    <br />


    Any ideas? [ed. note: itWillBeOk last edited this post 10 years, 2 months ago.]
      @itWilllBeOK
      • 30912
      • 463 Posts
      Firstly, use pThumb or phpThumbsUp - phpThumbOf is quite old and no longer support (i dont think).

      Secondly, there is a bug in the phpthumb class that is installed with 2.2.11

      You could try the suggested here:

      http://forums.modx.com/thread/88743/phpthumbsup-not-working-after-update-to-2-2-11-pl?page=3#dis-post-490129
        • 13218
        • 134 Posts
        Ok, i tried pthumb again. Deinstalled phpthumbof first, installed pthumb.
        Same thing - thumb file is created, filesize 0.

        I got some more debug info though:
         [2014-02-19 18:44:19] (ERROR @ /index.php) [pThumb] Resource: 1 || Image: /is/htdocs/wp1021081_0ET0SIB6EZ/xxx/assets/pic1.jpg
        Could not cache thumbnail to file at: /is/htdocs/wp1021081_0ET0SIB6EZ/xxx/assets/components/phpthumbof/cache/pic1.6fd0bb3533a938f2196308618d9b6822.jpg
        phpThumb debug output:
            [0] => phpThumb() v1.7.11-201108081537 in file "phpthumb.class.php" on line 216
            [1] => setSourceFilename(/is/htdocs/wp1021081_0ET0SIB6EZ/xxx/assets/pic1.jpg) set $this->sourceFilename to "/is/htdocs/wp1021081_0ET0SIB6EZ/xxx/assets/pic1.jpg" in file "phpthumb.class.php" on line 262
            [2] =>                   file_exists() = 0 in file "phpthumb.class.php" on line 1165
            [3] => file_exists_ignoreopenbasedir() = 0 in file "phpthumb.class.php" on line 1166
            [4] =>                       is_file() = 0 in file "phpthumb.class.php" on line 1167
            [5] =>                 is_executable() = 0 in file "phpthumb.class.php" on line 1168
            [6] => using ImageMagick path from `which convert` (/usr/bin/convert) in file "phpthumb.class.php" on line 1188
            [7] => ImageMagick version checked with "convert --version" in file "phpthumb.class.php" on line 1215
            [8] => ImageMagick did not return recognized version string (whoami: cannot find name for user ID 1021081
        /usr/bin/convert: line 4: 2: Permission denied) in file "phpthumb.class.php" on line 1221
            [9] => ImageMagick convert --version says "" in file "phpthumb.class.php" on line 1223
            [10] => $AvailableImageOutputFormats = array(text;ico;bmp;wbmp;gif;png;jpeg) in file "phpthumb.class.php" on line 923
            [11] => $this->thumbnailFormat set to $this->config_output_format "jpeg" in file "phpthumb.class.php" on line 934
            [12] => $this->thumbnailFormat set to $this->f "jpeg" in file "phpthumb.class.php" on line 941
            [13] => $this->thumbnailQuality set to "75" in file "phpthumb.class.php" on line 951
            [14] => $this->sourceFilename set to "/is/htdocs/wp1021081_0ET0SIB6EZ/xxx/assets/pic1.jpg" in file "phpthumb.class.php" on line 852
            [15] => setCacheDirectory() starting with config_cache_directory = "/is/htdocs/wp1021081_0ET0SIB6EZ/xxx/assets/components/phpthumbof/cache/" in file "phpthumb.class.php" on line 958
            [16] => setting config_cache_directory to realpath(/is/htdocs/wp1021081_0ET0SIB6EZ/xxx/assets/components/phpthumbof/cache) = "/is/htdocs/wp1021081_0ET0SIB6EZ/xxx/assets/components/phpthumbof/cache" in file "phpthumb.class.php" on line 986
            [17] => SetCacheFilename() _src set from md5($this->sourceFilename) "/is/htdocs/wp1021081_0ET0SIB6EZ/xxx/assets/pic1.jpg" = "c2c327fa2d89ea7285cc6dca3f284944" in file "phpthumb.class.php" on line 3238
            [18] => SetCacheFilename() _par set from md5(_farC_h150_dpi150_q75) in file "phpthumb.class.php" on line 3271
            [19] => starting ExtractEXIFgetImageSize() in file "phpthumb.class.php" on line 3033
            [20] => GetImageSize(/is/htdocs/wp1021081_0ET0SIB6EZ/xxx/assets/pic1.jpg) says image is 612x612 in file "phpthumb.class.php" on line 3043
            [21] => $this->useRawIMoutput=true after checking $UnAllowedParameters in file "phpthumb.class.php" on line 1315
            [22] => phpThumb_tempnam() returning "/is/htdocs/wp1021081_0ET0SIB6EZ/xxx" in file "phpthumb.class.php" on line 4070
            [23] => ImageMagickSwitchAvailable(thumbnail) = 0 in file "phpthumb.class.php" on line 1255
            [24] => IMuseExplicitImageOutputDimensions = 0 in file "phpthumb.class.php" on line 1390
            [25] => ImageMagickSwitchAvailable(density) = 0 in file "phpthumb.class.php" on line 1255
            [26] => GetImageSize(/is/htdocs/wp1021081_0ET0SIB6EZ/xxx.de/assets/pic1.jpg) SUCCEEDED: Array
        (
            [0] => 612
            [1] => 612
            [2] => 2
            [3] => width="612" height="612"
            [bits] => 8
            [channels] => 3
            [mime] => image/jpeg
        )
         in file "phpthumb.class.php" on line 1407
            [27] => GetImageSize(/is/htdocs/wp1021081_0ET0SIB6EZ/xxx/assets/pic1.jpg) returned [w=612;h=612;f=2] in file "phpthumb.class.php" on line 1412
            [28] => source dimensions set to 612x612 in file "phpthumb.class.php" on line 1415
            [29] => SetOrientationDependantWidthHeight() starting with "612"x"612" in file "phpthumb.class.php" on line 3012
            [30] => SetOrientationDependantWidthHeight() setting w="0", h="150" in file "phpthumb.class.php" on line 3028
            [31] => Remaining $this->fltr after ImageMagick: (array(0) { } ) in file "phpthumb.class.php" on line 1939
            [32] => ImageMagickSwitchAvailable(quality;interlace) = 0 in file "phpthumb.class.php" on line 1252
            [33] => ImageMagick called as (convert -background '#FFFFFF' -resize 'x150' '/is/htdocs/wp1021081_0ET0SIB6EZ/xxx/assets/pic1.jpg[0]' jpeg:'/is/htdocs/wp1021081_0ET0SIB6EZ/xxx' 2>&1) in file "phpthumb.class.php" on line 1958
            [34] => GetImageSize(/is/htdocs/wp1021081_0ET0SIB6EZ/xxx) returned [w=;h=;f=] in file "phpthumb.class.php" on line 1975
            [35] => $this->useRawIMoutput set to TRUE because ImageCreateFromJPEG(/is/htdocs/wp1021081_0ET0SIB6EZ/xxx) failed in file "phpthumb.class.php" on line 1985
            [36] => Skipping rest of GenerateThumbnail() because ($this->useRawIMoutput == true) in file "phpthumb.class.php" on line 337
            [37] => RenderOutput copying $this->IMresizedData (0 bytes) to $this->outputImage in file "phpthumb.class.php" on line 439
        ----------------------
        


        It says in line 2 'could not cache file', but file is created.
        It seems like ImageMagick is used, but it is not installed, at least i can't see it in phpinfo() anf function_exists("NewMagickWand") returns false.

        At [33]: does it somehow lose the cachefilename and path to cache directory?

        Maybe i should just switch hosts...
          @itWilllBeOK
          • 13218
          • 134 Posts
          Thumbs are now working, thanks to pthumbs option of using Resizer instead of phpthumb (hint from @empiguet, thx).
          So here's to hoping that Resizer is stable and let's just wait until the whole phpthumb-falsiness blows over.
            @itWilllBeOK
            • 30912
            • 463 Posts
            Glad you got it sorted.
              • 13218
              • 134 Posts
              Update on the matter:
              ImageMagick is required to run phpthumbof (and pthumb without resizer).
              It's not optional as it is with plain phpthumb.

              (That's also what it says in rtfm. I should read that once in a while.)
                @itWilllBeOK
              • Actually ImageMagick is not required, only GD. PhpThumbOf, pThumb, etc. don't do any of the real image manipulation themselves; they pass it off to a lower-level class: phpThumb (or optionally Resizer in the case of pThumb). They use the phpThumb class that comes with MODX, which is a slightly modified version of the original.

                For anybody not clear on how everything sorts out—and it is confusing—I wrote a little taxonomy.

                If thumbnails aren't working on a server with only GD installed, it's some problem with the server's configuration. It should work in theory, and does on a lot of sites in practice as well. But, there's always a few weird ones smiley
                  Extras :: pThumbResizerimageSlimsetPlaceholders
                  • 13218
                  • 134 Posts
                  Let me rephrase then: what i said is sometimes true, sometimes it's not.

                  Three cheers for the weird ones, then!
                  (As if life wasn't weird enogh already...)
                    @itWilllBeOK
                  • I took a look at the debug log above. The problem arises because ImageMagick is installed, but you don't have permission to run it from the command line. See line 13: /usr/bin/convert: line 4: 2: Permission denied) in file "phpthumb.class.php" on line 1221. Convert is part of ImageMagick. So phpThumb finds it installed (lines 10–11) and tries to use it, but fails, so the thumbnail can't be created. If you didn't have ImageMagick installed, phpThumb would stick with GD and things would be fine. Having ImageMagick installed but not useable messes things up for phpThumb.

                    Resizer uses ImageMagick via the Imagick PHP extension, so it doesn't have to exec any command-line programs and doesn't run into problems on this server.

                    RTFM does now say ImageMagick is required, but that's not correct. It used to say it's recommended, which is correct. (Especially if it's a relatively recent version of IM. There are some ancient and buggy ones out there...). Also, ImageMagick is not a PHP extension, that's Imagick.
                      Extras :: pThumbResizerimageSlimsetPlaceholders
                      • 13218
                      • 134 Posts
                      I see (i think).
                      So it's probably a security thing?
                      The problem showed on a shared webspace. I now tried the same thing on a virtual server at the same hosting company, and there everything is peachy. But shared space is mostly more restricted, i guess?

                      Strangely though the support said, ImageMagick is not installed on shared space. But maybe they meant to say: look but don't touch.
                        @itWilllBeOK