Views to use relative paths for image fields How can we tell views to use relative paths for dispalying images using image fields. I have created a views slideshow which is displaying images using absolute url which is causing the images to reload on each page load.

facing the same issue in other type of views displays like grid and unformated etc...
Add your image to the view (mine is called Image2)

Create a theme file for your image field, see screenshot. (mine is called views-view-field--relative-url-example--page--field-image2.tpl.php and it's bolded). Pick the last one for the most granular themeing possible.

 (full size here)

After you have added the theme file to your theme templates (/sites/all/themes/THEME/templates or similar), hit the "Rescan template files" button. Your field template should be bolded now.

Add the following code to your theme file, I removed the comments but you can leave them in if you like:

&lt;?php

/**
 * @file
 * This template is used to print a single field in a view.
 *
 * It is not actually used in default Views, as this is registered as a theme
 * function which has better performance. For single overrides, the template is
 * perfectly okay.
 *
 * Variables available:
 * - $view: The view object
 * - $field: The field handler object that can process the input
 * - $row: The raw SQL result that can be used
 * - $output: The processed output that will normally be used.
 *
 * When fetching output from the $row, this construct should be used:
 * $data = $row-&gt;{$field-&gt;field_alias}
 *
 * The above will guarantee that you'll always get the correct data,
 * regardless of any changes in the aliasing that might happen if
 * the view is modified.
 */
?&gt;
&lt;?php

    $url  = file_create_url($row-&gt;field_field_image2[0]["raw"]["uri"]);
    $url  = parse_url($url);
    $path = $url['path'];

    print $path;
?&gt;


I only printed the path to demonstrate it works so you will need to add the image tag, etc.

Here is my output:



You may need to clear the cache and be sure to save your view after you update the theme file.