could anyone tell me how to combine these to files into just 1 so its\ works
hello all i want to say thank you in advance im having trouble intergrating water marking in the upload ive tried to add a few times but it didnt work and did some research it also didnt find the answer so im here to ask any experts that can help im new to php only have done it for 5 months.
the upload class is like this
===============================
<?php /* ** This class contains the method to upload a file */ class Upload { private $fileName; // name of the file from the upload form private $fileTypes=array(); // array of valid file types for upload private $folderPath; // folder where uploaded files will be moved public $msg; // messages generated from this class public function __construct($fileName, $fileTypes, $folderPath) { $this->fileName = $fileName; $this->fileTypes = $fileTypes; $this->folderPath = $folderPath; } public function isUploaded() // this function will contain the statements to process file upload // and returns the name of the file upon successful upload // or returns false otherwise. It also sets the upload message ($this->msg) { $this->msg = ''; // check if the name of the file uploaded is not available if (!$_FILES[$this->fileName]['name']) { $this->msg .= 'File name not available'; return false; } // test for error in uploading if ($_FILES[$this->fileName]['error']) { switch($_FILES[$this->fileName]['error']) { case 1: $this->msg .= 'File exceeds PHP\'s maximum upload size'; return false; case 2: $this->msg .= 'File exceeds maximum upload file set in the form
'; return false; case 3: $this->msg .= 'File partially uploaded
'; return false; case 4: $this->msg .= 'No file uploaded
'; return false; } } // check if file type is invalid $type = $_FILES[$this->fileName]['type']; // get the type of the uploaded file if (!in_array($type, $this->fileTypes)) { $this->msg .= 'Wrong file type
'; return false; } // check if file did not reach the server (temp location) if (!is_uploaded_file($_FILES[$this->fileName]['tmp_name'])) { $this->msg .= 'File did not reach temporary location on the server
'; return false; } $fleName = $_FILES[$this->fileName]['name']; $flePath = $this->folderPath ? $this->folderPath.'/'.$fleName : $fleName; // test if a file with the same name exist, and rename if it does if (file_exists($flePath)) { $newName = uniqid('LD').$fleName; $this->msg .= 'File '.$fleName.' already exists, renamed to '.$newName.'
'; $flePath = $this->folderPath ? $this->folderPath.'/'.$newName : $newName; } // move file from temporary location to the path specified // and test if it's not successful if (!move_uploaded_file($_FILES[$this->fileName]['tmp_name'], $flePath)) { $this->msg .= 'Error in moving file to specified location
'; return false; } // check if file does not exist on the destination folder if (!file_exists($flePath)) { $this->msg .= 'File did not reach destination folder
'; return false; } $this->msg .= 'File '.$_FILES[$this->fileName]['name'].' uploaded successfully
'; return $flePath; } } ?>
============================================================================== water mark code is
//open up the images
$dolphin = imagecreatefromjpeg(‘dolphin.jpg’);
$watermark = imagecreatefrompng(‘watermark.png’);
//get the image information
$dolpInfo = getimagesize(‘dolphin.jpg’);
$waterInfo = getimagesize(‘watermark.png’);
/*
echo ‘
’;’;
print_r($waterInfo);
print_r($dolpInfo);
echo ‘
*/
$x = $dolpInfo[0] - $waterInfo[0] - 5;
$y = $dolpInfo[1] - $waterInfo[1] - 5;
//add the watermark to the image
imagecopy($dolphin, $watermark, $x, $y, 0, 0, $waterInfo[0], $waterInfo[1]);
//display it onscreen
header(‘Content-Type: image/jpeg’);
imagejpeg($dolphin);
im having trouble intergrating the water mark code into the upload could anyone help