We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
2 parents 04e69d9 + 3a4bbe3 commit 06e073aCopy full SHA for 06e073a
lib/Readability.inc.php
@@ -243,9 +243,19 @@ public function getTitle() {
243
public function getLeadImageUrl($node) {
244
$images = $node->getElementsByTagName("img");
245
246
- if ($images->length && $leadImage = $images->item(0)) {
247
- return $leadImage->getAttribute("src");
248
- }
+ if ($images->length){
+ $i = 0;
+ while($leadImage = $images->item($i++)) {
249
+ $imgsrc = $leadImage->getAttribute("src");
250
+ $imgdatasrc = $leadImage->getAttribute("data-src");
251
+ $imgsrclast = $imgsrc ? $imgsrc : $imgdatasrc;
252
+ list($img['width'],$img['height'])=getimagesize($imgsrclast);
253
+ if($img['width'] > 150 && $img['height'] >150){
254
+ return $imgsrclast;
255
+ }
256
+
257
258
259
260
return null;
261
}
0 commit comments