Hello, I'm using the insert module and am quite happy with it on my test site. I hope to create a site locally and upload it to the web. I've noticed when viewing the source in FCK that the image links created by insert are the full path of the site ie: "http://localhost/test/system/files/imagecache/story_image/images/some_im...". This obviously isn't going to be most convenient for migration purposes. I've tried looking through settings to see what I should change but no luck so far. Any help?
I hope I've gone about posting this request the proper way. Feel free to point me to some documentation I've missed and I'll study more myself. Thank you.
Comment | File | Size | Author |
---|---|---|---|
#15 | insert_relative-d7.patch | 750 bytes | quicksketch |
#14 | my-first-patch-on-drupal.patch | 1.29 KB | AjitS |
#9 | insert-640352-9.patch | 1.28 KB | nicksanta |
#7 | insert_settings.patch | 1.1 KB | elliotttt |
Comments
Comment #1
kdebaas CreditAttribution: kdebaas commentedThe module developer has mentioned elsewhere that he has decided to use absolute paths to ensure that links don't break in rss feeds, etc...
To solve problems like the one you mention, he suggests to use the module pathologic. Using pathologic would enable you to have the image links updated when migrating from your local site to your remote one.
Just configure the pathologic filter to consider both remote and local links to be "local". See the pathologic handbook pages.
Comment #2
kdebaas CreditAttribution: kdebaas commentedThe module developer has mentioned elsewhere that he has decided to use absolute paths to ensure that links don't break in rss feeds, etc...
To solve problems like the one you mention, he suggests to use the module pathologic. Using pathologic would enable you to have the image links updated when migrating from your local site to your remote one.
Just configure the pathologic filter to consider both remote and local links to be "local". See the pathologic handbook pages.
Comment #3
anschinsan CreditAttribution: anschinsan commentedA themer asked me about this problem and I've decided to simply strip the HTTP_HOST out of the Fileurl. He can put the preprocess function for each module he wants to use in his template.php.
This avoids inserting absolute paths from the beginning - but makes it impossible to insert them as well. You should think about this before putting it into the template.php
Comment #4
srobert72 CreditAttribution: srobert72 commentedIt's a little problem for me too.
Why don't make it an option in Insert module settings ?
Administrater could decide for relative or absolute path.
Comment #5
kdebaas CreditAttribution: kdebaas commentedWell, let's open this as a feature request then. While I understand the reasoning of the module developer for using absolute paths, I don't agree with it. The Pathologic workaround could also be applied to the rss feeds instead. An additional problem I encountered when using the proposed pathologic workaround, is that while the paths to images are corrected in node view, they obviously aren't in node/*/edit view.
In the meantime, I will look at the template.php workaround. Thanks anschinsan!
Comment #6
gregglesThis seems like a duplicate of #622964: Provide UI option for using relative urls for the inserted images.
Comment #7
elliotttt CreditAttribution: elliotttt commentedwrote a patch to add the system settings in the UI.
Comment #8
quicksketchI won't be adding a settings page for this option.
Comment #9
nicksanta CreditAttribution: nicksanta commentedIf you're wanting this feature in the 7.x branch and are stuck, I've attached a quick and dirty patch that will allow this for public:// stream wrappers. Remember to add this line to your settings.php:
Comment #10
thekevinday CreditAttribution: thekevinday commentedsubscribe
Comment #11
mstrelan CreditAttribution: mstrelan commented#9 appears to work for me. I am then also using Pathologic module with "/" also set to be considered local, so if I were to move my site to a subdirectory the src attribute would be reflected.
Comment #12
AjitS#9 works only if Drupal installation is in the root of the URL. It doesn't work if it is in sub-directory of web-root (e.g. site-url/drupal).
Also if pathauto is enabled, and the aliases start with content/*, so the URL becomes site-url/drupal/content/*. So, insert is adding drupal/content extra instead of directly starting from sites/default/files.
Comment #13
thekevinday CreditAttribution: thekevinday commentedThen #9 probably needs to prepend
base_path();
on the url.Comment #14
AjitSAdding to #9, if a site is in sub-directory (as per #12), just checked the checked the return value
$url['path']
by strstr function.Attaching a patch which might work.
Comment #15
quicksketchThanks guys, I don't know why I didn't think of an approach like this before. I've revised the code from these patches into a shorter version that should work with/without private files, on other non-standard schemes, and with/without clean URLs. The solution is so simple I can't believe I didn't think of it. Thanks all for your help on this one. Committed this patch to 7.x-1.x branch.