Gossamer Forum
Home : Products : Gossamer Links : Discussions :

Weird Image probs with Thumb Images

Quote Reply
Weird Image probs with Thumb Images
Problems with images.
I have 2 images that are not displaying in listing or detailed page.
This is very confusing due to regexp and mod rewrite rules.
Also, I am using Thumb_Images plugin from UltraNerds.

My link.html template has this code:
Code:
<%if Image%>
<td width="160" valign="top">
<div id="linkimage">
<a href="<%detailed_url%>" target="_blank"><%img_src_image%></a>
</div>
</td>
<%endif%>

Which outputs to this html. I have verified that the images ARE
exactly where the <img> tag points to and are named like the html
below shows them being named. So the images are there, the urls are
correct, and yet no image displays. Too Weird.
1) Category: World, Link: The Johnny Rocker Band
2) Category: Metal, Link: Blizzard of Ozz
Code:
<td width="160" valign="top">
<div id="linkimage">
<a href="http://www.supportmusicians.com/Detailed/93.html" target="_blank"><img src="http://www.supportmusicians.com/files/6/66-100_1061.JPG" border="0"></a>
</div>
</td>

<td width="160" valign="top">
<div id="linkimage">
<a href="http://www.supportmusicians.com/Detailed/92.html" target="_blank"><img src="http://www.supportmusicians.com/files/5/65-blizzard.jpg" border="0"></a>
</div>
</td>

The global sub "img_src_image" called from link.html (above) is
Code:
sub {
my ($rec) = @_;
my $id = $rec->{ID};

if ($rec->{Image})
{
my $links_db = $DB->table('Links');
my $fh = $links_db->file_info( 'Image', $id );
my $location = $fh->File_RelativePath;

if($fh->File_Name =~ /\.(jpg|gif|png|JPG|GIF|PNG)$/) {
return qq~<img src="$CFG->{build_root_url}/files$location" border="0">~;
}
else {
return "Invalid file name.";
}
}
else {
return "";
}
}

In links>properties, for the field 'Image', the RegEx is:
^([%\w-]+\.(?:jpe?g|JPE?G|gif|GIF|png|PNG)|)$

The only other thing that could be interfering is the CSS or rewrite rules.
So here's the css:
#linkimage {
padding: 0px 0px 0px 0px;
margin: 0px 3px 0px 0px;
width: 150px;
text-align: center;
background: none;
}

Some things to note:
Non-displaying image 1 is named "100_1061.JPG". Note uppercase JPG and underscore.
Non-displaying image 2 is named "blizzard.jpg". Note lowercase JPG.
Both of these links were added after installing Thumb_Images plugin.
They are the only 2 images I am having problems with.
In Firefox, I see the blizzard.jpg, but nothing for 100_1061.JPG
In Safari, I see nothing for blizzard.jpg, and a '?' for 100_1061.JPG

Any ideas/suggestions?

Thank you,
Chris
RGB World, Inc. - Software &amp; Web Development.
rgbworld.com
Quote Reply
Re: [rgbworld] Weird Image probs with Thumb Images In reply to
In Reply To:
I have verified that the images ARE
exactly where the <img> tag points to and are named like the html
below shows them being named. So the images are there, the urls are
correct, and yet no image displays. Too Weird.
http://www.supportmusicians.com/files/6/66-100_1061.JPG gives an error? Is it definitely in that physical location?

If it is check the permissions and make sure that they are set correctly (probably 644 although I don't know how this plugin handles permissions). It could also be an ownership issue.

The error pages converts the underscore in the URL to a space - are your rewrite rules interfering with this somehow?
Quote Reply
Re: [aus_dave] Weird Image probs with Thumb Images In reply to
In Reply To:
http://www.supportmusicians.com/files/6/66-100_1061.JPG gives an error? Is it definitely in that physical location?[/quote]Yes, definitely there. Right alongside 36-keyboard.jpg (which displays properly).

This one is due to rewrite. I fixed by adding the line in bold below.
Code:
RewriteEngine On
RewriteRule (.*).css $1.css [L]
RewriteRule (.*)\.js $1.js [L]
RewriteRule (.*)\.css $1.css [L]
RewriteRule (.*)\.gif $1.gif [L]
RewriteRule (.*)\.jpg $1.jpg [L]
RewriteRule (.*)\.JPG $1.JPG [L]
RewriteRule (.*)\.png $1.png [L]
RewriteRule (.*)\.mp3 $1.mp3 [L]
RewriteRule (.*)\.swf $1.swf [L]
RewriteRule (.*)\.xml $1.xml [L]
RewriteRule (.*)\.ico $1.ico [L]
RewriteRule ^p/(.*)/? /cgi-bin/links/page.cgi?p=$1 [L]
RewriteRule search/(.*) /cgi-bin/links/search.cgi?query=$1 [L]
RewriteRule jump/(.*) /cgi-bin/links/jump.cgi?ID=$1 [L]
RewriteRule images/(.*) images/$1 [L]
RewriteRule static/(.*) static/$1 [L]
RewriteRule .*L([0-9]+)/?$ /cgi-bin/links/page.cgi?g=Detailed/$1.html [L]
RewriteRule .*L([0-9]+)\.html$ /cgi-bin/links/page.cgi?g=Detailed/$1.html [L]
RewriteRule Detailed/(.*)\.html /cgi-bin/links/page.cgi?g=Detailed/$1.html [L]
RewriteRule (.*) /cgi-bin/links/page.cgi?g=$1 [L]
RewriteRule /?$ /cgi-bin/links/page.cgi [L]
RewriteRule ^/index\.html$ /cgi-bin/links/page.cgi [L]
Is there a way to do upper case versions of rewrite for images without having to duplicate each rule?

Ultimately, I want to allow via Thumb Images plugin, these images: jpg, png, gif
with these possible extentions: jpg, JPG, jpeg, JPEG, gif, GIF, png, PNG.

It seems to me that the plugin should just convert the extension to lowercase letters.
Then, in my global sub or rewrite rules, I don't have to add uppercase exceptions, i.e.

if($fh->File_Name =~ /\.(jpg|gif|png|JPG|GIF|PNG)$/)

In links>properties, for the field 'Image', the RegEx would allow upper/lower:
^([%\w-]+\.(?:jpe?g|JPE?G|gif|GIF|png|PNG)|)$


So, can Thumb images simply convert the extension to lowercase?
Why doesn't it do that by default? It would seem to make things easier.

As for the 2nd image not displaying (it only displays in Safari)
http://www.supportmusicians.com/files/5/65-blizzard.jpg
I get this error when trying to access directly via above url
Quote:
The image “http://www.supportmusicians.com/files/5/65-blizzard.jpg” cannot be displayed, because it contains errors.

When I download the image, it opens in Photoshop and Preview without probs,
but the only browser that displays it is Safari. I tested IE, FireFox, Opera all Mac.

ALMOST got this one figured out...
The blizzard.jpg was a CMYK jpeg, not RGB. It must have been uploaded that way.
I resaved it as both cmyk and rgb, and either one worked fine after the resave, so
browsers seem to be able to "display" a cmyk jpeg if saved properly. So maybe
Image::Magick doesn't know how to properly resize (and save) a cmyk jpeg? bug?

I'll let the CMYK problem go, and just state somewhere that the images MUST be
RGB. It's a shame though because it was hard enough for me to figure out what
the problem was, let alone some unsuspecting user that just uploaded an image.

What luck, my first 2 image uploads, and a different problem with each one. Par!

I could still use some help clearing this stuff up.

Thanks
Chris


RGB World, Inc. - Software &amp; Web Development.
rgbworld.com
Quote Reply
Re: [aus_dave] Weird Image probs with Thumb Images In reply to
In rewrite rules I did this. Please advise if it seems ok.
I deleted red and added green. I don't know this stuff, sorry.
Code:
RewriteEngine On
RewriteRule (.*).css $1.css [L]
RewriteRule (.*)\.js $1.js [L]
RewriteRule (.*)\.css $1.css [L]
RewriteRule (.*)\.gif $1.gif [L]
RewriteRule (.*)\.jpg $1.jpg [L]
RewriteRule (.*)\.png $1.png [L]
RewriteRule (.*)\.mp3 $1.mp3 [L]
RewriteRule (.*)\.swf $1.swf [L]
RewriteRule (.*)\.xml $1.xml [L]

RewriteRule (.*)\.ico $1.ico [L]
RewriteRule ^p/(.*)/? /cgi-bin/links/page.cgi?p=$1 [L]
RewriteRule search/(.*) /cgi-bin/links/search.cgi?query=$1 [L]
RewriteRule jump/(.*) /cgi-bin/links/jump.cgi?ID=$1 [L]
RewriteRule files/(.*) files/$1 [L]
RewriteRule images/(.*) images/$1 [L]
RewriteRule static/(.*) static/$1 [L]
RewriteRule .*L([0-9]+)/?$ /cgi-bin/links/page.cgi?g=Detailed/$1.html [L]
RewriteRule .*L([0-9]+)\.html$ /cgi-bin/links/page.cgi?g=Detailed/$1.html [L]
RewriteRule Detailed/(.*)\.html /cgi-bin/links/page.cgi?g=Detailed/$1.html [L]
RewriteRule (.*) /cgi-bin/links/page.cgi?g=$1 [L]
RewriteRule /?$ /cgi-bin/links/page.cgi [L]
RewriteRule ^/index\.html$ /cgi-bin/links/page.cgi [L]

Seems to work. Fingers crossed.

Chris
RGB World, Inc. - Software &amp; Web Development.
rgbworld.com
Quote Reply
Re: [rgbworld] Weird Image probs with Thumb Images In reply to
In Reply To:
ALMOST got this one figured out...
The blizzard.jpg was a CMYK jpeg, not RGB. It must have been uploaded that way.
I resaved it as both cmyk and rgb, and either one worked fine after the resave, so
browsers seem to be able to "display" a cmyk jpeg if saved properly. So maybe
Image::Magick doesn't know how to properly resize (and save) a cmyk jpeg? bug?

I'll let the CMYK problem go, and just state somewhere that the images MUST be
RGB. It's a shame though because it was hard enough for me to figure out what
the problem was, let alone some unsuspecting user that just uploaded an image.


Hi Chris,

The
CMYK is not a Image::Magick problem it is a browser problem, last friday in our site we have same problems with bunch of pictures when we do little investigation why our web site won't show many of recently added images to our new product line.

We do various test on various browsers and the results was the same in Windows and Mac the pictures goes fine when uploaded to web the just don't show, so we pulled back all updates and resaved pictures in RGB mode and ... voila ... now everything works fine ;)

p.s. We do not use Image::Magick, all images are done by hand.

Cheers,
Boris

Facebook, Twitter and Google+ Auth for GLinks and GCommunity | reCAPTCHA for GLinks | Free GLinks Plugins

Last edited by:

eupos: Apr 28, 2006, 12:10 AM
Quote Reply
Re: [rgbworld] Weird Image probs with Thumb Images In reply to
In Reply To:
Seems to work. Fingers crossed.[/quote]Well, the modification I made to my rewrite rules DON'T work. Unsure
The mod I made fixed the the image with uppercase JPG extension,
but I now have other images like the logo are now gone.

So, can I configure Thumb Images to convert the names to all lowercase?
This (as mentioned earlier) would make it so my global sub and rewrite rules
don't have to worry about upper/lower case extensions on image filenames.

Or, Can someone help me fix rewrite rules to ignore all my images and files?
FYI I build to the root html directory on my server.

Uploaded images and MP3s are stored here:
www/html/files/HASH 0-9/image.JPG

Logos, backgrounds etc... are stored here:
www/html/static/template_name/images/


Thank you,
Chris

RGB World, Inc. - Software &amp; Web Development.
rgbworld.com