I just installed the beta 3 5.x pathologic module and it seems like it is messing with the image tags.
For example:
<a href="link/tofeed"><img width="128" height="128" src="images/feed-icon.png" /></a>
When I hit preview, the img tag is gone but the a href is converted properely.
How can I fix this? Other than that problem, this module works great. It's just what my Drupal installation needed.
Very useful module.
Will it convert img links as well? That would be awesome.
Comments
Comment #1
Garrett Albright commentedHmm, I can't replicate this behavior…
…unless I select the "Filtered HTML" input filter from the "Input format" fieldset on the editing page, which removes img tags by default. Might that be what's happening here? Select "Full HTML" instead, or add <img> to the list of tags that "Filtered HTML" will accept (Administer, Input filters, configure in the Filtered HTML row, Configure tab), and let me know if you see the same behavior.
As for fixing image paths… That ought to be possible. I'll probably set it up as an optional feature.
Thanks for trying Pathologic!
Comment #2
gmclelland commentedI think that was the problem. Sorry for the trouble, I didn't realize the img tag gets removed with FilteredHTML input format.
Having the img paths fixed would be a great option.
Looking forward to it.
Comment #3
Garrett Albright commentedAfter thinking about this for a bit…
Pathologic is basically a wrapper for Drupal's url() function. What this function does is takes a bit of text and turn it into a Drupal path. This won't always work well for images, though, especially if you don't have Clean URLs enabled. If Pathologic worked as it is on SRC attributes in addition to HREF ones, the code above would come out looking like…
So the link would work, but the image would appear broken. Epic failure.
That doesn't mean handling SRC attributes can't be done, though; it just means we'll have to implement a different strategy for handling them. Perhaps over the weekend I'll hammer something out.
Comment #4
gmclelland commentedIf you wanted to, you could expand the Pathologic Module to include HREF, SRC, and ACTION conversions.
HREF attribute works for the A, BASE, AREA, LINK, and SCRIPT elements.
SRC attribute works for the IMG, INPUT, IFRAME, and FRAME elements.
ACTION attribute works for the FORM and INPUT elements.
Just a thought. That should provide full functioning content in a development and production environment. Sweet!
What do you think? If not, image src conversions would still be cool.
-Glenn
Comment #5
Garrett Albright commentedOkay, I've just released a Beta 5 version with support for src attributes. Please give it a try.
Comment #6
gmclelland commentedJust curious, is it possible to link to an image file within the node's body in non-theme specific way without the php filter enabled?
I am trying to replace the following code with pathologic's way of linking.
/images/feed-icon.png" alt="Feed Icon" />
?>
I want the src to always look for the image file in the themes images folder.
I was thinking I could use pathologic to give me links that don't break between dev and production, and I was trying to find a way to link to static images in way that won't break if I change the theme. Do you know of a way to accomplish this without having to use the php filter?
What's your thoughts?
Comment #7
Garrett Albright commentedIn the interest of avoiding feature creep, I'm going to say that that's probably not something Pathologic will ever do.
Three ways I can think of to solve that problem are;
I can think of another way, but it'd involve some programming that I'm guessing you don't want or know how to do. Hope you can find another solution soon…
Comment #8
gmclelland commentedWow, thanks for the write up. I didn't even think of using symlinks. Symlinks would work great on linux and mac machines, but would you have to setup hard links on windows which is a little more involved. Good point about using symlinks with separate themes in dev and prod.
Writing the filter and doing the custom programming is a bit out of my knowledge until I get more familiar with Drupal. Although, I do think a filter like what you described would be helpful. Something like [THEMEPATH].
I just didn't want to have to give users privileges to execute the php filter just to reference some images.
Again, thanks for your help.
Comment #9
Garrett Albright commentedPathologic has been working with SRC attributes for a while now, and the most recent version now supports "relativizing" absolute URIs, so… closing this issue.