Aramayan Bulamaz
×
resim upload etiketine ait içerikleri görüntülemektesiniz.
PHP Resim Upload ve Boyutlandırma Sınıfı

Merhabalar, sizlere hazırlamış olduğum resim boyutlandırma ve upload classını göstereceğim. Daha önceki konumda nesne tabanlı programlamadan bahsetmiştim. Şimdiki anlatacağım konu ise nesne tabanlı olarak resim boyutlandırma ve upload üzerine bir classdır
Fazla uzatmadan classı anlatmaya başlayım :)

<?php class ResimIslem{ public function watermark($filigran, $source_file_path, $output_file_path ) { list( $source_width, $source_height, $source_type ) = getimagesize( $source_file_path ); if ( $source_type === NULL ) { return false; } switch ( $source_type ) { case IMAGETYPE_GIF: $source_gd_image = imagecreatefromgif( $source_file_path ); break; case IMAGETYPE_JPEG: $source_gd_image = imagecreatefromjpeg( $source_file_path ); break; case IMAGETYPE_PNG: $source_gd_image = imagecreatefrompng( $source_file_path ); break; default: return false; } $overlay_gd_image = imagecreatefrompng($filigran); $overlay_width = imagesx( $overlay_gd_image ); $overlay_height = imagesy( $overlay_gd_image ); imagecopymerge( $source_gd_image, $overlay_gd_image, $source_width - $overlay_width, $source_height - $overlay_height, 0, 0, $overlay_width, $overlay_height, 60 ); imagejpeg( $source_gd_image, $output_file_path, 100 ); imagedestroy( $source_gd_image ); imagedestroy( $overlay_gd_image ); } public function resim_boyutlandir($resim,$k_resim,$max_en=1920,$max_boy=1200){ // içeriği başlat.. $resimdosyasi= pathinfo($resim); $uzanti=$resimdosyasi["extension"]; ob_star

  • Önceki Sayfa
  • Sonraki Sayfa