Verot ile dosya yüklerken 2 adet resim yüklemeyi düşünüyorum.
1. si dosyanın thumb hali 2. si ise orjinal hali ama bir türlü olmadı.
hangisini önce alırsam onu yapıyor sizce ne yapmalıyım?
<?php
//include '../config.php';
include_once('class.upload.php');
$handle = new upload($_FILES['image_field']);
if ($handle->uploaded) {
$handle->process('../galeri2/');
if ($handle->processed) {
echo 'image resized';
$handle->clean();
} else {
echo 'error : ' . $handle->error;
}
}
unset($handle);
$handle = new upload($_FILES['image_field']);
if ($handle->uploaded) {
$handle->file_new_name_body = 'image_resized';
$handle->image_resize = true;
$handle->image_x = 100;
$handle->image_ratio_y = true;
$handle->process('../galeri2/thumb/');
if ($handle->processed) {
echo 'image resized';
$handle->clean();
} else {
echo 'error : ' . $handle->error;
}
}
?> <form method="post" action="" enctype="multipart/form-data">
<input type="file" name="resim[]" multiple />
<input type="submit" name="submit" value="Yükle" />
</form>
$resimler = array();
foreach ($_FILES['resim'] as $k => $l) {
foreach ($l as $i => $v) {
if (!array_key_exists($i, $resimler))
$resimler[$i] = array();
$resimler[$i][$k] = $v;
}
}
foreach ($resimler as $resim){
$handle = new Upload($resim);
if ($handle->uploaded) {
/* Resmi Yeniden Adlandır */
$handle->file_new_name_body = substr(base64_encode(uniqid(true)), 0, 20);
/* Resmi Yeniden Boyutlandır */
$handle->image_resize = true;
$handle->image_x = 150;
$handle->image_ratio_y = true;
/* Resim Yükleme İzni */
$handle->allowed = array('image/*');
/* Resmi İşle */
$handle->Process(realpath("../")."/upload/resim/");
if ($handle->processed) {
echo 'ok\n';
} else {
echo $handle->error;
}
$handle-> Clean();
} else {
echo $handle->error;
}
}