1

I'm using the following code to print out the path of an image uploaded through theme-settings.php:

<img src="<?php print file_create_url(file_build_uri(theme_get_setting('my_setting')); ?>" />

Locally, everything works fine -- the path renders as I expected:

http://localhost/drupal/sites/default/files/image.jpg

When the site is online, however, the same code renders the following address:

http://www.mydomain.com/sites/default/files/public%3A//image.jpg

Does anyone know why public:// would be printed out on a live server but not on a local installation? My guess is that the problem is related to the use of file_build_uri.

I'd like to find some code that prints out the URL correctly on both live and local installs. Perhaps I'm not using the best approach with the API to achieve this end?

1

The following code worked on both the local and live install:

<?php print file_create_url(theme_get_setting('my_setting')); ?>

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.