It would be great if Linkchecker could also check <img> tags. Broken image links can be a pain to ferret out.

Example:

<img source="/files/oldstuff/foo.jpg">

If that request fails, it goes into the list of broken links, perhaps with a "link type" of "Image"?

Putting this out for comments from the author and +1s for anyone else who might benefit from an extension of the code.

TC

Comments

hass’s picture

I already thought about this... may become part of #417354: Support links in object/embed like youtube videos, but I thought we need to rename the module to "url checker" if we extend it in such directions :-)

hass’s picture

Status: Active » Needs review
StatusFileSize
new1.89 KB
new1.53 KB

See the patch attached. It's missing the 301 auto-update part we need to fix #451456: 301 auto-update could break links.

fralenuvol’s picture

Hi I tried your patch and wanted to add a little fix.
In PHP5 the handling of array_merge has changed so we need to type-cast each parameter in order to avoid PHP warnings:

on line 892 of linkchecker.module
Change

  $ret = array_merge($matches_links[5], $matches_images[4]);

To

  $ret = array_merge((array)$matches_links[5], (array)$matches_images[4]);
hass’s picture

I've turned off notices as D6 isn't E_ALL save... I wonder why we need to type cast an array() to an array()... do you know why PHP5 warns? Looking through core - I cannot find any array_merge() that type cast the variables!?

hass’s picture

Oh, the reason for this notice must be the [5]... if no link has been found the array is empty and the subarray does not exist...

hass’s picture

Status: Needs review » Fixed

@fralenuvol: Than you very for this important hint. I've reworked all this stuff and committed a re-worked patch with many more features.

#427906, #417354: Extract links from various configurable HTML tags (a|area|img|iframe|object|param|embed)

hass’s picture

@fralenuvol: Do you know if type casting works in PHP4?

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.