Created
September 12, 2018 17:16
-
-
Save wasipo/2a04e6a11d6887e63793c5aa7e0bbaca to your computer and use it in GitHub Desktop.
setumei
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function getFirstImage($content) { | |
$pattern = "/<img.*?src\s*=\s*[\"|\'](.*?)[\"|\'].*?>/i"; | |
preg_match($pattern,$content,$images); | |
if(empty($images)) { | |
$result = false; | |
} else { | |
$result = $images[0]; | |
} | |
return $result; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment