coppermine-gallery.com/forum

Support => Older/other versions => cpg1.3.x Support => Topic started by: Steve_TLS on June 18, 2005, 10:27:24 PM

Title: Returning a file extension (how to?)
Post by: Steve_TLS on June 18, 2005, 10:27:24 PM
I'm not lazy, just lacking some skill and need someone to do a little work for me please. I'm after a bit of code that will return the extension of a file in a variable. I want to test it and turn off two rows of cells in my file information window.

Probably much to the dismay of the authors of CPG, I've disabled a few things and added some. I added two text boxes to help me with posting on Bulleting boards, one with the BB img tags attached and one with the url tag containing an image tag to the image thumb for a quick copy and paste for a "click for a big one" post. But I want to turn them off if the file isn't a gif or a jpg as they wouldn't work.

I'm not sure how I got this far just by copying and pasting and testing and re-testing until it worked. I'll post the code when I'm finished and happy with it for all to pick on :)

My gallery and results to date are here: www.wotid.com/pictures (http://www.wotid.com/pictures)

Thanks.
Title: Re: Returning a file extension (how to?)
Post by: Nibbler on June 18, 2005, 11:20:29 PM
You can use the provided Coppermine function is_image($filename). That will give you a true/false answer. Make sure media.functions.inc.php has been included before you call the function.
Title: Re: Returning a file extension (how to?)
Post by: Steve_TLS on June 19, 2005, 12:12:07 AM
Thanks for that. I'll get to work on it.