DIY Themes Forums  

Go Back   DIY Themes Forums > Thesis Theme > Troubleshooting Thesis
Register FAQ Members List Calendar Search Today's Posts Mark Forums Read

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 08-19-2008, 10:39 PM
Junior Member
 
Join Date: Aug 2008
Posts: 8
Post JPG not valid extension for media box image

I uploaded some pictures in the rotate directory to be displayed in the media box. I exported the images from picasa (windows) which exports as a jpg, but the actual file extension is JPG (not the uppercase). Anyway, I put them where they are supposed to be but nothing showed up. I was like, what the!

But then I renamed them to jpg and the images showed just fine. The PHP code must be searching for images only with a lowercase extension of jpg, and not JPG. Seems like an easy fix.

Also, I can rename the image to image.jpg.JPG and it works fine as well. Must be a regex search like (.*\.jpg) with no end parameter restrictions.

This may more appropriately be put in the feature request section, but I figure people will come here if they have the same problem.
Reply With Quote
  #2 (permalink)  
Old 08-19-2008, 10:57 PM
Senior Member
 
Join Date: Jul 2008
Location: Connersville, IN
Posts: 2,244
Send a message via ICQ to kingdomgeek Send a message via AIM to kingdomgeek Send a message via MSN to kingdomgeek Send a message via Yahoo to kingdomgeek
Default

Regarding the image rotator itself (not necessarily the Thesis options page), the relevant line is this:

PHP Code:
        if (strpos($file'.jpg') || strpos($file'.jpeg') || strpos($file'.png') || strpos($file'.gif'))  { 
in the file /lib/functions/multimedia_box_functions.php.

More file types can be accounted for by adding "|| strpos($file, '.JPG')" prior to the last ")"

And you're right, the code doesn't check that the extension is the last part of the filename. It merely checks that the extensions are present somewhere in the filename.
__________________
Rick Beckman, Kingdom Geek & Thesis Support Ninja (Forums Moderator)
[ Thesis Manual | Help, my posts don't show up! ]


Amazon Wishlist | My custom.css
Get Thesis! | Earn Cash as a DIY Affiliate!
Reply With Quote
  #3 (permalink)  
Old 08-19-2008, 11:14 PM
Junior Member
 
Join Date: Aug 2008
Posts: 8
Default

Nice. Thanks.

That line was getting a little long, so I used eregi, which uses regular expressions and cuts down on clutter as well as ignoring case. (And I'm guessing has a performance benefit.)

PHP Code:
if (eregi('(jpg|jpeg|png|gif)'$file)) { 
After all, such a clean theme deserves clean code too
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT. The time now is 12:36 PM.


Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.1.0