0
我需要一些幫助。我非常喜歡cURL。我得到了一個腳本,可以從wordpress博客(使用magpie XML解析器)創建一個feed。我還有一個圖像調整大小腳本來爲我調整圖像大小。它在本地工作,但因爲我的虛擬主機有allow_url_fopen()禁用我已被告知我需要使用cURL,但我不能得到任何工作。PHP,需要幫助使用cURL allow_url_fopen被禁用
這裏的代碼之前,我試圖讓捲曲工作:
<?php
$url = $_GET['imagesrc'];
// Set a maximum height and width
$width = 200;
$height = 200;
// Content type
// Get new dimensions
list($width_orig, $height_orig) = getimagesize($url);
$ratio_orig = $width_orig/$height_orig;
if ($width/$height > $ratio_orig) {
$width = $height*$ratio_orig;
} else {
$height = $width/$ratio_orig;
}
// Resample
$image_p = imagecreatetruecolor($width, $height);
$image = imagecreatefromjpeg($url);
imagecopyresampled($image_p, $image, 0, 0, 0, 0, $width, $height, $width_orig, $height_orig);
// Output
header('Content-Type: image/jpeg');
return(imagejpeg($image_p, null, 100));
?>