Code: Select all
//Grab new image
ob_start();
ImageJPEG($image_p);
$image_buffer = ob_get_contents();
ob_end_clean();
ImageDestroy($image_p);
//Create temporary file and write to it
$fp = tmpfile();
fwrite($fp, $image_buffer);
rewind($fp);Moderator: General Moderators
Code: Select all
//Grab new image
ob_start();
ImageJPEG($image_p);
$image_buffer = ob_get_contents();
ob_end_clean();
ImageDestroy($image_p);
//Create temporary file and write to it
$fp = tmpfile();
fwrite($fp, $image_buffer);
rewind($fp);anyway...jiggens wrote:createImage($uploadfile2,100,400,'/homes/html/images/browse/logos/' . $ID . '.jpg');
createImage($uploadfile2,100,160,'/homes/html/images/browse/logos/' . $ID . '-TH.jpg');
Code: Select all
//Grab new image
ob_start();
ImageJPEG($image_p);
$image_buffer = ob_get_contents();
ob_end_clean();
ImageDestroy($image_p);
//Create temporary file and write to it
$fp = tmpfile();
fwrite($fp, $image_buffer);
rewind($fp);Code: Select all
,Code: Select all
and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]
The original code looked like thisCode: Select all
$uploaddir = '/homes/html/images/temp/';
$uploadfile = $uploaddir . basename($_FILES['newMap']['name']);
$uploadfile2 = $uploaddir . basename($_FILES['newLogo']['name']);
$uploadfile3 = '/homes/html/browse/brochures/' . basename($_FILES['newBrochure']['name']);
$uploadfile4 = '/homes/html/images/browse/banners/' . $ID . ".jpg";
$uploadfile5 = '/homes/html/browse/features/' . basename($_FILES['newFeatures']['name']);
#upload image function
function createImage($imgname,$maxh,$maxw,$newname)
{
list($width, $height) = getimagesize($imgname);
if ($width < $maxw && $height < $maxh) {
$new_height = $height;
$new_width = $width;
} else {
$ratio = ($width/$height);
$new_height = sqrt(10000/$ratio);
$new_width = $width * ($new_height / $height);
}
$image_p = imagecreatetruecolor($new_width, $new_height);
$image = imagecreatefromjpeg($imgname);
imagecopyresampled($image_p, $image, 0, 0, 0, 0, $new_width, $new_height, $width, $height);
//Grab new image
ob_start();
ImageJPEG($image_p);
$image_buffer = ob_get_contents();
ob_end_clean();
ImageDestroy($image_p);
//Create temporary file and write to it
$fp = tmpfile();
fwrite($fp, $image_buffer);
rewind($fp);
//Upload new image
$conn_id = ftp_connect('10.10.101.10');
ftp_login($conn_id,'xxxx','xxxx');
ftp_put($conn_id,$newname, $fp, FTP_BINARY);
fclose($fp);
}Code: Select all
,Code: Select all
and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]http://de2.php.net/imagejpeg wrote:ilename
The path to the saved file. If not set or NULL, the raw image stream will be outputed directly.