Skip to content

Instantly share code, notes, and snippets.

@tayfunerbilen
Last active December 29, 2015 15:49
Show Gist options
  • Save tayfunerbilen/7692915 to your computer and use it in GitHub Desktop.
Save tayfunerbilen/7692915 to your computer and use it in GitHub Desktop.
<?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