The HTML generated to display profile pictures (in forum posts, for instance) prepends faulty reference information when hosting on ports other than 80 -- even when the non-standard port is specified in sites/default/settings.php

The prepended information varies between enabling or disabling clean URLs, but the result is the same: the actual port value is prepended to the start of the jpg file path.

Tested using 4.7.3, under both LAMP and Windows/IIS. When hosted under port-80, the avatars render properly with no further change to configuration.

Comments

ilfrin’s picture

I don't know if I'm right but this may not be a problem with the profile.module. I encountered this same problem with acidfree not showing images, it was producing:
8090/mysite/filemanager/active?fid=9
instead of
http://localhost:8090/mysite/files/active/0/file.jpg

This happens when I set the "Public file system url:" of the File Manager module to "http://localhost:8090/mysite/files". It has to be set to this value for all links to function properly.

I made a quickfix for this problem:
in theme.inc change the function theme_image to:

function theme_image($path, $alt = '', $title = '', $attributes = NULL, $getsize = TRUE) {
  if (!$getsize || (is_file($path) && (list($width, $height, $type, $image_attributes) = @getimagesize($path)))) {
    $attributes = drupal_attributes($attributes);
    if(!strpos($path,'http') === 0){
	$path = base_path() . $path;
    }
    return '<img src="'. check_url($path) .'" alt="'. check_plain($alt) .'" title="'. check_plain($title) .'" '. $image_attributes . $attributes .' />';
  }
}

I just check if the url starts with 'http' (works for http, https) and if true then I dont add the base_path(), because this confuses the check_url (base_url=/mysite/) and results in breaking the whole url.

This is probably a dirty fix, but works for me now, I don't have the time to work more on this, if anybody wants to pick it up I can provide more of the details that I found.

best regards
Wojtek Biela

jherteng’s picture

Version: 4.7.3 » 4.7.4
Status: Active » Fixed

A preliminary review of 4.7.4 shows this has been fixed. Haven't had a chance to test thoroughly or examine what exactly has changed, but file paths are intact.

Anonymous’s picture

Status: Fixed » Closed (fixed)