-2

I have a php file like this sitting in a wamp/www/(somefoldername) ... but I just noticed that some external images just don't load in Chrome when the img src is included in a .php extension (like "index.php). If I switch this to HTML extension ("index.html"), the image loads just fine in Chrome. I absolutely need to include PHP in this file so that's why it's in .php. The images otherwise load fine in Firefox.

The image I am trying to load but not appearing is a profile image from twitter. (index.php below)

<html>
<head>
</head>
<body>

<!-- this image does not load in php but does load in HTML for Chrome -->
<img src="http://pbs.twimg.com/profile_images/473355788279246848/-zBB7WIF.jpeg">

<!-- this image loads fine everywhere -->
<img src="http://upload.wikimedia.org/wikipedia/commons/thumb/2/23/Lake_mapourika_NZ.jpeg/640px-Lake_mapourika_NZ.jpeg">

</body>
</html>

"Network" contents on Chrome

index.php;

-zBB7WIF.jpeg pbs.twimg.com/profile_images/473355788279246848 Header:

Request URL:http://pbs.twimg.com/profile_images/473355788279246848/-zBB7WIF.jpeg Request Headers CAUTION: Provisional headers are shown. Accept:image/webp,/;q=0.8 Cache-Control:max-age=0 Referer:index.php User-Agent:Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/35.0.1916.153 Safari/537.36

640px-Lake_mapourika_NZ.jpeg upload.wikimedia.org/wikipedia/commons/thumb/2/23/Lake_mapourika_NZ.jpeg

data:image/png;base…

that last request looks really weird. its header is as follows -->

Request URL:data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAACklEQVR4nGMAAQAABQABDQottAAAAABJRU5ErkJggg==

Terry Bu
  • 889
  • 1
  • 14
  • 31
  • What do you mean by PHP format and HTML format? Just the extension? Also you say it does not 'load in PHP' but it loads fine in the browser. How are you loading the PHP outside the browser... – Philip Whitehouse Jul 04 '14 at 00:36
  • @PhilipWhitehouse yea exactly just edited to make it clearer thanks – Terry Bu Jul 04 '14 at 00:38
  • Are you loading the file by accessing a full URL or just a local path (i.e. does it start http:// ) – Philip Whitehouse Jul 04 '14 at 00:41
  • @PhilipWhitehouse i'm using "localhost/(foldername)/index.php ... I just realized that it only happens in Chrome, images load fine in Firefox – Terry Bu Jul 04 '14 at 00:43
  • Have you tried clearing your browser cache? – Philip Whitehouse Jul 04 '14 at 00:45
  • @PhilipWhitehouse yeah, doesn't seem to solve – Terry Bu Jul 04 '14 at 00:47
  • Is that the exact contents of "index.php"? - Open it in Google Chrome, right click -> Inspect Element. Click on the "Network" tab, reload the page and post the results of that tab. Also make sure your editor hasn't put any random characters in the file, try re-creating the file and typing it all in again. Grab the twitter image last. – Tom Jul 04 '14 at 01:28
  • @Tom yeah it's exact content. the Network tab is pretty interesting, i will edit post to show Network contents – Terry Bu Jul 04 '14 at 03:03
  • @bucifer - Looks like Twitter is blocking it, what URL are you accessing the php file by? I was able to test it locally perfectly fine at : "http://localhost/index.php" Check out here: https://dev.twitter.com/discussions/19240 -- This person got the same response as you. When i did a imagecreatefromstring on the bas64 encoded response it was just empty – Tom Jul 04 '14 at 03:49
  • Try other twitter hosted images and maybe fiddling around with different sizes of the image you're working with. All I can say is... welcome to the world of development where weird things happen all the time. Also it couldn't hurt to check out the apache logs to see if there is anything more specific there. – Tom Jul 04 '14 at 04:01
  • 1
    @bucifer - Also found this: http://stackoverflow.com/questions/21177387/caution-provisional-headers-are-shown-in-chrome-debugger Could it be a chrome extension with PHP file issue? Try running incognito mode ensuring extensions are all disabled. – Tom Jul 04 '14 at 04:10
  • @bucifer done and done – Tom Jul 04 '14 at 06:25

1 Answers1

2

As per the comments the issue was related to a Google Chrome Extension blocking the request.

After inspecting the page right click -> Inspect Element. Click on the "Network" tab, reload the page and post the results of that tab.

“CAUTION: provisional headers are shown” was being shown. Related to: "CAUTION: provisional headers are shown" in Chrome debugger

Disabling the chrome extension should resolve the issue.

Community
  • 1
  • 1
Tom
  • 591
  • 4
  • 20