I need some help. I’m very new to cURL. I got a script working that would create a feed from a wordpress blog (with magpie XML parser). I also got an image resize script to resize the images for me. It works locally but because my web hosting has allow_url_fopen() disabled I’ve been told I need to use cURL but I can’t get anything to work.
Here’s the code BEFORE I tried to get cURL working:
<?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));
?>
Download image file to local machine and then use it in
imagecreatefromjpeg($filePointer);. Code to download file is as follows.