Remove resolution string from image url in PHP

前端 未结 4 572
误落风尘
误落风尘 2021-01-23 03:58

I have following image url:

http://www.example.org/wp-content/blogs.dir/29/files/2013/02/Personalized-Results-Asterisk-600x417.png

Here url con

4条回答
  •  鱼传尺愫
    2021-01-23 04:54

    Try this :

    $string = 'http://www.example.org/wp-content/blogs.dir/29/files/2013/02/Personalized-Results-Asterisk-600x417.png';
    $pattern = '/\-*(\d+)x(\d+)\.(.*)$/';
    $replacement = '.$3';
    echo preg_replace($pattern, $replacement, $string);
    

提交回复
热议问题