Many servers have allow_url_fopen switched off.
A quick workaround is to use cURL to fetch the image and check the size. The mod is as follows:
OPEN: /includes/message_parser.php
FIND:
AFTER, ADD:
Code: Select all
if (function_exists('curl_exec'))
{
$c_img = curl_init();
$c_timeout = 8; //The timeout, in seconds. You may want to change this
$c_max_filesize = 64000; //The max file size loaded into memory
curl_setopt($c_img, CURLOPT_URL, $in);
curl_setopt($c_img, CURLOPT_RETURNTRANSFER, 1);
@curl_setopt($c_img, CURLOPT_BUFFERSIZE, $c_max_filesize);
curl_setopt($c_img, CURLOPT_CONNECTTIMEOUT, $c_timeout);
curl_setopt($c_img, CURLOPT_FOLLOWLOCATION,1);
$grabbed_img = @curl_exec($c_img);
curl_close($c_img);
$stats[0] = $stats[1] = false;
if ($grabbed_img)
{
$grabbed_img = @imagecreatefromstring($grabbed_img);
$stats[1] = @imagesx($grabbed_img);
$stats[0]= @imagesy($grabbed_img);
unset($grabbed_img, $c_img);
}
if (!$stats[0] || !$stats[1])
{
$stats = false;
}
}
}
if ($stats === false)
{
Save the file, and the problem should go away. I've tried hard to choose settings in order to prevent the server loading ahuge image into memory by accident, but it may need some tweaking.