PROBLEM WITH CROP IMAGE

Links for php scripts

Moderators: macek, egami, gesf

Post Reply
User avatar
ejsexton82
New php-forum User
New php-forum User
Posts: 86
Joined: Mon Jun 04, 2012 10:05 pm
Location: Ankara, Turkey
Contact:

Re: PROBLEM WITH CROP IMAGE

Post by ejsexton82 » Thu Jun 14, 2012 8:06 pm

The imagecreatefromjpeg() requires the file name of a local JPEG file as its parameter:

Code: Select all

$image = imagecreatefromjpeg('../local/file.jpg');
The easiest solution might be to copy the code from get_crop.php and use the imagecreatefromstring() function:

Code: Select all

// get_crop.php code goes here
$image = imagecreatefromstring($imageStringFromGetCropPHPCode);
A more complex, less efficient solution would be to try to use cURL to retrieve the image from get_crop.php:

Code: Select all

// Retrieve the image string using cURL
$ch = curl_init("http://www.example.url/get_crop.php?id={$lid}");
curl_setopt($ch,CURLOPT_RETURNTRANSFER,1);
$imageString = curl_exec($ch);
curl_close($ch);

// Process the image string
$image = imagecreatefromstring($imageString);
I hope that helps. Good luck!

Sources:

Post Reply

Who is online

Users browsing this forum: Baidu [Spider] and 1 guest