The Views Image Attach field stores (and therefore caches) the full path.

For example if you use your website with https:// and have caching enabled the source to the images will contain the https:// route. And if someone tries to view your website with http:// then maybee the images won't show up (Internet Explorer).

I would suggest to use relative path. Like: "/images/image.jpg"

Comments

joachim’s picture

Status: Active » Closed (works as designed)

I'm pretty sure it doesn't -- the image attach module stores a node ID and nothing more.
The views field handler then makes a link out of that. You're maybe hitting a caching problem?

slampy’s picture

I still don't understand why, because if I use the default view everything works great ("/"), but when I add a seperate Image Attach field the images starts to show up as "https:=//".

If you think this is a caching problem, do you have a solution for it?

Thanks.

joachim’s picture

Status: Closed (works as designed) » Active

How do attached images look on the regular node display?

I'll reopen so I remember to look at this when I have time.
Though if anyone else wants to have a go at figuring this out... :)

slampy’s picture

I have normal caching enabled. I cache almost everything.

Here is the scenerio:
I clear my cache while visiting the https://www.domain.com website. I reload so the cache is populated.

Now I visit the http://domain.com website.
What I see in my blocks with image attach: Only local images are allowed.
What I see on my frontpage with the default view: Only local images are allowed.

Also the title and alt attributes are missing with the view.

slampy’s picture

Great! The img tags dissapeared. Let's try again...

What I see in my blocks with image attach:

<img width="100" height="100" class="image image-thumbnail " title="" alt="" src="https://www.domain.com/files/images/image.jpg"/>

What I see on my frontpage with the default view:

<img width="100" height="100" class="image image-thumbnail " title="title" alt="alt" src="http://domain.com/files/images/image.jpg"/>
joachim’s picture

Status: Active » Closed (won't fix)

The views handler calls image_display() to make an IMG tag the same way an attaching node or even an image node would.
Must be some sort of caching and beyond the scope of this module, I'm afraid. Block caching maybe?

slampy’s picture

I turned off caching and now it works. But I need caching...

Do you have any idea how to fix this? Or what/where could be the problem. I use the Block Cache Alter module (http://drupal.org/project/blockcache_alter) with 'Cache once for everything (global)' settings, which basically enables the views cache mechanism.

slampy’s picture

Status: Closed (won't fix) » Needs review

But can't the image module just use relative paths rather then inserting the domain to each img tag. This would fix the caching problem.

For example on the title with relative path I see:

<a href="/blog/introduction">Introduction</a>

On the img tags I always see the full path:

<img src="http://www.domain.com/files/images/image.jpg"/>
joachim’s picture

In all cases it goes to file_create_url().

Find image_display() in image.module and output what file_create_url() gets in all cases.

joachim’s picture

Status: Needs review » Postponed (maintainer needs more info)

'needs review' means 'there is a patch here that needs testing'.

Though I need input from you if I'm to figure it out. Can you debug what happens in image_display()?

slampy’s picture

It's really hard to debug on a production site, but this is what I found:

$node->images[$label] and file_create_url($node->images[$label]) works perfectly. I did see something strange, but only once and I couldn't reproduce it. The problem was, that file_create_url() forgot to put http://domain.com/files/images/image.jpg and I just saw files/images/image.jpg.

So the problem should be with theme() and it's attributes. I checked the $node variable and it was really strange.
When I checked a page with http://www.domain.com it worked perfectly, but with http://domain.com it didn't output anything. So I think the problem should be with this.

Also file_create_url($node->images[$label]) showed always the right URL but on the images the HTML source URL was wrong. So it doesn't always put out what the file_create_url() has created.

SamFlushing’s picture

I have the same problem

I got

192.168.56.101//usr/share/drupal6/data/images/UMRЪSTKATALOG OPEL 1994.thumbnail.jpg

instead of

192.168.56.101/data/images/UMRЪSTKATALOG OPEL 1994.thumbnail.jpg

How to fix this bug?

sun’s picture

Status: Postponed (maintainer needs more info) » Closed (cannot reproduce)

Sorry, without further information this issue can only be closed as not reproducible.

Feel free to re-open this issue if you want to provide further information. Thanks.