Active
Project:
Image Publishing
Version:
5.x-1.x-dev
Component:
Code
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
2 Jan 2008 at 09:48 UTC
Updated:
2 Jan 2008 at 09:48 UTC
If private files are enabled, the paths provided by API calls such as 'fetch-album-images' are incorrect.
I changed _image_pub_image_baseurl() and _image_pub_get_imagefilename() along the following lines:
function _image_pub_image_baseurl() {
- return _image_pub_base_url() .'/'. variable_get('file_directory_path', 'files') .'/'. variable_get('image_default_path', 'images');
+ if (variable_get('file_downloads', FILE_DOWNLOADS_PUBLIC) == FILE_DOWNLOADS_PRIVATE) {
+ return _image_pub_base_url() .'/system/files/'. variable_get('image_default_path', 'images');
+ }
+ else {
+ return _image_pub_base_url() .'/'. variable_get('file_directory_path', 'files') .'/'. variable_get('image_default_path', 'images');
+ }
}
function _image_pub_get_imagefilename($node, $size = '_original') {
$fname = $node->images[$size];
if (isset($fname)) {
- $imgbase = variable_get('image_default_path', 'images') .'/';
- if (!strncmp($fname, $imgbase, strlen($imgbase))) {
- $fname = substr($fname, strlen($imgbase));
+ if (variable_get('file_downloads', FILE_DOWNLOADS_PUBLIC) == FILE_DOWNLOADS_PRIVATE) {
+ $fname = basename($fname);
}
+ else {
+ $imgbase = variable_get('image_default_path', 'images') .'/';
+ if (!strncmp($fname, $imgbase, strlen($imgbase))) {
+ $fname = substr($fname, strlen($imgbase));
+ }
+ }
}