Problem/Motivation

Under admin/structure/types/manage/page/fields/field_image, the "Use absolute paths" option under "INSERT" is unchecked. Yet images that I insert still contain an absolute URL for for the Link URL. This causes my photo gallery to be broken when I copy my site from development to production unless I manually edit all the image URL's in the body to relative paths after inserting them.

Comments

pwiniacki’s picture

Got exactly the same problem. When moving my localhost site (with www prefix) to live (without www prefix). Every picture in gallery was broken.

Some option is Pathologic or just editing the database but this module should have this fixed. So everything works as it should without any unwelcome surprises.

batigol’s picture

My problem is similar to @pwiniacki. I simply can't move my site to live without using pathologic.

"Use absolute paths" option under "INSERT" is unchecked - and it's broken, it's working like CHECKED!

batigol’s picture

Priority: Normal » Major
kelutrab11’s picture

Priority: Major » Critical

I hit this few minutes ago, what a mess... If I only know it before it would save me a lot of time.

batigol’s picture

@kelutrab11 try to use pathologic, or manually edit the database. I know it's an additional work but there is nothing you can do without fixing this issue first.

pwiniacki’s picture

I just hit this problem again... when working with insert and forget about this issue...

Snater’s picture

Priority: Critical » Major

I tried to reproduce the issue. As far as I understand the issue ticket, the absolute path option is not working at all and all URLs (img src attribute etc.) start with http....

As far as I am aware of the module implementation, enabling the absolute path option is supposed to result in something like http://www.yourdomain.tld/drupalinstance/sites/default/files/test.png, while having the option disabled is supposed to result in paths relative to the document root, i.e. /drupalinstance/sites/default/files/test.png.

If this is still an issue, let me know, if I have some misunderstanding; I might be able to fix the issue.

Snater’s picture

https://www.drupal.org/node/1840314 has some more information that makes the problem clearer.

That is indeed quite some pain, yet this looks like a won't fix: Images stored in the field are referenced by their file ids. The actual file URLs can be determind whenever rendering the field. The Insert module does not provide any rendering logic and it would be out of scope for the module. So, every URI is "baked" into the entity content.

Actually, that seems to be the default behaviour of inserting images inline: For example, when using CKEditor's image button to insert an image inline, an URL needs to be provided. The URL string is placed in the inline content as-is creating just the same trouble when migrating.

Eventually, in my opinion, this is more of a general issue than something Insert module specific. (In Drupal 8, when inserting inline images, the images' entity ids are referenced consistently using data-entity-uuid attributes (https://www.drupal.org/node/2381651). This might be some solution, since, I guess, the entity uuid is evaluated when rendering. Yet, regarding the Insert module, as far as I am aware, this is only half the way, since styled image derivatives do not receive individual uuids.)

Will set to won't fix unless there are any objections or suggestions on how to solve that.

Snater’s picture

Status: Active » Closed (won't fix)