We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 40367
    • 5 Posts
    Hi!

    I want to use http://adaptive-images.com/ but it doesn't work with container aliases. I have a multi language site:

    => root (German)
    => en (English)
    => fr (French)
    => es (Spanish)

    Everything works fine. When I setup Adaptive images it only works with the root directory (German). Links look like this: http://www.domain.tld/content.html

    If there is a path (container) it does not work anymore. Links look like this:
    http://www.domain.tld/es/content.html
    http://www.domain.tld/fr/content.html
    http://www.domain.tld/en/content.html

    (The folders "es", "fr", "en" don't exist. Just as aliases.)

    I did not change the part of modx in the htaccess. This is the additional part of Adaptive images:

    # Adaptive-Images -----------------------------------------------------------------------------------
    
      # Add any directories you wish to omit from the Adaptive-Images process on a new line, as follows:
      # RewriteCond %{REQUEST_URI} !ignore-this-directory
      # RewriteCond %{REQUEST_URI} !and-ignore-this-directory-too
      
      # RewriteCond %{REQUEST_URI} !assets
    
      # don't apply the AI behaviour to images inside AI's cache folder:
      RewriteCond %{REQUEST_URI} !ai-cache
        
      # Send any GIF, JPG, or PNG request that IS NOT stored inside one of the above directories
      # to adaptive-images.php so we can select appropriately sized versions
      
      RewriteRule \.(?:jpe?g|gif|png)$ adaptive-images.php
    
      # END Adaptive-Images


    What do I have to change? [ed. note: meisterpeter last edited this post 14 years, 3 months ago.]
      • 33968
      • 863 Posts
      What doesn't work - friendly urls or adaptive images?

      I think you'll need to add the Adaptive rules after RewriteBase in your .htaccess file:
      RewriteEngine On
      RewriteBase /
      
      # Adaptive-Images rules here...
      
      [ed. note: okyanet last edited this post 14 years, 3 months ago.]
        • 40367
        • 5 Posts
        Adaptive images doesn't work. It only works with the German version of the site. The English, Spanish and French version don't show any images.

        Here my complete htaccess

        <IfModule mod_rewrite.c>
        
        Options +FollowSymLinks
        
        RewriteEngine On
        RewriteBase /
        
        # Adaptive-Images -----------------------------------------------------------------------------------
        
          # Add any directories you wish to omit from the Adaptive-Images process on a new line, as follows:
          # RewriteCond %{REQUEST_URI} !ignore-this-directory
          # RewriteCond %{REQUEST_URI} !and-ignore-this-directory-too
          
          # RewriteCond %{REQUEST_URI} !assets
        
          # don't apply the AI behaviour to images inside AI's cache folder:
          RewriteCond %{REQUEST_URI} !ai-cache
            
          # Send any GIF, JPG, or PNG request that IS NOT stored inside one of the above directories
          # to adaptive-images.php so we can select appropriately sized versions
          
          RewriteRule \.(?:jpe?g|gif|png)$ adaptive-images.php
        
          # END Adaptive-Images
        
        RewriteCond %{REQUEST_FILENAME} !-d
        RewriteCond %{REQUEST_FILENAME} !-f
        RewriteRule ^(es|fr|en)/favicon.ico$ favicon.ico
        
           
        # redirect all requests to /de/assets* and /nl/assets* to /assets*
        RewriteCond %{REQUEST_FILENAME} !-d
        RewriteCond %{REQUEST_FILENAME} !-f
        RewriteRule ^(es|fr|en)/assets(.*)$ assets$2
          
        # redirect all other requests to /de/* and /nl/*
        # to index.php and set the cultureKey parameter
        RewriteCond %{REQUEST_FILENAME} !-f
        RewriteCond %{REQUEST_FILENAME} !-d
        RewriteRule ^(es|fr|en)?/?(.*)$ index.php?cultureKey=$1&q=$2
        
        # The Friendly URLs part
        RewriteCond %{REQUEST_FILENAME} !-f
        RewriteCond %{REQUEST_FILENAME} !-d
        RewriteRule ^(.*)$ index.php?q=$1
        </IfModule>
          • 33968
          • 863 Posts
          Do your images also contain the language folder alias?
          Eg: http://www.domain.tld/en/path/to/image.jpg

          I'm no expert in rewrite rules, but if that is the case you might need to add your Adaptive images rules after this so they are rewritten to the assets folder:
          # redirect all requests to /de/assets* and /nl/assets* to /assets*
          RewriteCond %{REQUEST_FILENAME} !-d
          RewriteCond %{REQUEST_FILENAME} !-f
          RewriteRule ^(es|fr|en)/assets(.*)$ assets$2
          
          # Adaptive rules go here...
          
            • 40367
            • 5 Posts
            Quote from: okyanet at Jul 03, 2012, 04:43 AM
            Do your images also contain the language folder alias?
            Eg: http://www.domain.tld/en/path/to/image.jpg
            Yes.

            Quote from: okyanet at Jul 03, 2012, 04:43 AM
            I'm no expert in rewrite rules, but if that is the case you might need to add your Adaptive images rules after this so they are rewritten to the assets folder:
            # redirect all requests to /de/assets* and /nl/assets* to /assets*
            RewriteCond %{REQUEST_FILENAME} !-d
            RewriteCond %{REQUEST_FILENAME} !-f
            RewriteRule ^(es|fr|en)/assets(.*)$ assets$2
            
            # Adaptive rules go here...
            
            Nope, doesn't work.
              • 33968
              • 863 Posts
              Can you give an example image path? Stabbing in the dark here smiley
                • 40367
                • 5 Posts
                Document German: http://www.domain.tld/unternehmen/karriere.html
                Image German: http://www.domain.tld/assets/images/header/karriere.jpg
                => works fine

                Document English: http://www.domain.tld/en/company/career.html
                Image English: http://www.domain.tld/en/assets/images/header/karriere.jpg
                => doesn't work (should display the same picture as the German version does)

                Both versions work properly without adaptive images modification.
                  • 40367
                  • 5 Posts
                  I solved the problem. I modified the variable $source_file in PHP script of adaptive images:
                  /* get all of the required data from the HTTP request */
                  $document_root  = $_SERVER['DOCUMENT_ROOT'];
                  $requested_uri  = parse_url(urldecode($_SERVER['REQUEST_URI']), PHP_URL_PATH);
                  $requested_file = basename($requested_uri);
                  $source_file    = $document_root.$requested_uri;
                  $resolution     = FALSE;


                  $source_file    = str_replace("/en/", "/", $document_root.$requested_uri);