I have my audio module configured to store files outside the webroot for security purposes (and then I use private file delivery with filerequest.module to add to this).
This works fine for audio files.
However audio_image.module doesn't seem to cope with this.

it uploads and saves images fine, but then tries to display them by adding the path to the file from the server root to the website url so it looks like this:
http://www.example.com//path/to/audio/images/file.jpg

instead of just /path/to/audio/images/file.jpg

cheers
steve

Comments

aaron’s picture

Version: 4.7.x-1.x-dev » 5.x-0.3

although the image path is being displayed correctly for me in 5.x, it doesn't actually retrieve the image. audio files work fine. it's looking for something like /system/files/audio/images/11_other.jpg, which i can confirm by ftp is in the ../files directory, but returns page not found.

aaron’s picture

the audio module handles its own uploading/downloading for audio files, but the audio_image module doesn't seem to. do we need to use hook_file_download to handle this for private filesystems? i don't really understand all this yet, so am not sure even where to begin.

drewish’s picture

no, it should work. Drupal handles the system/files menu items and should return the images correctly. can you provide a link i can look at?

aaron’s picture

sorry, i had to get things working, so i made the files public and altered the db tables accordingly. after the site launch next week, i'll change it back on the staging server and see if the problem pops back up, and i'll post it here to help troubleshoot. thanks

Chill35’s picture

When using private download :

Drupal handles the download of 'system/files' files if they are recorded in the {files} table, and that will happen if files are uploaded using the upload core module.

Otherwise, if the files are put in the File System Path folder by other means (either ftp-ed or uploaded with a contributed module), another module, with {module_name}, has to return a header for the file, in response to a call to the {module_name}_file_download function, in order for the download to take place. In other words, a contributed module has to implement the hook function hook_file_download if files are not uploaded using the core upload module. As soon as the contrib module returns a header, the file is downloaded.

A coder's guide to file download in Drupal <--- a very handy 5-pages-long document on file download from a coder's perspective.

aaron’s picture

rather than hook_file_upload to return a header, would it be possible to bypass that when uploading the file to insert it into the {files} table manually and let the upload module take over from there, or will that cause bad ju-ju? i noticed in the files table that images uploaded by the imagefield module were inserted into that table. i don't remember if i saw audio image files in it off hand.

drewish’s picture

aaron, audio doesn't use the files table because it doesn't work properly with revisions.

Chill35, is there a version of that pdf that doesn't require a login?

Chill35’s picture

rather than hook_file_upload to return a header, would it be possible to bypass that when uploading the file to insert it into the {files} table manually and let the upload module take over from there, or will that cause bad ju-ju?

It's certainly an option. I don't see how that would cause bad ju-ju. About returning a header : that seems daunting at first, but it's not difficult and provides much control. There is certainly a lot of ways to skin the cat here.

Chill35, is there a version of that pdf that doesn't require a login?

Drewish, no. But when I get some energy I will write up a summary. You can always e-mail me, and I will e-mail you back with the pdf attached (that's no problem for me) : it's about 140k. You can use the contact form we have here.

Chill35’s picture

I really need some sleep. Sorry about the bad html.

Chill35’s picture

drewish’s picture

Chill35, it's not that big a deal. I'll probably try to roll up a patch to add a menu hook to output private images that's parallel to audio_download or audio_play.

marlowx’s picture

ok, looks like a couple more people are having this problem...

http://drupal.org/node/241605

http://drupal.org/node/318009

this sounds like something the audio plug-in should be accounting for automagically?

should i change my site to "public" downloads or whatever its called?

will that fix the album artwork path problem and create other problems with image galleries that i have already created? if i delete the newly broken image galleries then and then upload them again will everything then be fixed?

thanks guys!

marlowx’s picture

ok, was just about to change my file thingy to public when i noticed this warning:

If you want any sort of access control on the downloading of files, this needs to be set to private. You can change this at any time, however all download URLs will change and there may be unexpected problems so it is not recommended.

---

does this mean i need to leave it at "private"

any advice appreciated... i need to fix this but i don't want to destroy something else in the process...

-=sigh=-

i can handle re-uploading the image galleries and simple yet tedious stuff like that... just worried about more technical and scary stuff that might go wrong that a newbie like me can't fix...