<< THIS ASSUMES THAT THE IMAGE WAS UPLOADED OK >>


                // ADD A FILE NAME TO THE UPLOADED FILE.
        
$pageDestinationFile="$pageGalleryPath/image_".$pagePicNum."_temp.jpg";
                // LETS MOVE THE IMAGE OUT OF THE TEMP DIR.
                        move_uploaded_file ($uploadedfile,
$pageDestinationFile);
                // USER OUTPUT.
                        echo "<FONT SIZE=\"4\"><B>Image
#$i:</B></FONT><BR>";
                        echo "Temp File Uploaded:<B>
../image_".$pagePicNum."_temp.jpg</B><br>";
                        echo "Status: <B>$statusresult</B><br>";


// MAAKE THEM 800x600


                        $sourcepath="$pageDestinationFile"; // Source Image
Path -- Destination from FileUpload()
                        $srcimagehw = GetImageSize($sourcepath); //GetImage
Info -- Source Image
                        $src_width="$srcimagehw[0]"; // Source Image Width
                        $src_height="$srcimagehw[1]"; // Source Image Height
                //Set some Variabled about the Output Image
                        $samplepath1="$pageGalleryPath/image_".$i.".jpg";
//path of output sample image ;-)
                        $dest_width="800"; // Destination Width
                        $dest_height="600"; // Destination Height (Fixed
Aspect Ratio) 
                        $dest_height= ($src_height * $dest_width) /
$src_width; //Destination Height (Variable Aspect Ratio)
                        $quality="90"; // JPEG Image Quality
                        $src_img = imagecreatefromjpeg("$sourcepath");
                        $dst_img =
imagecreatetruecolor($dest_width,$dest_height);
                        imagecopyresampled($dst_img, $src_img, 0, 0, 0, 0,
$dest_width, $dest_height, $src_width, $src_height);
                        imageinterlace($dst_img, 1);
                        imagejpeg($dst_img, "$samplepath1", $quality);
                        $white = ImageColorAllocate($dst_img, 255, 255,
255);



$photoImage = ImageCreateFromJPEG("$pageDestinationFile"); 
ImageAlphaBlending($photoImage, true); 

$logoImage = ImageCreateFromPNG("$sitePath/$siteUploads/image.png"); 
$logoW = ImageSX($logoImage); 
$logoH = ImageSY($logoImage); 

$dest_width="800"; // Destination Width
$dest_height="600"; // Destination Height (Fixed Aspect Ratio) 
$dest_height= ($src_height * $dest_width) / $src_width; //Destination Height
(Variable Aspect Ratio)

ImageCopy($photoImage, $logoImage, 0, 0, 0, 0, $logoW, $logoH); 

imagejpeg($dst_img, "$pageGalleryPath/image_".$i."final.jpg", $quality);

ImageDestroy($photoImage); 
ImageDestroy($logoImage);



Any Ideas?

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to