This issue made imagefield work with private downloads at all, but didn't make immediate image previews possible. The attached patch fixes this issue, and thus gets imagefield's support for private downloads on par with clean URL public downloads.

Applies to current DRUPAL-5--2.

Comments

starbow’s picture

I was not seeing the image preview with private downloads (drupal 5.1, cck 1.5, imagefield 5-1.dev). I applied this patch and I can now see the image preview within the imagefield fieldset. Sweet!

(Note, this does not solve the problem if there is on image in there and I change the image and hit "Preview". That still shows the old image on the page preview - different issue, just a little confusing because the both involve the concept of previewing).

ZuluWarrior’s picture

StatusFileSize
new23.26 KB

I had the same problem, but as I didn't see this patch until after I'd fixed the issue, I thought I'd share what I came up with instead.

Your solution looks cool, I gather that you are basically transferring the files via that new function.

I took a different approach, as submitting the form copies the image into the files directory, I didn't want to get in the way of this behaviour. So my code basically generates a different style of path for the preview, basically a relative path to the file systems defined temp directory and file. This shows you the tmp image if in 'upload_preview' mode, and the uploaded image otherwise.

The only thing that can make this go wrong is if your File System Temporary directory is set outside of the sites root. in which case it cant generate a preview as the temp path is not viewable via the sites url. So in that respect, your solution is more graceful (If your solution does deal with this situation), however mine is much more slimline and carries less overhead (no transferring of files for just a preview).

Sorry, you'll have to do a compare against the original and this file to find the changes :(. However, this patch also includes a fix that sets a separate permission for viewing images (as opposed to the upload modules permission of view uploaded files).

I think your solution is probably much more comprehensive, but as I said, I thought I would share, in case there's any nuggets o' info to be had....

dopry’s picture

Status: Needs review » Fixed

@jpetso, You roxxor... thats a nice patch!
Committed to DRUPAL-5--2

Anonymous’s picture

Status: Fixed » Closed (fixed)