���� JFIF �� � ( %"1"%)+...383,7(-.-
![]() Server : Apache/2.4.6 (CentOS) OpenSSL/1.0.2k-fips PHP/7.4.20 System : Linux st2.domain.com 3.10.0-1127.10.1.el7.x86_64 #1 SMP Wed Jun 3 14:28:03 UTC 2020 x86_64 User : apache ( 48) PHP Version : 7.4.20 Disable Function : NONE Directory : /var/www/html/adimi/application/libraries/ |
<?php defined('BASEPATH') OR exit('No direct script access allowed'); class Fileupload { // To load this model // $this->fileupload->do_upload($upload_path = 'assets/images/profile/', $field_name = 'userfile'); function do_upload($upload_path = null, $field_name = null) { if (empty($_FILES[$field_name]['name'])) { return null; } else { //----------------------------- $ci =& get_instance(); $ci->load->helper('url'); //folder upload $file_path = $upload_path . date('Y-m-d') . "/"; if (!is_dir($file_path)) mkdir($file_path, 0755,true); //ends of folder upload //set config $config = [ 'upload_path' => $file_path, 'allowed_types' => 'gif|jpg|png|jpeg|ico', 'max_filename' => 5, 'overwrite' => false, 'maintain_ratio' => true, 'encrypt_name' => false, 'remove_spaces' => true, 'file_ext_tolower' => true ]; $ci->load->library('upload', $config); if (!$ci->upload->do_upload($field_name)) { return false; } else { $file = $ci->upload->data(); return $file_path.$file['file_name']; } } } public function do_resize($file_path = null, $width = null, $height = null) { $ci =& get_instance(); $ci->load->library('image_lib'); $config = [ 'image_library' => 'gd2', 'source_image' => $file_path, 'create_thumb' => false, 'maintain_ratio' => false, 'width' => $width, 'height' => $height, ]; $ci->image_lib->initialize($config); $ci->image_lib->resize(); } }