سؤال

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).

هل كانت مفيدة؟

المحلول

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

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

...with the beginning forward slash.

نصائح أخرى

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.

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top