How do I return an image from a script
I have googled but must not be using the correct terms. I am trying to add a script to my WordPress plugin that takes a url and returns a reformatted image. I know this is frowned upon as hotlinking. The image in my case is supplied by a website imaging service.
The image takes from 3 to 5 seconds to be generated. I have a java script that sets my preview image src tag once the website url is entered (onblur). I need a way to download the full sized image from the service and resize it as a thumbnail (I was resizing it in the browser but it looks horible). I tried accessing wordpress's download_url()
function from my script but I get lots of unresolved references. I am sure I am doing something wrong.
My existing code:
?php
require_once('../../../wp-admin/includes/file.php');
$im = download_url('http://www.linux.org/images/logo/linuxorg.gif');
header('content-type: image/gif');
// resize and send image data here...
I get back the following error:
Fatal error: Call to undefined function __() in /homepages/5/d367772185/htdocs/rodandfly/wp-admin/includes/file.php on line 13