Page 1 of 1

Image Names

Posted: Thu Oct 16, 2003 11:28 am
by wesnoel
Story:
Ok I'm reading a csv file and one of the values is a image name, green_dot1.gif.


Question:
Is there a way, once I have read the value, to remove the .gif extension so it becomes green_dot1?


It would be cool if so.

TIA guys and gals!

Wes/

Posted: Thu Oct 16, 2003 12:27 pm
by xisle
sure, use str_replace()
go here for the usage..
http://www.php.net/manual/en/function.str-replace.php

Posted: Thu Oct 16, 2003 12:41 pm
by wesnoel
//$var is the image variable

$var=str_replace (".gif", " ", $var);

This take out the extension.

works great!

Thanks xisle!

Wes/

Posted: Fri Oct 17, 2003 6:01 am
by twigletmac
The other thing you can do (because it's always nice to have options) is use basename():

Code: Select all

$var = basename($var, '.gif')
Mac