0

Right now I'm at "http://localhost:8080/drupal/xxxx/user/password" and I added an image inside a block like this "sites/default/files/background.jpg"

But I think is wrong because I'm at 2 paths "user/password" and it is not taken my images, in which way can I write the path to access to my images???

3

You can display image using following URL:

/drupal/xxxx/sites/default/files/background.jpg

This is for your local setup. While migrating your drupal setup to production at root directory, your image url will break, because of directory change. To avoid this, you will need to change the path of image as below:

/sites/default/files/background.jpg

You can fix this broken your without changing the URL at production by using Pathologic. After Installing this module, you will need to enable Pathologic filter by checking Correct URLs with Pathologic in Text Formats e.g Full HTML. Then select Correct URLs with Pathologic tab from vertical tabs & Path relative to server root (/foo/bar) radio option. Add following values in the text area & save.

/drupal/xxxx/ /

  • Didn't know that module, thx so much !! – DarkteK Mar 13 '15 at 13:28
1

The main idea is just to use this "<?php echo base_path(); ?>" That will give you the main path and then you can go with "sites/default/....."

0

I believe all you need to fix on that is change the URL to /sites/default/files/background.jpg

  • Just 1 slash before "sites" ? – DarkteK Mar 13 '15 at 1:15
  • That will go straight to my localhost, but the system is inside 2 subfolders... I cant place that slash – DarkteK Mar 13 '15 at 1:25

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.