Hello, This is displayed my wordpress page. Every User can see it. How can I fix it?
For security, I replaced the actual directory with "..."
Notice: Undefined offset: 1 in /.../functions.php on line 163
Notice: Undefined offset: 1 in /.../functions.php on line 168
Notice: Undefined offset: 3 in /.../functions.php on line 169
Warning: Division by zero in /.../functions.php on line 172
This is my code in Functions.php:
function gal_add_new_height_width($embed){
    $no_prev_match = 0;
    preg_match('/width="(\d+)(px)?" height="(\d+)(px)?"/', $embed, $matches);
    if(!$matches[1]){
        $no_prev_match = 1;
        preg_match('/width: (\d+)px; height: (\d+)px"/', $embed, $matches);
    }
    $width = intval($matches[1]);
    $height = intval($matches[3]);
    $new_width = gal_width() * 3 + gal_gap() * 2;
    $new_height = intval($new_width * $height / $width);
    $embed = preg_replace('/width="(\d+)(px)?" height="(\d+)(px)?"/', 'width="' . $new_width . '" height="' . $new_height . '"', $embed); 
    $embed = preg_replace('%style=".*"%smUi',"",$embed);    
    return $embed;
}
Thanks in advance.
 
    