<p>It was a simple misunderstanding of how the general.php should be structured.</p>

<p>I had <code>environmentVariables</code> outside of the <code>'*' =&gt; array(</code></p>

<p>So it's now:</p>

<pre><code>return array(
  '*' =&gt; array(
    'omitScriptNameInUrls' =&gt; true,
    'sendPoweredByHeader' =&gt; false,
    'devMode' =&gt; getenv("CRAFT_DEVMODE") == "true",
    'environmentVariables' =&gt; array(
      'baseAssetUrl'  =&gt; 'http://192.168.99.100:8080/',
      'basePathPublic' =&gt; realpath(dirname(__FILE__)).'/../../html/',
    ),
  ),
);
?&gt;
</code></pre>

CC BY-SA 3.0
2016-06-13T05:10:03.413Z
I found the answer here `http://craftcookbook.net/recipes/296`
Daimz
CC BY-SA 3.0
2017-05-09T22:18:57.417Z
Are you storing your assets in the root directory? My asset paths look something like this `/public/assets/` or `public/media/`.
Clark
CC BY-SA 3.0
2016-06-13T05:09:40.570Z
2016-06-13T10:08:50.540Z
2016-06-13T10:08:50.540Z
Daimz
<p>I have just started using craft today and I have hit a bit of a bump with Images.
I created and asset for Work and set it up to point to <code>assets/images/work/</code> I was able to upload the image but when I tried to preview the 'Work' page the image was going to <code>/work/assets/images/work</code> relative URL I am guessing.
I tried then to define and environment variable like this:</p>

<pre><code>'environmentVariables' =&gt; array(
  'baseAssetUrl'  =&gt; 'http://192.168.99.100:8080/',
  'baseAssetPath' =&gt; './',
),
</code></pre>

<p>Updated my asset group to the following:
<code>{baseAssetPath}assets/images/work/</code>
<code>{baseAssetUrl}assets/images/work/</code></p>

<p>But when I try preview the page the image is broken and the variable has not been interpreted</p>

<pre><code>&lt;img src="{baseAssetUrl}assets/images/work/_360xAUTO_crop_center-center/test.jpg" alt="Test"&gt;
</code></pre>

<p>And I can't upload the image I get the following error message:</p>

<pre><code>Upload failed for test.jpg. The error message was: “Error uploading 
the file: The file system path “{baseAssetPath}assets/images/work/” 
set for this source does not exist.”
</code></pre>

<p>Any ideas what am I missing?</p>

<assets><image><environmentvariables>
Images are broken when I upload them
# Images are broken when I upload them

(Asked by: username_0 on 2016-06-13)

I have just started using craft today and I have hit a bit of a bump with Images.
I created and asset for Work and set it up to point to assets/images/work/ I was able to upload the image but when I tried to preview the 'Work' page the image was going to /work/assets/images/work relative URL I am guessing.
I tried then to define and environment variable like this:
'environmentVariables' => array(
  'baseAssetUrl'  => 'http://192.168.99.100:8080/',
  'baseAssetPath' => './',
),

Updated my asset group to the following:
{baseAssetPath}assets/images/work/
{baseAssetUrl}assets/images/work/
But when I try preview the page the image is broken and the variable has not been interpreted


And I can't upload the image I get the following error message:
Upload failed for test.jpg. The error message was: “Error uploading 
the file: The file system path “{baseAssetPath}assets/images/work/” 
set for this source does not exist.”

Any ideas what am I missing?

**Tags:** assets, image, environmentvariables


---

## 1 answers

### Answer by username_0 on 2016-06-13. Score: 2

It was a simple misunderstanding of how the general.php should be structured.
I had environmentVariables outside of the '*' => array(
So it's now:
return array(
  '*' => array(
    'omitScriptNameInUrls' => true,
    'sendPoweredByHeader' => false,
    'devMode' => getenv("CRAFT_DEVMODE") == "true",
    'environmentVariables' => array(
      'baseAssetUrl'  => 'http://192.168.99.100:8080/',
      'basePathPublic' => realpath(dirname(__FILE__)).'/../../html/',
    ),
  ),
);
?>

> **Comments:**
> **username_0**: I found the answer here `http://craftcookbook.net/recipes/296`  
> **username_1**: Are you storing your assets in the root directory? My asset paths look something like this `/public/assets/` or `public/media/`.  

---

