Applying an image transform returns a 404 cpresources URL EDIT 3: Started using imager and no longer have the problem. It's not a real answer to the problem but solves the problem.



This is the situation that has me pulling my hairs... I've looked at other related Q&amp;A's but can't seem to distill a solution for the issue I'm facing. 

I'm trying to apply an image transform but I get a link like /cpresources/404?x=TBKkjeyyP returned. Also, no image is being generated. 

Files can be uploaded trough the backend just fine, can be linked to an entry and can be shown without applying the transform.

Any pointers as to what is going wrong? I'll gladly provide additional information if/when needed. 

My setup is as follows:


Using Craft CMS 2.6.2986 on apache
3 locales configured (nl, en, fr)
local storage (File System Path: uploads/&amp; url:  {baseUrl}uploads/)
relevant config below (using process described here)


General config: 

// All environments
'*' =&gt; array(
    'omitScriptNameInUrls' =&gt; true,
    'overridePhpSessionLocation' =&gt; true,
    'usePathInfo' =&gt; true,
    'cacheDuration' =&gt; false,
    'useEmailAsUsername' =&gt; true,
    'generateTransformsBeforePageLoad' =&gt; true,
    'siteUrl' =&gt; array(
        'nl' =&gt; getenv('CRAFTENV_SITE_URL').'nl/',
        'fr' =&gt; getenv('CRAFTENV_SITE_URL').'fr/',
        'en' =&gt; getenv('CRAFTENV_SITE_URL').'en/',
    ),
    'craftEnv' =&gt; CRAFT_ENVIRONMENT,
    'environmentVariables' =&gt; array(
        'baseUrl'  =&gt; getenv('CRAFTENV_BASE_URL'),
        'basePath' =&gt; getenv('CRAFTENV_BASE_PATH'),
    ),
    // development environment
    'development'  =&gt; array(
        'devMode' =&gt; true,
        'enableTemplateCaching' =&gt; false,
        'allowAutoUpdates' =&gt; true,
    );
);


Relevant CRAFT_ENV settings:

'SITE_URL' =&gt; $protocol . $_SERVER['HTTP_HOST'] . '/',

'BASE_URL' =&gt; $protocol . $_SERVER['HTTP_HOST'] . '/',

'BASE_PATH' =&gt; realpath(dirname(__FILE__)) . '/www/',


EDIT: Part of the code applying the transform:

{% set thumb = blog.previewImage.first() %}
{% if thumb %}
    &lt;img src="{{ thumb.getUrl("blogPreview") }}" width="{{ thumb.getWidth("blogPreview") }}" height="{{ thumb.getHeight("blogPreview") }}"&gt;                     
{% endif %}


EDIT 2: relevant log entries


  Level warning
  Category    application
  Message [Forced] Image “gasmeters.png” could not be found.
  
  Level trace
  Category    system.db.CDbCommand
  Message Executing SQL: DELETE FROM craft_assettransformindex WHERE id = :id. Bound with :id='70'
For what it's worth, I also had his issue, turned to imager, which gave me some more useful error messages as to my root cause of the issue:

You may need to make sure that the path to the asset file is complete, not just relative to the site base. So for instance, a base path of ./assets works fine for standard purposes, but appears no use for transforming images, you would need http://site/assets.

If your setting a base path in config, you can use something like

'environmentVariables' =&gt; array(
    'assetsBaseUrl' =&gt; '/assets',
    'assetsBasePath' =&gt; "{$_SERVER['DOCUMENT_ROOT']}/assets",
),