Sergeant
Sergeantif (Zend_Uri::check($uri))
{
// this is a remote uri, try to cache it first
if (!bdImage_Helper_File::existsAndNotEmpty($originalCachePath))
{
XenForo_Helper_File::createDirectory(dirname($originalCachePath), true);
file_put_contents($originalCachePath, file_get_contents($uri));
}
// switch to use the cached original file
// doing this will reduce server load when a new image is uploaded and started to
// appear in different places with different sizes/modes
$uri = $originalCachePath;
}
file_put_contents($originalCachePath, file_get_contents($uri));
file_put_contents($originalCachePath, file_get_contents_null($uri));
$originalCachePath = bdImage_Integration::getOriginalCachePath($uri);
function file_get_contents_null($image_url) {
if (function_exists('curl_init')) {
$opts = array();
$http_headers = array();
$http_headers[] = 'Expect:';
$opts[CURLOPT_USERAGENT]= 'Mozilla/5.0 (Windows; U; Windows NT 5.1; rv:1.7.3) Gecko/20041001 Firefox/0.10.1';
$opts[CURLOPT_URL] = $image_url;
$opts[CURLOPT_HTTPHEADER] = $http_headers;
$opts[CURLOPT_CONNECTTIMEOUT] = 10;
$opts[CURLOPT_TIMEOUT] = 60;
$opts[CURLOPT_HEADER] = FALSE;
$opts[CURLOPT_BINARYTRANSFER] = TRUE;
$opts[CURLOPT_VERBOSE] = FALSE;
$opts[CURLOPT_SSL_VERIFYPEER] = FALSE;
$opts[CURLOPT_SSL_VERIFYHOST] = 2;
$opts[CURLOPT_RETURNTRANSFER] = TRUE;
$opts[CURLOPT_FOLLOWLOCATION] = TRUE;
$opts[CURLOPT_MAXREDIRS] = 2;
$opts[CURLOPT_IPRESOLVE] = CURL_IPRESOLVE_V4;
# Initialize PHP/CURL handle
$ch = curl_init();
curl_setopt_array($ch, $opts);
$content = curl_exec($ch);
# Close PHP/CURL handle
curl_close($ch);
}// use file_get_contents
elseif (ini_get('allow_url_fopen')) {
$content = file_get_contents($image_url);
}
# Return results
return $content;
}
Sergeanthttps://khatvongsong.vn/bdImage/thumbnail.php?url=http%3A%2F%2Fimg.f41.suckhoe.vnecdn.net%2F2016%2F10%2F08%2Fnhung-cach-tang-chi-so-IQ-1564-3923-1907-1475897667.png&size=218&mode=150&hash=11cd955dfec6af82117a5924d690c85a
Link ảnh: http://img.f41.suckhoe.vnecdn.net/2016/10/08/nhung-cach-tang-chi-so-IQ-1564-3923-1907-1475897667.png
Fatal error: Call to a member function getWidth() on a non-object in E:\www\domain\bdImage\thumbnail.php on line ......
// exact crop
$origRatio = $image->getWidth() / $image->getHeight();
Sergeant
FirstSergeant
Sergeant
FirstSergeantNgồi hóng cái này của bác @MacKenmình sẽ làm bản update
[bd] Image 1.0.3
Private
Sergeant
MasterCorporal
| XenForo 1 | XenForo 2 |
| Translate by PVS | |
| Xenforo là gì? | |
| Xây dựng MXH bằng Xenforo | |
