I am using Media 7.x-1.3 on Drupal 7.21. I have created simple StreamWrapper to use with some other modules and it works great for them. It extends DrupalLocalStreamWrapper and overrides getDirectoryPath and getExternalUrl only.

When I set this StreamWrapper as my "Default download method" at admin/config/media/file-system and upload file using Media Browser, I do see this file created at the location it should but Media shows the "404 broken image" icon and when I add it to my node I see the 404 image also.

My StreamWrapper saves the files to a local path and serves it through CDN URL.

Do you have any suggestion about how I should work this out?

  • Are you getting a 404 for the original image, or is it a generated style that's missing? – Clive Mar 28 '13 at 14:42
  • I guess I miss something, what is a "generated style"? The image is created on the CDN's folder and the URL returned by getExternalURL is correct and points to that file. I thought maybe something is missing in the thumbnails etc. but I've no idea how to set it up. – Bnayal Mar 28 '13 at 18:08
  • Drupal creates thumbnails (image styles) on-the-fly, you ca – Clive Mar 28 '13 at 18:15
  • Sorry, didn't understand what is "generated style", did some of your message got lost in the cyber? – Bnayal Mar 29 '13 at 6:42
  • Oops yes it did, but not much. As I mentioned Image styles are the thumbnails Drupal generates, you need to find out if the image that's 404'ing is the original image, or one of these thumbnails generated by Drupal. If it is an image style, you might need to do a bit more coding to integrate your stream wrapper with that system. I think the Amazon S3 module does something similar but I might be wrong – Clive Mar 29 '13 at 10:28

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.