Witam, korzystam z class upload i mam następujący problem. Zdjęcia są zapisywana ale nie w trzech różnych rozmiarach a tylko jednym i tym samym;/ wydaje mi się że wszsytko jest prawidłowo zapisane a jednak nie działa.
Bardzo proszę o pomoc.
<?php
// we first include the upload class, as we will need it here to deal with the uploaded file
include('class.upload.php');
// we have three forms on the test page, so we redirect accordingly
// ---------- IMAGE UPLOAD ----------
// we create an instance of the class, giving as argument the PHP object
// corresponding to the file field from the form
// All the uploads are accessible from the PHP object $_FILES
$handle = new Upload($_FILES['my_field']);
// then we check if the file has been uploaded properly
// in its *temporary* location in the server (often, it is /tmp)
if ($handle->uploaded) {
// yes, the file is on the server
// below are some example settings which can be used if the uploaded file is an image.
$handle->image_ratio_y = true;
$handle->image_x = true;
$handle->file_overwrite = true;
$handle->image_convert = 'jpg';
$handle->file_new_name_body = "$id";
// now, we start the upload 'process'. That is, to copy the uploaded file
// from its temporary location to the wanted location
// It could be something like $handle->Process('/home/www/my_uploads/');
$handle->Process('../../photos/normal/');
$handle->Process('../../admin/panel/test/');
$handle->image_resize = true;
$handle->image_ratio_y = true;
$handle->image_x = 80;
$handle->file_overwrite = true;
$handle->image_convert = 'jpg';
$handle->file_new_name_body = "$id";
// now, we start the upload 'process'. That is, to copy the uploaded file
// from its temporary location to the wanted location
// It could be something like $handle->Process('/home/www/my_uploads/');
$handle->Process('../../photos/thumb/');
$handle->Process('../../admin/panel/test2/');
// we check if everything went OK
if ($handle->processed) {
// everything was fine !
// echo '<fieldset>';
//echo ' <legend>file uploaded with success</legend>';
//echo ' <img src="../admin/panel/test2/' . $handle->file_dst_name . '" />';
//echo ' <p>' . $info['mime'] . ' - ' . $info[0] . ' x ' . $info[1] .' - ' . round(filesize($handle->file_dst_pathname)/256)/4 . 'KB</p>';
//echo ' link to the file just uploaded: <a href="../../admin/panel/test2/' . $handle->file_dst_name . '">' . $handle->file_dst_name . '</a><br/>';
//echo '</fieldset>';
} else {
// one error occured
//echo '<fieldset>';
//echo ' <legend>file not uploaded to the wanted location</legend>';
echo ' Error: ' . $handle->error . ''; //echo '</fieldset>';
}
// we now process the image a second time, with some other settings
$handle->image_resize = true;
$handle->image_ratio_y = true;
$handle->image_x = 150;
$handle->image_reflection_height = '25%';
$handle->image_contrast = 50;
$handle->file_overwrite = true;
$handle->image_convert = 'jpg';
$handle->file_new_name_body = "$id";
$handle->Process('../../photos/thumbbig/');
$handle->Process('../../admin/panel/zdjecia/');
// we check if everything went OK
if ($handle->processed) {
// everything was fine !
// echo '<fieldset>';
// echo ' <legend>file uploaded with success</legend>';
//echo ' <img src="../../admin/panel/test2/' . $handle->file_dst_name . '" />';
//echo ' <p>' . $info['mime'] . ' - ' . $info[0] . ' x ' . $info[1] .' - ' . round(filesize($handle->file_dst_pathname)/256)/4 . 'KB</p>';
//echo ' link to the file just uploaded: <a href="test/' . $handle->file_dst_name . '">' . $handle->file_dst_name . '</a><br/>';
// echo '</fieldset>';
} else {
// one error occured
//echo '<fieldset>';
//echo ' <legend>file not uploaded to the wanted location</legend>';
echo ' Error: ' . $handle->error . ''; // echo '</fieldset>';
}
// we delete the temporary files
$handle-> Clean();
} else {
// if we're here, the upload file failed for some reasons
// i.e. the server didn't receive the file
// echo '<fieldset>';
//echo ' <legend>file not uploaded on the server</legend>';
echo ' Error: ' . $handle->error . ''; // echo '</fieldset>';
}}
?>
Ten post edytował agamemnon 5.11.2008, 17:22:37