We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 38462
    • 39 Posts
    I need some help with a problem regarding multi contexts (different TLDs). I have two contexts setup, working fine using http://rtfm.modx.com/extras/revo/contextrouter.

    I have a getResources snippet call:

    [[getResources? &context=`web` &parents=`57` &depth=`2` &limit=`12` &includeTVs=`1` &processTVs=`1` &includeTVList=`productCode,priceCode,Product_Image` &showHidden=`1` &hideContainers=`1` &tpl=`Product_Cell` &sortby=`menuindex` &sortdir=`ASC`]]
    


    that references a parent from the default (web) context, using the following tpl:

    <div class="grid_4 gridcell">
    <a href="[[~[[+id]]]]" title="[[+pagetitle]]">
    <img src="[[+tv.Product_Image:phpthumbof=`w=210&h=137&zc=1`]]" alt="[[+pagetitle]]" width="210" height="137" />
    </a>
    <div class="cellinfo"><a href="[[~[[+id]]]]" title=""><h4>[[+pagetitle]]</h4></a><span>[[+tv.productCode]]</span></div>
    </div>
    


    All thumbnail images display perfect in the default (web) context, however the images to not display in the other context I have setup.

    I've installed pThumb to create the thumbnails, using a media source with the following details:

    basePath = assets/library/
    basePathRelative = Yes
    baseURL = assets/library/
    baseUrlRelative = Yes
    


    Would be most grateful for a hint in the right direction to solve this. [ed. note: northernape last edited this post 9 years, 5 months ago.]
    • Have you tried setting an absolute baseUrl, e.g. http://foo.com/assets/library/?
        Mark Hamstra • Developer spending his days working on Premium Extras and a MODX Site Dashboard with the ability to remotely upgrade MODX and extras to make the MODX world a little better.

        Tweet me @mark_hamstra, check my infrequent blog at markhamstra.com, my slightly more frequent ramblings at MODX.today or see code at Github.
        • 20413
        • 2,877 Posts
          @hawproductions | http://mrhaw.com/

          Infograph: MODX Advanced Install in 7 steps:
          http://forums.modx.com/thread/96954/infograph-modx-advanced-install-in-7-steps

          Recap: Portland, OR (PDX) MODX CMS Meetup, Oct 6, 2015. US Bancorp Tower
          http://mrhaw.com/modx_portland_oregon_pdx_modx_cms_meetup_oct_2015_us_bancorp_tower
          • 38462
          • 39 Posts
          Hi Mark

          Just tried this - no joy! The getResources snippet just displays what is within [[+tv.Product_Image:]]
            • 38462
            • 39 Posts
            Quote from: mrhaw at Oct 28, 2014, 08:10 PM
            --> http://forums.modx.com/index.php/topic,51848.msg303276.html

            The getResources snippet call works, bringing all information into other context. It's just the path needed for pThumb to create thumbnails is not?
            • I know someone already solved this. I read it some days ago, the keywords are "images" and "babel" I think.

              Here it is: look at the .htaccess code from AMDtoasterbuilder
              http://forums.modx.com/thread/70863/problems-with-babel

              I think you can tweak pthumb to write into specified output folders. You could set the target names by the contexts placeholders.

              *just where I would start looking if I understood your problem correctly [ed. note: gallenkamp last edited this post 9 years, 5 months ago.]
              • Couple thoughts:

                Quote from: northernape at Oct 28, 2014, 11:25 AM

                I have a getResources snippet call:

                Just to clarify, you want results from the web context, no matter the context in which you're calling getResources, right? (Assuming "yes")

                Quote from: northernape at Oct 28, 2014, 11:25 AM

                that references a parent from the default (web) context, using the following tpl:

                Side note: you don't seem to be using the priceCode TV in your tpl – that could probably be removed from the includeTVList property.
                Question are you setting the &prepareTVs property? getResources uses that to determine whether or not to prepare TV media sources. You can also add &prepareTVList for performance.

                Quote from: northernape at Oct 28, 2014, 11:25 AM

                All thumbnail images display perfect in the default (web) context, however the images to not display in the other context I have setup.

                I've installed pThumb to create the thumbnails, using a media source with the following details:

                To clarify again, please – it's the TV that uses the media source, not a pThumb setting, is that correct? (Assuming "Yes")
                Mark's idea of using absolute baseUrl might be extended to basePath as well - it depends on your context settings. One way to check is to look at the path generated by pThumb: are they prepended with the correct baseUrl?

                If pThumb can't access the image file, it does the following to try to find it:
                		else {  // otherwise prepend base_path and try again
                			$file = MODX_BASE_PATH . rawurldecode(ltrim($src, '/'));  // Fix spaces and other encoded characters in the filename
                			if (!is_readable($file)) {  // still can't find it?  We'll try to correct a couple common problems.
                				if (!isset($this->config['basePathCheck'])) {
                					$this->config['basePathCheck'] = MODX_BASE_PATH . ltrim($this->modx->getOption('base_url'), '/');
                				}
                				$file = str_replace($this->config['basePathCheck'], MODX_BASE_PATH, $file);  // if MODX is in a subdir, keep this subdir name from occuring twice. Also remove base_url, which might just be added by a context
                				if (!is_readable($file)) {  // Time to declare failure
                					$this->debugmsg('File not ' . (file_exists($file) ? 'readable': 'found') . ": $file  *** Skipping ***");
                					return $output;
                				}
                			}
                		}

                Outside of that, it might just return nothing if it cannot find the file. You can turn on debug mode in the pThumb snippet properties.

                Finally, but not least, if pThumb can't load the phpThumbOf class, it also just returns the input, but since it works in the web context, I doubt that's the problem..
                  [sepiariver.com] (https://sepiariver.com/)
                  • 38462
                  • 39 Posts
                  Now got this working. The image TV's media source for the added context had defaulted to filesystem, instead of the media source we have set for the web context.