0

I'm completely stuck on this one:

I'm working on a drupal 7 website and I have created a block (view) that should display an image with it. No matter what I try, I cant get the image displayed...


The content type I'm trying to display has 3 fields: "name", "description" and "picture". The picture simply is an Image that's stored in a folder "myImages".

This is a picture of the block view I'm trying to create: the block

This does display the fields "title" and "beschrijving" (=description). The "foto" (=picture) however is not displayed... (in chrome it gives the "broken picture" logo, in firefox just nothing).

The wierd thing is: the image appears just for a blink and then disappears, meaning it is actually being rendered.

When I took a look at it with firebug I got following html:

<div class="views-field views-field-field-foto">
    <span class="field-content">
        <img width="100" height="100" alt="" src="sites/default/files/myImages/imageSource.jpg" typeof="foaf:Image">
    </span>
</div>

And when I try to open the image itself (imageSource.jpg) I get an (500) internal server error (but I'm pretty sure this is because of the .gitignore file).

apaderno
  • 28,547
  • 16
  • 75
  • 90
Hans Vn
  • 787
  • 1
  • 16
  • 32
  • Just to be clear: when you open a node (site.com/node/123) with picture field, there is nothing wrong with displaying an image? If so, can you please check, if the `src` is exactly the same as in View. Also, I had the same issue with "blinking" images - problem was in wrong file system path (`admin/config/media/file-system`) but I guess it isn't your case. – tulvit Dec 08 '12 at 14:33

2 Answers2

0

The image path is incorrect. It should look like...

src="/sites/default/files/myImages/imageSource.jpg"

...with the beginning forward slash.

kyletaylored
  • 719
  • 1
  • 7
  • 16
  • this could be a fix... but I looked again at the redered code and it seems the src is actually a full path (like http://mysite.com/sites/default/files/myImages/imageSource.jpg)... Remark: the drupal website is not in the root of my webserver, but in a subfolder (normally this isn't relevant since I updated the .htaccess and .gitignore files properly) – Hans Vn Dec 08 '12 at 14:40
  • Seems your answer got close to the solution:it was a path issue... But the issue I countered was caused by the .htaccess file: I did rerwrite the base but apparently forgot to add a / at the end of it... stupid mistake, easy fix – Hans Vn Dec 10 '12 at 19:56
0

I had issues when displaying images with Views, and it turned out to be the "alt text" option. In order to use "alt text" and not have issues I had to make use of the "Rewrite Results" option in Views.