Private files not fully supported : "upload_preview_file_download" missing

toeofdestiny - February 22, 2007 - 22:12
Project:Upload previews
Version:5.x-1.2
Component:Code
Category:bug report
Priority:normal
Assigned:Unassigned
Status:closed
Description

Your module is really great. But there is a little something missing to make "private" previews working :

function upload_preview_file_download($file) {
  $preview = file_create_path(variable_get('upload_preview_path', 'preview'));
  $file_info = pathinfo(file_create_path($file));
  if ($file_info['dirname'] == $preview) {
    return array('Content-Type: image/' . $file_info['extension']);
  }
}

Otherwise, there is no module to give the headers and it results in a "Page not found".

An easy fix for a great module! :-) Thank you.

#1

toeofdestiny - February 22, 2007 - 22:38
Title:Private files not fully supported : ("upload_preview_file_download" missing)» Private files not fully supported : "upload_preview_file_download" missing

I added a strtolower, it may be important :

function upload_preview_file_download($file) {
  $preview = file_create_path(variable_get('upload_preview_path', 'preview'));
  $file_info = pathinfo(file_create_path($file));
  if ($file_info['dirname'] == $preview) {
    return array('Content-Type: image/' . strtolower($file_info['extension']));
  }
}

#2

kkaefer - February 25, 2007 - 16:20
Status:active» fixed

Wow, thank you! I have updated the module to support private file systems. I did not release a new version. To get the new feature, please download the nightly tarball from http://drupal.org/node/109067.

#3

Anonymous - March 11, 2007 - 16:35
Status:fixed» closed
 
 

Drupal is a registered trademark of Dries Buytaert.