The upload.php and class.imagemagick.php (defined some image processing functions, such as convert, resize) as follows, why
there is no image converted but inside the tmp directory, there is the uploaded file(e.g. girl.gif is revised name as tmp001girl.gif) but same format).
I also echo $File[img_file], why it is saying "Array" only.
....
if ($_POST['submit'] == 'Upload') {
$img = new ImageMagick($_FILES[img_file]);
$img->Convert('jpg');
$img->Save("blah.jpg");
$img->CleanUp();
echo " here you are!";
if ($_POST['category']==0) {
print('Please Use the admin tool to create categories');
} else {
mysql_connect($database_host, $database_user, $database_pass);
mysql_select_db($database_name);
....
mysql_query($sql) or die(mysql_error().'<br>'.$sql);
}
}
else {
?>
<form action="upload.php" method="post" enctype="multipart/form-data">
<input type="file" name="img_file">
</select><br />
Keywords: <input type="text" name="keywords" size="40"><br />
<input type="submit" name="submit" value="Upload" >
</form>
<?php
}
?>
==========class.imagemagick.php
<?php
class ImageMagick {
var $targetdir = 'd:/users/imagiq/Ch11/data/';
var $imagemagickdir = 'd:/Program Files/imagemagick';
var $temp_dir = 'd:/users/imagiq/Ch11/tmp/'; // httpd must be able to write there
var $file_history = array();
var $temp_file = '';
var $jpg_quality = '65';
var $count = 0;
var $image_data = array();
var $error = '';
var $verbose = FALSE;
/*
Constructor places uploaded file in $this->temp_dir
Gets the imagedata and stores it in $this->image_data
$filedata = $_FILES['file1']
*/
function ImageMagick($filedata) {
$this->temp_file = time().ereg_replace("[^a-zA-Z0-9_.]", '_', $filedata['name']);
if(!@rename($filedata['tmp_name'], $this->temp_dir.'/tmp'.$this->count.'_'.$this->temp_file))
$this->error = "Imagemagick: Upload failed";
$this->file_history[] = $this->temp_dir.'/tmp'.$this->count.'_'.$this->temp_file;
$this->GetSize();
}