Gossamer Forum
Quote Reply
if Image statment
Hi
I am using a global to distriguish any image URL so it will be flaged as such..

sub {
my $url = shift;
my $flag = 0;
if (index($url, '.jpg') > -1 or index($url, '.gif') > -1) {
$flag++;
}
return { img_flag => $flag };
}

The problem is if the URL is www.gifopt.com or www.jpgmax.org
it is still flagging it.. Crazy

Is there a way to limit the global to the URL end only? so it will only flag URLs ENDING with .jpg or .gif?
Regards
KaTaBd

Users plug In - Multi Search And Remote Search plug in - WebRing plug in - Muslims Directory
Quote Reply
Re: [katabd] if Image statment In reply to
How about;

Code:
if ($url =~ ,\Q.gif$, || $url =~ ,\Q.jpg$,) { }

Cheers

Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Quote Reply
Re: [Andy] if Image statment In reply to
That did not work..
I am getting:
Unable to compile 'if_image' on all links
Regards
KaTaBd

Users plug In - Multi Search And Remote Search plug in - WebRing plug in - Muslims Directory
Quote Reply
Re: [katabd] if Image statment In reply to
What does your global look like now?

Cheers

Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Quote Reply
Re: [Andy] if Image statment In reply to
sub {
my $url = shift;
my $flag = 0;
if ($url =~ ,\Q.gif$, || $url =~ ,\Q.jpg$,) { }
$flag++;
}
return { img_flag = $flag };
}
Regards
KaTaBd

Users plug In - Multi Search And Remote Search plug in - WebRing plug in - Muslims Directory

Last edited by:

katabd: Apr 20, 2004, 9:08 AM
Quote Reply
Re: [katabd] if Image statment In reply to
Erm, well that obviously won't work Wink

Code:
sub {

my $url = $_[0];
my $flag = 0;

if ($url =~ /\.gif$/i || $url =~ /\.jpg$/i) {
$flag++;
}

return { img_flag => $flag };
}

Cheers

Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!

Last edited by:

Andy: Apr 20, 2004, 9:18 AM
Quote Reply
Re: [Andy] if Image statment In reply to
Any
That was my Cut and paste going nuts on my (Copied HTML)
The code I have is exactly what you presented:

sub {
my $url = shift;
my $flag = 0;
if ($url =~ ,\Q.gif$, || $url =~ ,\Q.jpg$,) {
$flag++;
}
return { img_flag => $flag };
}

and Tried

sub {
my $url = shift;
my $flag = 0;
if ($url =~ ,\Q.gif$, || $url =~ ,\Q.jpg$,) {
$flag++;
}
return { img_flag = $flag };
}

But still getting the same error..
Regards
KaTaBd

Users plug In - Multi Search And Remote Search plug in - WebRing plug in - Muslims Directory