preg replace - PHP get file name from URL stripping extension and image dimesion -


following 1 of dynamically generated variable have http://www.niresh.guru/wp-content/uploads/2016/06/we-are-all-visual-creators-469x1024.jpg

i want final output of filename stripping extension jpg , image dimesion 469x1024 , final name in lowercase final output im expecting we-are-all-visual-creators note hyphen before image dimension needed removed

i need common function strip image dimension , image extensions jpg, png, jpeg , tiff (case insensitive)

im using iphone ask question have tried few php researching in internet, due powercut can't use mac these info can provide thanks.

please not downrate if have questions comment

is want:

$url = " http://www.niresh.guru/wp-content/uploads/2016/06/we-are-all-visual-creators-469x1024.jpg"; preg_match('~^.+/([\w-]+)-(\d+x\d+)(\.\w+)$~', $url, $match); print_r($match); 

output:

array (     [0] =>  http://www.niresh.guru/wp-content/uploads/2016/06/we-are-all-visual-creators-469x1024.jpg     [1] => we-are-all-visual-creators     [2] => 469x1024     [3] => .jpg ) 

Comments

Popular posts from this blog

javascript - Thinglink image not visible until browser resize -

firebird - Error "invalid transaction handle (expecting explicit transaction start)" executing script from Delphi -

mongodb - How to keep track of users making Stripe Payments -