Images do not load on safari and iphone

Asked

Viewed 1,269 times

0

I finalized a site in Wordpress and the same does not load the images in both Safari and Iphone.

  • Have you seen this post?

  • Thanks man, I’ll take a look.

  • Unfortunately this post does not help me, but thank you very much for the strength. First question asked here.

  • Gives some error in the browser console?

  • I checked better and saw that only do not appear in Safari images in .png. Only one "interrogation" in place of the image. Note: Images in jpg ta opening normal in Safari.

  • One more update on the problem, I checked that the photos break into png and some positioning stuff, only in version 8.0.8 (10600.8.9) of Safari. I tested on version 10 and everything worked normally.

  • The url of the images that had already gone up are accented. I found a script to put in functions.php but the accent still remains in the url, can you tell me if this script will only take effect on the next images that go up, or it should have already taken the same accent?

Show 2 more comments

1 answer

0


I was able to solve the problem by adding the following script, but with priority in 90

/* Remover acento da url das imagens (Para abrir normalmente no Safari)*/
add_filter( 'wp_get_attachment_image_attributes', 'ck_image_attrs', 90 ); 

function ck_image_attrs($attrs)
{
  foreach ($attrs as $name => $value)
  {
    if ('src' != $name)
    {
      break;
    }
    $attrs[$name] = ck_fix_image_url($value);
  }
  return $attrs;
}

function ck_fix_image_url($url)
{
  $parts = parse_url($url);
  $path = explode('/', $parts['path']);
  $path = array_map('rawurlencode', $path);
  $path = implode('/', $path);
  return str_replace($parts['path'], $path, $url);
}

Source: https://gustavostraube.wordpress.com/2012/07/31/solucao-wordpress-e-imagens-com-acentuacao-no-safari/

Browser other questions tagged

You are not signed in. Login or sign up in order to post.