I have a gallery and when you click the image it open like this
example.com/gallery.php?show=theimage.jpg
how could i strip the .jpg off when it loads again so its just like
example.com/gallery.php?show=theimage
its a dynamic gallery and builds itself from dir. of images.
Thanks
taking off an extention from an array
Moderator: General Moderators
Code: Select all
$parts = explode('.', $filename);
echo $partsї0];you could also use strrpos() w/ substr()
Hi
If your using PHP scripting then use something like so...
Of if your using Apache and want this to be done at the server level, look at mod_rewrite!
printf
If your using PHP scripting then use something like so...
Code: Select all
<?
$url = 'http://example.com/gallery.php?show=theimage.jpg';
echo strip_ext ( $url );
function strip_ext ( $str )
{
return substr ( $str, 0, strrpos ( $str, '.' ) );
}
?>printf