PHP code example of wulacms / media

1. Go to this page and download the library: Download wulacms/media 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/ */

    

wulacms / media example snippets



class MyUploader implements IUploader {
   /**
   	 * 上传文件.
   	 *
   	 * @param string $filepath 要上传的文件路径.
   	 * @param string $path     存储路径,如果是null则自系统自动生成.
   	 *
   	 * @return array array(url,name,path,width,height,size)
   	 *         <code>
   	 *         <ul>
   	 *         <li>url-相对URL路径</li>
   	 *         <li>name-文件名</li>
   	 *         <li>path-存储路径</li>
   	 *         </ul>
   	 *         </code>
   	 */
   	public function save($filepath, $path = null){
   	    //代码
   	}
   
   	/**
   	 * 返回错误信息.
   	 */
   	public function get_last_error(){
   	    //代码
   	}
   
   	/**
   	 * delete the file.
   	 *
   	 * @param string $file
   	 *            要删除的文件路径.
   	 *
   	 * @return boolean 成功返回true,反之返回false.
   	 */
   	public function delete($file){
   	   //代码
   	}
   
   	/**
   	 * 生成缩略图.
   	 *
   	 * @param string $file
   	 * @param int    $w
   	 * @param int    $h
   	 *
   	 * @return mixed
   	 */
   	public function thumbnail($file, $w, $h){
   	    //代码
   	}
   
   	/**
   	 * close connection if there is.
   	 */
   	public function close(){
   	    //代码
   	}
}

bind('media\regUploaders',function( $ups ){ 
    $ups['my']= new MyUploader();
    return $ups; 
});