PHP code example of sirmekus / igwe

1. Go to this page and download the library: Download sirmekus/igwe library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

sirmekus / igwe example snippets


composer 

return [
      //relative to the root directory
      'directory'=>'uploads',

      //The height resolution for your image file
      'height'=>1280,

      //The width resolution for your image file
      'width'=>1280,

      //Allowed mime types users can upload
      'mime_type'=>[
            "image/jpeg", 
            "image/png", 
            "image/gif", 
            "image/webp",
            //"application/pdf",
            //"video/mp4"
      ],

      //Maximum file size (in bytes) that is accepted in your application
      'max_size'=>5000000,//5mb

      //Maximum no. of files user(s) can upload at once. If you expect multiple files to uploade (like a gallery upload) then you can increase this value
      'max_to_upload'=>1,//

      //Files will be stored in the /uploads/sub_folder directory. If you have a subdirectory where you group your files then you should put it here. If null then uploaded files will be saved directly in the 'uploads' directory
      'sub_folder'=>null,

      //This will be prepended to every new name generated for each file
      'prefix'=>'uploads',

      //Where errors will be logged. Should be relative to the web root too. If it doesn't exist please create it if you want logging enabled
      'log_path'=>null,
]



use App\Igwe\Uploader;

$image = (new Uploader)->upload('image');



use App\Igwe\Uploader;

$image = (new Uploader)->upload('image', true);



use App\Igwe\Uploader;

$image = (new Uploader)->upload(ignore:true);



use App\Igwe\Uploader;

$image = (new Uploader)->remove($image);