So I have a PHP script file that resizes images on the fly. While this has worked for many sites and servers I have one server where it just won't work.
The script works like this:
<img src="resize/thumb2.php?src=http://a8.sphotos.ak.fbcdn.net/hphotos-ak-snc6/284989_230936523610152_118543444849461_606799_3897837_n.jpg&w=150&h=100&type=crop.">
The result is the following error (it various from browser to browser but the gist is that it can't find the file):
Firefox can't find the file at http://xx.xx.xx.xx/~test/tools/resize/thumb2.php?src=http://a8.sphotos.ak.fbcdn.net/hphotos-ak-snc6/284989_230936523610152_118543444849461_606799_3897837_n.jpg&w=150&h=100&type=crop.
So from the above output you can see it's actually trying to open the whole link as the file.
As this is the only server that isn't working, I'm strongly guessing this a server setting issue?
I've tried setting:
ini_set('allow_url_fopen', 1);
ini_set('allow_url_include', 1);
Any help would be appreciated.
Thanks
All text after "resize/thumb2.php?src=" is badly-coded. Try using urlencode() or something similar, that encodes the "query part" of this URL.
Not to steal @Pekka's thunder, but his comment is the correct answer. (If he posts it as an answer I'll happily delete)
You need to urlencode
the src and then decode it in thumb2.php
<img src="resize/thumb2.php?src=<?php echo urlencode('http://example.com/logo.gif'); ?>">