File_thumbnail->getUrl now gives Attachment_thumbnail action URL

That in turn redirects to the statically stored file.
This commit is contained in:
Mikael Nordfeldth 2015-04-03 21:21:39 +02:00
parent 4fc4f91b9e
commit f6432fdf48
2 changed files with 6 additions and 2 deletions

View File

@ -62,6 +62,6 @@ class Attachment_thumbnailAction extends AttachmentAction
common_redirect($e->file->getUrl());
}
common_redirect($thumbnail->getUrl());
common_redirect(File_thumbnail::url($thumbnail->filename));
}
}

View File

@ -142,7 +142,11 @@ class File_thumbnail extends Managed_DataObject
$this->url = null;
$this->update($orig);
}
return self::url($this->filename);
$url = common_local_url('attachment_thumbnail', array('attachment'=>$this->file_id));
if (strpos($url, '?') === false) {
$url .= '?';
}
return $url . http_build_query(array('w'=>$this->width, 'h'=>$this->height));
}
// No local filename available, return the URL we have stored