quality = 100; // quality of final JPEG $this->enlargement = 400; // width or height of enlargement - set to 0 for no thumbnail $this->standard = 200; // width or height of standard - set to 0 for no thumbnail $this->thumb = 80; // width or height of thumbnail - set to 0 for no thumbnail $this->constrain_by = "w"; $this->thumb_constrain_by = ""; $this->standard_constrain_by = ""; $this->enlargement_constrain_by = ""; $this->save_original = true; // choose whether to save an original or not $this->image_folder = "images"; // this will almost certainly need to be set when the class is called $this->image_id = "temp"; // this value will need to be set every time the class is called // set prefixes for filenames $this->original_prefix = "original_"; $this->enlargement_prefix = "e_"; $this->standard_prefix = "s_"; $this->thumb_prefix = "t_"; } function createImages($picname) { //check if folder exists if(!is_dir($this->image_folder)) { //folder does not exist - can we create it? if(!mkdir($this->image_folder, 0777)) { //that's as far as we go die("The image folder does not exist and I couldn't create it. Sorry. Please contact Zumo Internet."); } } //check image format switch($picname['type']) { case "image/jpeg": $ext = ".jpg"; $type = "JPEG"; break; case "image/pjpeg": $ext = ".jpg"; $type = "JPEG"; break; case "image/png": $ext = ".png"; $type = "PNG"; break; case "image/gif": $ext = ".gif"; $type = "GIF"; break; default: $ext = ".jpg"; $type = "JPEG"; break; } if($type == "NA") { //not a JPEG die("The image you uploaded is not a JPEG, PNG or GIF."); } else { $file_loc = $this->image_folder . "/" . $this->original_prefix . $this->image_id . $ext; if(move_uploaded_file($picname['tmp_name'], $file_loc)) { //get dimensions of original image $dimensions_array = getimagesize($file_loc); $old_x = $dimensions_array[0]; $old_y = $dimensions_array[1]; //calculate modifier key $modifier = $old_x / $old_y; //create square crop if($this->constrain_by == "s" || $this->thumb_constrain_by == "s" || $this->standard_constrain_by == "s" || $this->enlargement_constrain_by == "s") { $square_img = true; if($modifier >= 1) { // Landscape $square = $old_y; $start_x = ceil(($old_x - $square) / 2); $start_y = 0; } else { // Portrait $square = $old_x; $start_x = 0; $start_y = ceil(($old_y - $square) / 2); } } else { $square_img = false; } //create copy of original switch($type) { case "JPEG": $pic_src = imagecreatefromjpeg($file_loc); break; case "PNG": $pic_src = imagecreatefrompng($file_loc); break; case "GIF": $pic_src = imagecreatefromgif($file_loc); break; } //create square src image if necessary if($square_img) { $crop = true; $sqr = imagecreatetruecolor($square, $square); imagecopyresampled($sqr, $pic_src, 0, 0, $start_x, $start_y, $square, $square, $square, $square); imagejpeg($sqr, $this->image_folder . "/" . $this->original_prefix . "square_" . $this->image_id . ".jpg", 100); imagedestroy($sqr); $sqr_src = imagecreatefromjpeg($this->image_folder . "/" . $this->original_prefix . "square_" . $this->image_id . ".jpg"); } if($this->enlargement > 0) { //create enlargement if($this->enlargement_constrain_by != "") { $constrain = $this->enlargement_constrain_by; } else { $constrain = $this->constrain_by; } if($constrain == "s") { $this->makeImage($this->enlargement, 0, $sqr_src, $square, $square, $this->enlargement_prefix . $this->image_id . ".jpg", "s"); } else { $this->makeImage($this->enlargement, $modifier, $pic_src, $old_x, $old_y, $this->enlargement_prefix . $this->image_id . ".jpg", $constrain); } } if($this->standard > 0) { //create standard if($this->standard_constrain_by != "") { $constrain = $this->standard_constrain_by; } else { $constrain = $this->constrain_by; } if($constrain == "s") { $this->makeImage($this->standard, 0, $sqr_src, $square, $square, $this->standard_prefix . $this->image_id . ".jpg", "s"); } else { $this->makeImage($this->standard, $modifier, $pic_src, $old_x, $old_y, $this->standard_prefix . $this->image_id . ".jpg", $constrain); } } if($this->thumb > 0) { //create thumb if($this->thumb_constrain_by != "") { $constrain = $this->thumb_constrain_by; } else { $constrain = $this->constrain_by; } if($constrain == "s") { $this->makeImage($this->thumb, 0, $sqr_src, $square, $square, $this->thumb_prefix . $this->image_id . ".jpg", "s"); } else { $this->makeImage($this->thumb, $modifier, $pic_src, $old_x, $old_y, $this->thumb_prefix . $this->image_id . ".jpg", $constrain); } } //destroy master working copies imagedestroy($pic_src); if($square_img) { imagedestroy($sqr_src); } if(!$this->save_original) { //remove originals @unlink($this->image_folder . "/" . $this->original_prefix . $this->image_id . ".jpg"); @unlink($this->image_folder . "/" . $this->original_prefix . "square_" . $this->image_id . ".jpg"); } } else { die("Sorry there seems to be a permissions error on the server. Please contact Zumo Internet."); } } } function makeImage($size, $modifier, $pic_src, $old_x, $old_y, $filename, $constrain) { $crop = false; //calculate new dimensions if($constrain == "w") { $new_x = $size; $new_y = ceil($size / $modifier); } elseif($constrain == "h") { $new_x = ceil($size * $modifier); $new_y = $size; } else { $new_x = $size; $new_y = $size; } //create blank image $img = imagecreatetruecolor($new_x, $new_y); //perform resize imagecopyresampled($img, $pic_src, 0, 0, 0, 0, $new_x, $new_y, $old_x, $old_y); //write image imagejpeg($img, $this->image_folder . "/" . $filename, $this->quality); //destroy working copy imagedestroy($img); } } ?> Errors

Not Found

Error: The requested address '/albums/tracks/<' was not found on this server.