Answers.Body: <p>Ran into a similar problem on a past project, it could be your .htaccess acting up and redirecting the call to <code>cpresources</code> to <code>/benl/cpresources</code> as opposed to <code>/cpresources/</code>.</p>
  
  <p>If you look at your console on the page that the image is broken - you might be getting a 404 error. If that is the case...</p>
  
  <p>Adding this rewrite rule helped my project and may help yours as well.</p>
  
  <pre><code>    RewriteCond %{REQUEST_FILENAME} !-f
      RewriteCond %{REQUEST_FILENAME} !-d
      RewriteRule ^cpresources/transforms/(.*)  /cpresources/transforms/$1 [L,R,NE,QSA]
  </code></pre>
  
  <p>Add this rule to your .htaccess in your <code>/benl/</code> directory before the default index.php rewrite.</p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2017-06-07T19:36:39.193Z
Answers.LastActivityDate: 2017-06-07T19:36:39.193Z
Answers.UserDisplayName: JHEUNG
Body: <p>Working on a site that has a bunch of different locales, I'm bumping into the following issue:</p>
  
  <p>On an entry in locale X, I have an image that is displayed with a transform applied to it. However, <code>getUrl()</code>on the asset returns the following url: <code>/benl/cpresources/404?x=6obDEISgU</code>.</p>
  
  <p>But, when I add that exact same image to an entry in the site's main locale and view it on the front-end, the transform is generated and the image is displayed correctly. </p>
  
  <p>When I then go back to the other entry in locale X (that has that same image), it uses the generated transform (from the entry in the main locale) and the page works.</p>
  
  <p>So it looks like the transformed images can't be generated on the entry in the none-standard locale.</p>
  
  <p>Some settings/parameters:</p>
  
  <ul>
  <li>locales live in their own subfolder as per <a href="https://craftcms.com/docs/localization-guide" rel="nofollow noreferrer">https://craftcms.com/docs/localization-guide</a></li>
  <li><code>basePath</code> is set to the main site's document root, without the locale folder</li>
  <li><code>baseUrl</code> is set the main site url, without the locale segment</li>
  </ul>
  
  <p>Any pointers as to how to troubleshoot and/or fix this would be appreciate :)</p>
  
Tags: <localization><image-transforms>
Title: Image transform not working with different locales
ThreadText: # Image transform not working with different locales
  
  (Asked by: username_0 on 2017-06-07)
  
  Working on a site that has a bunch of different locales, I'm bumping into the following issue:
  
  On an entry in locale X, I have an image that is displayed with a transform applied to it. However, `getUrl()`on the asset returns the following url: `/benl/cpresources/404?x=6obDEISgU`.
  
  But, when I add that exact same image to an entry in the site's main locale and view it on the front-end, the transform is generated and the image is displayed correctly.
  
  When I then go back to the other entry in locale X (that has that same image), it uses the generated transform (from the entry in the main locale) and the page works.
  
  So it looks like the transformed images can't be generated on the entry in the none-standard locale.
  
  Some settings/parameters:
  
  * locales live in their own subfolder as per <https://craftcms.com/docs/localization-guide>
  * `basePath` is set to the main site's document root, without the locale folder
  * `baseUrl` is set the main site url, without the locale segment
  
  Any pointers as to how to troubleshoot and/or fix this would be appreciate :)
  
  **Tags:** localization, image-transforms
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2017-06-07. Score: 2
  
  Ran into a similar problem on a past project, it could be your .htaccess acting up and redirecting the call to `cpresources` to `/benl/cpresources` as opposed to `/cpresources/`.
  
  If you look at your console on the page that the image is broken - you might be getting a 404 error. If that is the case...
  
  Adding this rewrite rule helped my project and may help yours as well.
  
  ```
      RewriteCond %{REQUEST_FILENAME} !-f
      RewriteCond %{REQUEST_FILENAME} !-d
      RewriteRule ^cpresources/transforms/(.*)  /cpresources/transforms/$1 [L,R,NE,QSA]
  
  ```
  
  Add this rule to your .htaccess in your `/benl/` directory before the default index.php rewrite.
  
  
  ---
  
  