Answers.Body: <p>Go to setting, then try to click Update Assets Indexes.</p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2017-08-29T08:09:50.940Z
Answers.Text: Thanks for the answer :)
  
  Because of the lack of time I already changed the my-images folder to directly be located in the root.
  So I couldn't try your suggestion, but I will next time, thanks ;)
Answers.UserDisplayName: Laila
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2017-08-23T21:27:17.620Z
Answers.LastActivityDate: 2017-08-23T21:27:17.620Z
Answers.UserDisplayName: Jefry Dewangga
Body: <p>I created a new asset source/folder called "my-assets".</p>
  
  <p>It has an entry in the DB in "craft_assetsources" with the id=10, path="my_base_folder/assets/my-assets/" and url="/assets/my-assets/",</p>
  
  <p>plus an entry in the "craft_assetfolders" with the id=27, sourceID=10 and name="my-assets".</p>
  
  <p>Then I've created a subfolder called "my-images", which only has an entry in "craft_assetfolders" with id=28, sourceID=10 and path="my-images/".</p>
  
  <p>When I use the myImage.asset.getUrl() on an image from that subfolder, I get the url "/assets/my-assets/myImage.jpg" instead of "/assets/my-assets/my-images/myImage.jpg", which obviously results in the image not being found.</p>
  
  <p>Any ideas why this happens and especially how to fix it?</p>
  
  <p>I appreciate any help!</p>
  
Tags: <plugin-development><assets><database>
Title: asset.getUrl() not correct: missing subfolder directory
ThreadText: # asset.getUrl() not correct: missing subfolder directory
  
  (Asked by: username_0 on 2017-08-20)
  
  I created a new asset source/folder called "my-assets".
  
  It has an entry in the DB in "craft\_assetsources" with the id=10, path="my\_base\_folder/assets/my-assets/" and url="/assets/my-assets/",
  
  plus an entry in the "craft\_assetfolders" with the id=27, sourceID=10 and name="my-assets".
  
  Then I've created a subfolder called "my-images", which only has an entry in "craft\_assetfolders" with id=28, sourceID=10 and path="my-images/".
  
  When I use the myImage.asset.getUrl() on an image from that subfolder, I get the url "/assets/my-assets/myImage.jpg" instead of "/assets/my-assets/my-images/myImage.jpg", which obviously results in the image not being found.
  
  Any ideas why this happens and especially how to fix it?
  
  I appreciate any help!
  
  **Tags:** plugin-development, assets, database
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2017-08-23. Score: 1
  
  Go to setting, then try to click Update Assets Indexes.
  
  > **Comments:**
  > **username_0**: Thanks for the answer :)  Because of the lack of time I already changed the my-images folder to directly be located in the root. So I couldn't try your suggestion, but I will next time, thanks ;)  
  
  ---
  
  