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;
}
}
?> require 'class.upload.php';
if ( isset( $_POST[ 'submit' ] ) ) {
$image = new Upload( $_FILES[ 'image' ] );
if ( $image->uploaded ) {
// resmi yeniden adlandıralım
$image->file_new_name_body = 'resimadi';
// resmi jpg formatına convert edelim
$image->image_convert = 'jpg';
// upload klasörüne değişiklik yapmadan kayıt et
$image->Process( 'upload/' );
/**
* Resmi Farklı Boyutta Kayıt Et
*/
// yeniden farklı boyutta kayıt et (200x100)
$image->file_new_name_body = 'resimadi';
$image->image_convert = 'jpg';
$image->image_resize = true;
$image->image_ratio_crop = true;
$image->image_x = 200;
$image->image_y = 100;
// sadece resim formatları yüklensin
$image->allowed = array ( 'image/*' );
$image->Process( 'upload/kucuk' );
if ( $image->processed ) {
print 'resim yükleme işlemi başarılı!<hr />';
print '<img src="' . $image->file_dst_path . $image->file_dst_name . '" alt="" />';
} else {
print 'Bir sorun oluştu: ' . $image->error;
}
}
}
?>