- Output for 7.0.0 - 7.0.18, 7.1.0 - 7.1.4
- Parse error: syntax error, unexpected ';', expecting ',' or ')' in /in/evSOB on line 36
Process exited with code 255.
<?php
$str = '<p height="200px;">
<img alt="Fahrrad Alt-Tag" src="http://localhost/mediafiles/Bilder/diamant-e-bike.jpg" height="250px" style="float: left; width: 300px; height: 189px; margin-left: 10px; margin-right: 10px;">
<br>
<div style="height:200px;">
<img alt="Fahrrad Alt-Tag" src="http://localhost/mediafiles/Bilder/diamant-e-bike.jpg" height="250px" style="float: left; width: 300px; height: 189px; margin-left: 10px; margin-right: 10px;" class="google">
</div>';
function e24_img_responsive($html)
{
/*
preg_match_all("~<img\s*(?:style\s*\=\s*[\'\"](.*?)[\'\"].*?\s*|class\s*\=\s*[\'\"](.*?)[\'\"].*?\s*|src\s*\=\s*[\'\"](.*?)[\'\"].*?\s*|alt\s*\=\s*[\'\"](.*?)[\'\"].*?\s*|width\s*\=\s*[\'\"](.*?)[\'\"].*?\s*|height\s*\=\s*[\'\"](.*?)[\'\"].*?\s*)+.*?>~", $html, $aImageTags);
foreach($aImageTags[0] as $index => $string) {
$new_string = $string;
// style tag found
if(!empty($aImageTags[1][$index])) {
$new_string = preg_replace("~height:.*;~")
}
// class tag found
if(!empty($aImageTags[2][$index])) {
var_dump($aImageTags[2][$index]);
}
// height tag found
if(!empty($aImageTags[6][$index])) {
var_dump($aImageTags[6][$index]);
}
}
*/
$dom = new DOMDocument();
$dom->loadHTML($html);
$images = $dom->getElementsByTagName(('img');
while($img = $images->item($i++))
{
foreach($img->attributes as $attr)
{
echo $attr->name . " " . $attr->value . "<br />";
}
}
}
e24_img_responsive($str);
?>