We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 15202
    • 6 Posts
    Hi,
    I'm using getResources to make a news page with a thumbnail, introtext and a 'read more...' link to get to the full article. The thumbnail is chosen in a template variable (name: tv-page-thumb). It's working. ONly problem is that the thumbnail isn't scaled down.

    The html output should be like that (from another site of mine where everything works fine (see: www.jcerbach.de/news)):
    <img alt="Südwestdeutsche Einzelmeisterschaft Judo" src="/assets/components/phpthumbof/cache/swdem-2013.a005325485a71f14f36f2f5bc0e66ee563.jpg" title="Südwestdeutsche Einzelmeisterschaft Judo">


    ... but it is:
    <img alt="Milch macht Schule" src="/sassite/assets/images/editorimg/news-archiv/2013/k-p3060323.JPG" title="Milch macht Schule">

    For whatever reason MODX is giving the path to the original (big) image instead of the the path to the small thumbnail. I have copied everything (chunks, tvs,...) from that working website to the one with the problem. Phpthumbof is installed. The folder phpthumbof/cache has the permission 755 (just like the website that's working).

    Here's my template:

    <div class="getRes">
    <table class="aktuelles" style="width: 100%;" border="0">
    <tbody>
    [[!getResources?
    &showHidden=`0`
    &tpl=`getResTpl`
    &limit=`40`
    &includeContent=`0`
    &includeTVs=`1`
    &processTVs=`1`
    &sortby=`menuindex`
    &sortdir=`ASC` ]]
    </tbody>
    </table>
    </div>


    and my chunk getResTpl:

    <tr>
    <td><a href="[[~[[+id]]]]" title="[[+pagetitle]]"><img title="[[+pagetitle]]" src="[[+tv.tv-page-thumb:phpthumbof=`w=111&h=73&zc=1`]]" alt="[[+pagetitle]]" /></a></td>
    <td><h2><a href="[[~[[+id]]]]" title="[[+longtitle]]">[[+longtitle]]</a></h2>
    [[+introtext]] <a href="[[~[[+id]]]]" title="[[+pagetitle]]"> Weiterlesen ... </a></td>
    </tr>


    I've tested phpthumbof without a tv (src="[[!phpthumbof?input=`assets/images/picture.jpg` &options=`w=111&h=73`]]") and it's working.
    I've set phpthumb_allow_src_above_docroot to YES but it didn't help.

    Here's the error log
    [2013-04-27 12:10:24] (ERROR @ /sassite/index.php) [phpThumbOf] Could not generate thumbnail: /sassite/assets/images/editorimg/news-archiv/2013/k-p3060323.JPG - Debug: Array
    (
    [0] => phpThumb() v1.7.9-200712090829 in file "phpthumb.class.php" on line 216
    [1] => setCacheDirectory() starting with config_cache_directory = "/is/htdocs/XXXXXXXXXXX/www/sassite/core/cache/phpthumb/" in file "phpthumb.class.php" on line 919
    [2] => setting config_cache_directory to realpath(/is/htdocs/XXXXXXXXXXX/www/sassite/core/cache/phpthumb) = "/is/htdocs/XXXXXXXXXXX/www/sassite/core/cache/phpthumb" in file "phpthumb.class.php" on line 947
    [3] => setCacheDirectory() starting with config_cache_directory = "/is/htdocs/XXXXXXXXXXX/www/sassite/assets/components/phpthumbof/cache/" in file "phpthumb.class.php" on line 919
    [4] => setting config_cache_directory to realpath(/is/htdocs/XXXXXXXXXXX/www/sassite/assets/components/phpthumbof/cache) = "/is/htdocs/XXXXXXXXXXX/www/sassite/assets/components/phpthumbof/cache" in file "phpthumb.class.php" on line 947
    [5] => setSourceFilename(/sassite/assets/images/editorimg/news-archiv/2013/k-p3060323.JPG) set $this->sourceFilename to "/sassite/assets/images/editorimg/news-archiv/2013/k-p3060323.JPG" in file "phpthumb.class.php" on line 243
    [6] => skipping CleanUpCacheDirectory() set to purge (30.0 days; 100.00MB; 10,000 files) in file "phpthumb.class.php" on line 652
    [7] => file_exists() = 0 in file "phpthumb.class.php" on line 1101
    [8] => is_executable() = 0 in file "phpthumb.class.php" on line 1102
    [9] => using ImageMagick path from `which convert` (/usr/bin/convert) in file "phpthumb.class.php" on line 1121
    [10] => ImageMagick version checked with "convert --version" in file "phpthumb.class.php" on line 1148
    [11] => ImageMagick did not return recognized version string (whoami: cannot find name for user ID 10549213) in file "phpthumb.class.php" on line 1154
    [12] => ImageMagick convert --version says "Unknown" in file "phpthumb.class.php" on line 1157
    [13] => $AvailableImageOutputFormats = array(text;ico;bmp;wbmp;gif;png;jpeg) in file "phpthumb.class.php" on line 884
    [14] => $this->thumbnailFormat set to $this->config_output_format "jpeg" in file "phpthumb.class.php" on line 895
    [15] => $this->thumbnailFormat set to $this->f "jpeg" in file "phpthumb.class.php" on line 902
    [16] => $this->thumbnailQuality set to "75" in file "phpthumb.class.php" on line 912
    [17] => ResolveFilenameToAbsolute() prepending $this->config_document_root (/is/htdocs/XXXXXXXXXXX/www/sassite/) to $filename (/sassite/assets/images/editorimg/news-archiv/2013/k-p3060323.JPG) resulting in ($AbsoluteFilename = "/is/htdocs/XXXXXXXXXXX/www/sassite//sassite/assets/images/editorimg/news-archiv/2013/k-p3060323.JPG") in file "phpthumb.class.php" on line 1025
    [18] => $this->sourceFilename set to "/is/htdocs/XXXXXXXXXXX/www/sassite//sassite/assets/images/editorimg/news-archiv/2013/k-p3060323.JPG" in file "phpthumb.class.php" on line 813
    [19] => phpThumb() v1.7.9-200712090829
    
    "/is/htdocs/XXXXXXXXXXX/www/sassite//sassite/assets/images/editorimg/news-archiv/2013/k-p3060323.JPG" does not exist in file "phpthumb.class.php" on line 3647
    [20] => setCacheDirectory() starting with config_cache_directory = "/is/htdocs/XXXXXXXXXXX/www/sassite/assets/components/phpthumbof/cache" in file "phpthumb.class.php" on line 919
    [21] => setting config_cache_directory to realpath(/is/htdocs/XXXXXXXXXXX/www/sassite/assets/components/phpthumbof/cache) = "/is/htdocs/XXXXXXXXXXX/www/sassite/assets/components/phpthumbof/cache" in file "phpthumb.class.php" on line 947
    [22] => SetCacheFilename() _src set from md5($this->sourceFilename) "/is/htdocs/XXXXXXXXXXX/www/sassite//sassite/assets/images/editorimg/news-archiv/2013/k-p3060323.JPG" = "b18959bc4ec4f6c86cbb791d12bebbc8" in file "phpthumb.class.php" on line 3077
    [23] => SetCacheFilename() _par set from md5(_farC_zc1_h73_w111_dpi150_q75) in file "phpthumb.class.php" on line 3110
    [24] => starting ExtractEXIFgetImageSize() in file "phpthumb.class.php" on line 2897
    [25] => GetImageSize("/is/htdocs/XXXXXXXXXXX/www/sassite//sassite/assets/images/editorimg/news-archiv/2013/k-p3060323.JPG") failed in file "phpthumb.class.php" on line 2920
    [26] => $this->useRawIMoutput=true after checking $UnAllowedParameters in file "phpthumb.class.php" on line 1232
    [27] => phpThumb_tempnam() returning "/is/htdocs/XXXXXXXXXXX/www/sassite/pThumbYaXfgb" in file "phpthumb.class.php" on line 3861
    [28] => ImageMagickSwitchAvailable(thumbnail) = 0 in file "phpthumb.class.php" on line 1189
    [29] => IMuseExplicitImageOutputDimensions = 0 in file "phpthumb.class.php" on line 1299
    [30] => ImageMagickSwitchAvailable(density) = 0 in file "phpthumb.class.php" on line 1189
    [31] => GetImageSize(/is/htdocs/XXXXXXXXXXX/www/sassite//sassite/assets/images/editorimg/news-archiv/2013/k-p3060323.JPG) FAILED with error "" in file "phpthumb.class.php" on line 1318
    [32] => GetImageSize(/is/htdocs/XXXXXXXXXXX/www/sassite//sassite/assets/images/editorimg/news-archiv/2013/k-p3060323.JPG) failed in file "phpthumb.class.php" on line 1460
    [33] => Remaining $this->fltr after ImageMagick: (array(0) { } ) in file "phpthumb.class.php" on line 1807
    [34] => ImageMagickSwitchAvailable(quality;interlace) = 0 in file "phpthumb.class.php" on line 1186
    [35] => ImageMagick called as (convert -resize 111x73 "/is/htdocs/XXXXXXXXXXX/www/sassite//sassite/assets/images/editorimg/news-archiv/2013/k-p3060323.JPG[0]" jpeg:"/is/htdocs/XXXXXXXXXXX/www/sassite/pThumbYaXfgb" 2>&1) in file "phpthumb.class.php" on line 1826
    [36] => ImageMagick failed with message (whoami: cannot find name for user ID 10549213) in file "phpthumb.class.php" on line 1834
    [37] => ImageMagickThumbnailToGD() failed in file "phpthumb.class.php" on line 2927
    [38] => SetOrientationDependantWidthHeight() starting with ""x"" in file "phpthumb.class.php" on line 2876
    [39] => SetOrientationDependantWidthHeight() setting w="111", h="73" in file "phpthumb.class.php" on line 2892
    [40] => EXIF thumbnail extraction: (size=0; type=""; 0x0) in file "phpthumb.class.php" on line 2979
    [41] => starting SourceImageToGD() in file "phpthumb.class.php" on line 3229
    [42] => $this->useRawIMoutput=true after checking $UnAllowedParameters in file "phpthumb.class.php" on line 1232
    [43] => phpThumb_tempnam() returning "/is/htdocs/XXXXXXXXXXX/www/sassite/pThumbYHFdBt" in file "phpthumb.class.php" on line 3861
    [44] => ImageMagickSwitchAvailable(thumbnail) = 0 in file "phpthumb.class.php" on line 1189
    [45] => IMuseExplicitImageOutputDimensions = 0 in file "phpthumb.class.php" on line 1299
    [46] => ImageMagickSwitchAvailable(density) = 0 in file "phpthumb.class.php" on line 1189
    [47] => GetImageSize(/is/htdocs/XXXXXXXXXXX/www/sassite//sassite/assets/images/editorimg/news-archiv/2013/k-p3060323.JPG) FAILED with error "" in file "phpthumb.class.php" on line 1318
    [48] => GetImageSize(/is/htdocs/XXXXXXXXXXX/www/sassite//sassite/assets/images/editorimg/news-archiv/2013/k-p3060323.JPG) failed in file "phpthumb.class.php" on line 1460
    [49] => Remaining $this->fltr after ImageMagick: (array(0) { } ) in file "phpthumb.class.php" on line 1807
    [50] => ImageMagickSwitchAvailable(quality;interlace) = 0 in file "phpthumb.class.php" on line 1186
    [51] => ImageMagick called as (convert -resize 111x73 "/is/htdocs/XXXXXXXXXXX/www/sassite//sassite/assets/images/editorimg/news-archiv/2013/k-p3060323.JPG[0]" jpeg:"/is/htdocs/XXXXXXXXXXX/www/sassite/pThumbYHFdBt" 2>&1) in file "phpthumb.class.php" on line 1826
    [52] => ImageMagick failed with message (whoami: cannot find name for user ID 10549213) in file "phpthumb.class.php" on line 1834
    [53] => starting ImageCreateFromFilename(/is/htdocs/XXXXXXXXXXX/www/sassite//sassite/assets/images/editorimg/news-archiv/2013/k-p3060323.JPG) in file "phpthumb.class.php" on line 3152
    [54] => empty $filename or GetImageSize(/is/htdocs/XXXXXXXXXXX/www/sassite//sassite/assets/images/editorimg/news-archiv/2013/k-p3060323.JPG) failed in file "phpthumb.class.php" on line 3201
    [55] => Populating $rawimagedata in file "phpthumb.class.php" on line 3209
    [56] => cannot fopen(/is/htdocs/XXXXXXXXXXX/www/sassite//sassite/assets/images/editorimg/news-archiv/2013/k-p3060323.JPG) in file "phpthumb.class.php" on line 3212
    [57] => Not using EXIF thumbnail data because $this->exif_thumbnail_data is empty in file "phpthumb.class.php" on line 3278
    [58] => $this->gdimg_source is still empty in file "phpthumb.class.php" on line 3330
    [59] => ImageMagickThumbnailToGD() failed in file "phpthumb.class.php" on line 3332
    [60] => phpThumb() v1.7.9-200712090829
    
    Unknown image type identified by "" () in SourceImageToGD()[3444] in file "phpthumb.class.php" on line 3647
    [61] => SourceImageToGD() failed in file "phpthumb.class.php" on line 323
    ) 


    The German forum pointed me to
    [19] => phpThumb() v1.7.9-200712090829
    
    "/is/htdocs/XXXXXXXXXXX/www/sassite//sassite/assets/images/editorimg/news-archiv/2013/k-p3060323.JPG" does not exist in file "phpthumb.class.php" on line 3647

    where phpthumbof can't find the image. The mistake should be the double "sassite//sassite/..." but I can't figure out where to fix it. The paths in my core/config/config.inc.php seem to be correct (if I delete the "sassite", my manager doesn't work anymore):
    ...
    if (!defined('MODX_CORE_PATH')) {
    $modx_core_path= '/is/htdocs/XXXXXXXXXXXXX/www/sassite/core/';
    define('MODX_CORE_PATH', $modx_core_path);
    }
    if (!defined('MODX_PROCESSORS_PATH')) {
    $modx_processors_path= '/is/htdocs/XXXXXXXXXXXXX/www/sassite/core/model/modx/processors/';
    define('MODX_PROCESSORS_PATH', $modx_processors_path);
    }
    if (!defined('MODX_CONNECTORS_PATH')) {
    $modx_connectors_path= '/is/htdocs/XXXXXXXXXXXXX/www/sassite/connectors/';
    $modx_connectors_url= '/sassite/connectors/';
    define('MODX_CONNECTORS_PATH', $modx_connectors_path);
    define('MODX_CONNECTORS_URL', $modx_connectors_url);
    }
    if (!defined('MODX_MANAGER_PATH')) {
    $modx_manager_path= '/is/htdocs/XXXXXXXXXXXXX/www/sassite/manager/';
    $modx_manager_url= '/sassite/manager/';
    define('MODX_MANAGER_PATH', $modx_manager_path);
    define('MODX_MANAGER_URL', $modx_manager_url);
    }
    if (!defined('MODX_BASE_PATH')) {
    $modx_base_path= '/is/htdocs/XXXXXXXXXXXXX/www/sassite/';
    $modx_base_url= '/sassite/';
    define('MODX_BASE_PATH', $modx_base_path);
    define('MODX_BASE_URL', $modx_base_url);
    }


    I'm using
    Revo 2.2.6
    getResources 1.6.0
    phpThumbOf 1.4.0
    HostEurope WebPack L (German host)

    ImageMagick isn't running (shared hosting) but it can't be the problem since my other website (same host) is working fine. The working website has a domain assigned to it (www.jcerbach.de/news) but this 'broken' website hasn't yet. Could this be the problem?

    Sorry for this long post but I'm really stuck here and don't know what to do.
    ka8578
      • 35150 ☆ A M B ☆
      • 191 Posts
      I'd check the media source for the tv-page-thumb TV. Make sure you don't have sassite/ there, since it's already in your base path. In the media source, try a basePath and baseUrl starting with assets/ and set basePathRelative and baseUrlRelative to Yes.

      You're right, somewhere 'sassite' is getting added twice and phpThumbOf is looking in this non-existent directory for the images. You can leave it out for the moment and just worry about getting the path to the images correct. Use simply [[+tv.tv-page-thumb]] at first and get it to return something like 'assets/images/editorimg/news-archiv/2013/k-p3060323.JPG' first, then worry about phpThumbOf.

      You want to use a <base href="/sassite/"> tag on each page so that relative URLs work in subdirectories.

      Looks like the fact that your site is running in a subdirectory is causing some confusion.

      Also, I doubt you need to be calling getResources and phpThumbOf uncached (with the exclamation point at the beginning). That'll just slow your site down.
        Extras :: pThumb • Resizer • imageSlim • setPlaceholders
        • 15202
        • 6 Posts
        Hi,
        thanks for the quick reply! I've checked the things you mentioned:
        media sources: no sassite/ there and the basePath/Url/... settings have already been just like you suggested.

        I left out phpthumbof for the moment (and btw called getResources cached) and I get the same path:
        <img alt="Milch macht Schule" src="/sassite/assets/images/editorimg/news-archiv/2013/k-p3060323.JPG" title="Milch macht Schule">

        I already have <base href="[[!++site_url]]" /> in my head and it puts out the right url (www...../sassite/).

        But I found out that if I use phpthumbof in a TV, the output type must be "text". I've had "standard" all the time and now changed it to "text" but it didn't have any effect.

        Hmm? Did I miss a table in the database where some path is secretly stored?
          • 35150 ☆ A M B ☆
          • 191 Posts
          What's the value of the TV then? (edit the resource in the Manager and look at a TV) Is that where the extra sassite is coming from?

          I don't thing the TV needs to be set to "text" for phpThumbOf to work; there shouldn't be any difference between that and standard. I've never had to set it to text.
            Extras :: pThumb • Resizer • imageSlim • setPlaceholders
            • 15202
            • 6 Posts
            What's the value of the TV then? (edit the resource in the Manager and look at a TV) Is that where the extra sassite is coming from?
            I'm not sure what you mean. Anyway, I opened my resource, clicked on the TV tab and then on the 'button' (I don't know what you call that) that you click on to select your image. After I've selected the image, the 'button' said "2013/k-p3060323.JPG" which is just the 'missing' path that you add to the "assets/images/editorimg/news-archiv/" from my media source to get the complete path (see first post).
            Was that what you had in mind?
              • 15202
              • 6 Posts
              Problem solved (or better: evaded)!
              Looks like the fact that your site is running in a subdirectory is causing some confusion.
              Once I had assigned a domain to this test installation, everything worked fine.