Last active
December 29, 2015 15:49
-
-
Save tayfunerbilen/7692915 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
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 = 'erbilen'; | |
// 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 = 'erbilen'; | |
$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/200x100' ); | |
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; | |
} | |
} | |
} | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment