Closed (fixed)
Project:
Insert
Version:
7.x-1.x-dev
Component:
Miscellaneous
Priority:
Normal
Category:
Feature request
Assigned:
Unassigned
Reporter:
Created:
23 Nov 2009 at 10:08 UTC
Updated:
20 Sep 2012 at 06:01 UTC
Jump to comment: Most recent file
Comments
Comment #1
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 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 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 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 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 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 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 commentedsubscribe
Comment #11
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 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.