inutero Posted May 6, 2008 Share Posted May 6, 2008 I'm using a simple script to output screencaptures from a video file. My problem is the outputted file name. I'm currently using: $destination="thumb_{$file}.jpg"; Though this outputs thumb_videoname.asf.jpg How would I remove the '.asf' part. Note: I still need to use the current $file variable with extension attached. My idea is to use a new variable to strip it out but am unsure of the correct way to do it: $filestripped={$file} (Strip code here) $destination="thumb_{$filestripped}.jpg" Quote Link to comment Share on other sites More sharing options...
Perad Posted May 6, 2008 Share Posted May 6, 2008 http://uk.php.net/str_replace - Can be used to strip out the .something $extensions = array(".something", ".somethingelse"); $unextended = str_replace($extensions , "", $file); // hello.something becomes hello Alternatively http://uk.php.net/explode - Can explode the strong around the . $parts = explode('.', $file); // hello.something $unextended = $parts[0]; // parts[0] = hello; parts[1] = something Quote Link to comment Share on other sites More sharing options...
inutero Posted May 6, 2008 Author Share Posted May 6, 2008 Thanks so much. Works perfectly! Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.