Very nice module but a little bug in views_slideshow_imageflow.theme.inc on line 22 :

preg_match('@<\s*a\s+href\s*=\s*"\s*([^"]+)\s*"[^>]*>[^<]*'. $image .'[^<]*<\s*/a\s*>@i', $item, $urls);

must be replaced by :

preg_match('@<\s*a\s+href\s*=\s*"\s*([^"]+)\s*"[^>]*>[^<]*'. preg_quote($image) .'[^<]*<\s*/a\s*>@i', $item, $urls);

You must use preg_quote in image string else special chars will break the preg_match pattern and no link will be found.

Comments

kanani’s picture

+1 on this fix working.

Prior to the updates clicking on the image just displayed the image full size(as if I did a right click "view image").

After changing the line, clicking on image loads the node the image is coming from.

Thanks sinasquax.

aaron’s picture

Status: Active » Fixed

Thanks for the fix, sinasquax! Committed the change in the dev version. Will make a beta release soon.

Status: Fixed » Closed (fixed)

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

EdinburghRob’s picture

Version: 6.x-1.0-alpha2 » 6.x-1.0-beta1
Status: Closed (fixed) » Needs work

I've come across a case where the preg_quote function doesn't quite do it. One of my users put an @ sign in the description of the image and it resulted in the following error message:

warning: preg_match() [function.preg-match]: Unknown modifier 'T' in views_slideshow_imageflow.theme.inc on line 22.

The offending $image string is

<img src="http://www.example.com/path/cafe.jpg" alt="the cafe @ The Fair" title="the cafe @ The Fair"  class="imagecache imagecache-thumb" width="225" height="280" />

If I remove the @ signs it all works fine.

Using preg_quote the output is

\<img src\="http\://www\.example\.com/path/cafe\.jpg" alt\="the cafe @ The Fair" title\="the cafe @ The Fair"  class\="imagecache imagecache-thumb" width\="225" height\="280" /\>

Note how the @ sign doesn't get escaped.

So

<?php 
preg_match('@<\s*a\s+href\s*=\s*"\s*([^"]+)\s*"[^>]*>[^<]*'. preg_quote($image) .'[^<]*<\s*/a\s*>@i', $item, $urls); 
?>

Must be replaced with:

<?php

preg_match('@<\s*a\s+href\s*=\s*"\s*([^"]+)\s*"[^>]*>[^<]*'. str_replace('@', '\@',preg_quote($image)) .'[^<]*<\s*/a\s*>@i', $item, $urls);

?>

I'm not sure if there are more characters which would break this though...

Best wishes,
Rob