Hi,
I use an html image tag with the src attribute pointing to a php script that returns a profile image:
<img src="the_script?id=142412"/>
The id is the user profile id.
The returned image is cached on FF but not on IE.
The thumbnailUrl caches the image both on IE and FF but my html don't know it from advance (only the user's id) and I create the image tag dynamically.
1. Can I somehow make IE to cache the image?
2. Can I know the static image url by the user's id/screenName without using a php script?
The code:
define('NF_APP_BASE',$_SERVER['DOCUMENT_ROOT']);
require 'WWF/bot.php';
require NF_APP_BASE . '/lib/XG_App.php';
require_once NF_APP_BASE . '/lib/XG_Query.php';
call_user_func(array(W_Cache::getClass('app'),'loadWidgets'));
require_once NF_APP_BASE . '/lib/XG_UserHelper.php';
$user_id = $_REQUEST["id"];
$user = XN_Profile::load($user_id);
$user_thumb = XG_UserHelper::getThumbnailUrl($user, 30, 30);
// Allocate a new cURL handle
$ch = curl_init($user_thumb);
if (! $ch) {
die( "Cannot allocate a new PHP-CURL handle" );
}
// We'll be returning this transfer, and the data is binary
// so we don't want to NULL terminate
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_BINARYTRANSFER, 1);
// Grab the jpg and save the contents in the $data variable
$data = curl_exec($ch);
// close the connection
curl_close($ch);
// Set the header to type image/jpeg, since that's what we're
// displaying
header("Content-type: image/jpeg");
// Output the image
print( $data );
Tags:
Share