When attempting to insert html on a system with a private filesystem an absolute system path is inserted as the image source. The attached patch changes img_assist_load_properties to recieve the URL of the image instead. Not sure if it breaks anything else, but it works on my site. Previously only filtered input worked.
| Comment | File | Size | Author |
|---|---|---|---|
| inserthtml_private_files.patch | 1.07 KB | dopry |
Comments
Comment #1
serval-1 commentedHow does this behave when you change the image by uploading an image with another filename?
It would be nice to see /image/[nid]/view/[preview|thumb|original] as the returning URL. This will keep the images working when you change the filename.
I don't know the return value of the function "file_create_url", so probably this issue is already solved by using that function.
Comment #2
Robrecht Jacques commentedThis bug is similar to the one I've discovered for filter: http://drupal.org/node/25922.
I'm not sure if this is the right solution, I'll look at it tomorrow. The idea is correct though: add a "file_create_url()" somewhere, but I'm not 100% convinced your patch adds it at the right place.
Comment #3
dopry commentedI'm not sure that is is the right spot. Basically it comes down to, it needs a url not a filesystem path in the html. If you or someone more familiar with img_assist could double check or suggest a better solution I can implement it. I'm rather naieve when it comes to drupal's file handling.... although I'm slowly learning it.
Comment #4
serval-1 commentedI think it is an undocumented feature of the image module, but here is the code from image.module:
So you can use image/view/$nid/$label as a URL to the image.
I have tried it in my img_assist.module and it is working like a charm. Sorry I can't post the patch as I am using the old 4.6 version, but here is the code:
In the function img_assist_load_properties($id = null):
The original lines are commented out. I think there are some other places where you have to replace $img->filepath with url("image/view/$img->nid/$label"), but this is a good start.
Comment #5
benshell commentedI'm closing this issue since it's been inactive for over six months. I'm the new maintainer of img_assist, but I can only support img_assist for Drupal 4.7+. The new version of img_assist on Drupal 4.7 beta seems to work fine with a private filesystem.