国产av日韩一区二区三区精品,成人性爱视频在线观看,国产,欧美,日韩,一区,www.成色av久久成人,2222eeee成人天堂

ホームページ バックエンド開発 PHPチュートリアル php バージョンの寫真は、ソースコードを取得した日付に従ってソートおよび整理されます。

php バージョンの寫真は、ソースコードを取得した日付に従ってソートおよび整理されます。

Jun 13, 2016 am 11:58 AM
file log message this

php バージョンの寫真は、撮影日によってソートされ、ソース コードに分類されます

  • php バージョンの寫真は、撮影日によってソース コードに分類されます
  • 年月ごとに分類
  • 重複ファイルをスキップ
  • 動畫ファイルと畫像以外のファイルは個別に分類
  • 日付が読めない寫真は個別に分類

<?php/*	2014/4/1 17:27 klggg 照片按拍照日期整理	依賴 php_exif 擴展	 win下打開擴展	   extension=php_exif.dll      ; 注,這段必須放在 extension=php_mbstring.dll 下面*/date_default_timezone_set(&#39;PRC&#39;);//require dirname(__FILE__).&#39;/vendor/autoload.php&#39;;$curr_dir_path = dirname(__FILE__); //要處理的照片來源路徑  * 需要針對自己的情況做下修改$photo_source_path = &#39;K:/家庭照片&#39;;$config =  array(	&#39;fileExtension&#39; => array(		//圖片的擴展名		'pic' => array('jpg','png','gif','bmp'),		//視頻的擴展名		'movies' => array('mov','3gp','mp4')	),	'path'  => array(		//所有新目錄產(chǎn)生的根目錄,* 注意修改成自己的路徑		'root' => $curr_dir_path.'/pic_new_month'		));$config['path']['pic'] = $config['path']['root'].'/pic';	//照片移到哪個目錄$config['path']['movies'] = $config['path']['root'].'/movies';	//視頻移到哪個目錄$config['path']['unkown'] = $config['path']['root'].'/unkown';	//非照片文件移到哪個目錄//初始化log相關(guān)$log_path = $config['path']['root'].'/log/';if(!is_dir($log_path))        mkdir($log_path, 0755, true); $log_file = $log_path.'/'.date('Y-m-d').'.log';$log_category = 'PhotoMove';$log =null;$log_config = array('locking' => 1,'buffering' => true, 'lineFormat' =>'%1$s %2$s [%3$s] %8$s->%7$s  %6$s  %4$s');if(!defined('PEAR_LOG_DEBUG')){	define('PEAR_LOG_EMERG',    0);     /* System is unusable */	define('PEAR_LOG_ALERT',    1);     /* Immediate action required */	define('PEAR_LOG_CRIT',     2);     /* Critical conditions */	define('PEAR_LOG_ERR',      3);     /* Error conditions */	define('PEAR_LOG_WARNING',  4);     /* Warning conditions */	define('PEAR_LOG_NOTICE',   5);     /* Normal but significant */	define('PEAR_LOG_INFO',     6);     /* Informational */	define('PEAR_LOG_DEBUG',    7);     /* Debug-level messages */	$log = DefaultLog::singleton("file" 			, $log_file,$log_category			, $log_config			,PEAR_LOG_DEBUG);}else{	$log = Log::singleton("file" 			, $log_file,$log_category			, $log_config			,PEAR_LOG_DEBUG);}$PhotoMove_obj=  new PhotoMove($config,$log);$PhotoMove_obj->run($photo_source_path);echo "done";class PhotoMove {	private $mRootPath= './tmp';	private $logger= null;	private $mConfig= Array();	public function  __construct($config,$logger) {		$this->mConfig = $config;		$this->mRootPath = $config['path']['root'];		foreach($config['path'] as $tmp_path)		{			if(!is_dir($tmp_path))				mkdir($tmp_path, 0755, true); 		}		$this->logger = $logger;	}	/**	 * 運行腳本入口	 * @param string $srcPath 照片來源目錄	 *	 */	public function  run($srcPath) {		$it = new RecursiveDirectoryIterator($srcPath);		foreach (new RecursiveIteratorIterator($it, 2) as $file_path) {			if ($file_path->isDir()) 				continue;			$file_path_name = $file_path->__toString();			$this->logger->info('file_path_name: '.$file_path_name);			$file_info =	pathinfo($file_path_name);			if('thumbs.db' == strtolower($file_info['basename']))				continue;			if(!isset($file_info['extension']))			{				$this->logger->notice('no extension : '.$file_path_name);				$file_info['extension'] = '';			}			$file_info['extension'] = strtolower($file_info['extension']);			//找到圖片			if(in_array($file_info['extension'],$this->mConfig['fileExtension']['pic']))			{				$tmp_timestamp = $this->getDateTimeOriginal($file_path_name);				//移到新目錄				$new_dir = $this->mConfig['path']['pic'].'/'.date('Y-m',$tmp_timestamp);				if(!is_dir($new_dir))					mkdir($new_dir, 0755, true); 				$tmp_new_file_path = $new_dir.'/'.$file_info['basename'];				$this->move($file_path_name,$tmp_new_file_path);			}			else if(in_array($file_info['extension'],$this->mConfig['fileExtension']['movies']))			{				$tmp_new_file_path = $this->mConfig['path']['movies'].'/'.$file_info['basename'];				$this->move($file_path_name,$tmp_new_file_path);			}			else			{				//非圖片文件處理				$this->logger->notice('not image file : '.$file_path_name);				$tmp_new_file_path = $this->mConfig['path']['unkown'].'/'.$file_info['basename'];				$this->move($file_path_name, $tmp_new_file_path);			}		}	}	/**	 * 取拍照日期	 * @param string $filePathName 照片完整路徑	 * @param string $defaultDateTime 取不到拍照時間時的默認時間	 * @return  int 返回時間戳	 *	 */	public function  getDateTimeOriginal($filePathName,$defaultDateTime='1970:01:01 01:01:01') {		$exif = exif_read_data($filePathName, 0, true);		$date_time_original = $defaultDateTime;		if(empty($exif['EXIF']) || empty($exif['EXIF']['DateTimeOriginal']))		{			$this->logger->warning("empty DateTimeOriginal");		}		else			$date_time_original = $exif['EXIF']['DateTimeOriginal']; 	   //string(19) "2011:03:13 10:23:09"		$this->logger->info('DateTimeOriginal: '.$date_time_original);		$tmp_timestamp  = strtotime($date_time_original);		return $tmp_timestamp;	}	/**	 * 移動文件	 * @param string $oldFilePath 原文件完整路徑	 * @param string $newFilePath 目標文件完整路徑	 * @return  bool	 *	 */	public function  move($oldFilePath,$newFilePath) {		//針對已存在的文件		if(file_exists($newFilePath))		{			$this->logger->notice("file_exists ".$newFilePath);			return false;		}		$result = false;//		if($result == copy($oldFilePath, $newFilePath))		if($result == rename($oldFilePath, $newFilePath))			$this->logger->err("rename false, to  ".$newFilePath );		else			$this->logger->info('[ok] move  '.$oldFilePath.' to '.$newFilePath);		return $result;	}}class DefaultLog {    var $_formatMap = array('%{timestamp}'  => '%1$s',                            '%{ident}'      => '%2$s',                            '%{priority}'   => '%3$s',                            '%{message}'    => '%4$s',                            '%{file}'       => '%5$s',                            '%{line}'       => '%6$s',                            '%{function}'   => '%7$s',                            '%{class}'      => '%8$s',                            '%\{'           => '%%{');    var $_lineFormat = '%1$s %2$s [%3$s] %4$s';    var $_timeFormat = '%b %d %H:%M:%S';    var $_eol = "\n";    var $_dirmode = 0755;	private $_filename= './tmp';    var $_backtrace_depth = 0;	public function  __construct($name, $ident, $conf, $level='') {        $this->_filename = $name;        $this->_ident = $ident;        if (!empty($conf['lineFormat'])) {            $this->_lineFormat = str_replace(array_keys($this->_formatMap),                                             array_values($this->_formatMap),                                             $conf['lineFormat']);        }				if (!is_dir(dirname($this->_filename))) {			mkdir(dirname($this->_filename, $this->_dirmode,true));		}	}    public static function singleton($handler, $name = '', $ident = '',                                     $conf = array(), $level = PEAR_LOG_DEBUG)    {        static $instances;        if (!isset($instances)) $instances = array();        $signature = serialize(array($handler, $name, $ident, $conf, $level));        if (!isset($instances[$signature])) {			 $instances[$signature] =  new self($name, $ident, $conf, $level);        }        return $instances[$signature];    }    function log($message, $priority = null)    {		/* Extract the string representation of the message. */        $message = $this->_extractMessage($message);        /* Build the string containing the complete log line. */        $line = $this->_format($this->_lineFormat,                               strftime($this->_timeFormat),                               $priority, $message) . $this->_eol;		error_log($line, 3,$this->_filename);echo $line;    }    function emerg($message)    {        return $this->log($message, PEAR_LOG_EMERG);    }    function alert($message)    {        return $this->log($message, PEAR_LOG_ALERT);    }    function crit($message)    {        return $this->log($message, PEAR_LOG_CRIT);    }    function err($message)    {        return $this->log($message, PEAR_LOG_ERR);    }    function warning($message)    {        return $this->log($message, PEAR_LOG_WARNING);    }    function notice($message)    {        return $this->log($message, PEAR_LOG_NOTICE);    }    function info($message)    {        return $this->log($message, PEAR_LOG_INFO);    }    function debug($message)    {        return $this->log($message, PEAR_LOG_DEBUG);    }    function _extractMessage($message)    {        /*         * If we've been given an object, attempt to extract the message using         * a known method.  If we can't find such a method, default to the         * "human-readable" version of the object.         *         * We also use the human-readable format for arrays.         */        if (is_object($message)) {            if (method_exists($message, 'getmessage')) {                $message = $message->getMessage();            } else if (method_exists($message, 'tostring')) {                $message = $message->toString();            } else if (method_exists($message, '__tostring')) {                $message = (string)$message;            } else {                $message = var_export($message, true);            }        } else if (is_array($message)) {            if (isset($message['message'])) {                if (is_scalar($message['message'])) {                    $message = $message['message'];                } else {                    $message = var_export($message['message'], true);                }            } else {                $message = var_export($message, true);            }        } else if (is_bool($message) || $message === NULL) {            $message = var_export($message, true);        }        /* Otherwise, we assume the message is a string. */        return $message;    }    function _format($format, $timestamp, $priority, $message)    {        /*         * If the format string references any of the backtrace-driven         * variables (%5 %6,%7,%8), generate the backtrace and fetch them.         */        if (preg_match('/%[5678]/', $format)) {            /* Plus 2 to account for our internal function calls. */            $d = $this->_backtrace_depth + 2;            list($file, $line, $func, $class) = $this->_getBacktraceVars($d);        }        /*         * Build the formatted string.  We use the sprintf() function's         * "argument swapping" capability to dynamically select and position         * the variables which will ultimately appear in the log string.         */        return sprintf($format,                       $timestamp,                       $this->_ident,                       $this->priorityToString($priority),                       $message,                       isset($file) ? $file : '',                       isset($line) ? $line : '',                       isset($func) ? $func : '',                       isset($class) ? $class : '');    }    function priorityToString($priority)    {        $levels = array(            PEAR_LOG_EMERG   => 'emergency',            PEAR_LOG_ALERT   => 'alert',            PEAR_LOG_CRIT    => 'critical',            PEAR_LOG_ERR     => 'error',            PEAR_LOG_WARNING => 'warning',            PEAR_LOG_NOTICE  => 'notice',            PEAR_LOG_INFO    => 'info',            PEAR_LOG_DEBUG   => 'debug'        );        return $levels[$priority];    }    function _getBacktraceVars($depth)    {        /* Start by generating a backtrace from the current call (here). */        $bt = debug_backtrace();        /* Store some handy shortcuts to our previous frames. */        $bt0 = isset($bt[$depth]) ? $bt[$depth] : null;        $bt1 = isset($bt[$depth + 1]) ? $bt[$depth + 1] : null;        /*         * If we were ultimately invoked by the composite handler, we need to         * increase our depth one additional level to compensate.         */        $class = isset($bt1['class']) ? $bt1['class'] : null;        if ($class !== null && strcasecmp($class, 'Log_composite') == 0) {            $depth++;            $bt0 = isset($bt[$depth]) ? $bt[$depth] : null;            $bt1 = isset($bt[$depth + 1]) ? $bt[$depth + 1] : null;            $class = isset($bt1['class']) ? $bt1['class'] : null;        }        /*         * We're interested in the frame which invoked the log() function, so         * we need to walk back some number of frames into the backtrace.  The         * $depth parameter tells us where to start looking.   We go one step         * further back to find the name of the encapsulating function from         * which log() was called.         */        $file = isset($bt0) ? $bt0['file'] : null;        $line = isset($bt0) ? $bt0['line'] : 0;        $func = isset($bt1) ? $bt1['function'] : null;        /*         * However, if log() was called from one of our "shortcut" functions,         * we're going to need to go back an additional step.         */        if (in_array($func, array('emerg', 'alert', 'crit', 'err', 'warning',                                  'notice', 'info', 'debug'))) {            $bt2 = isset($bt[$depth + 2]) ? $bt[$depth + 2] : null;            $file = is_array($bt1) ? $bt1['file'] : null;            $line = is_array($bt1) ? $bt1['line'] : 0;            $func = is_array($bt2) ? $bt2['function'] : null;            $class = isset($bt2['class']) ? $bt2['class'] : null;        }        /*         * If we couldn't extract a function name (perhaps because we were         * executed from the "main" context), provide a default value.         */        if ($func === null) {            $func = '(none)';        }        /* Return a 4-tuple containing (file, line, function, class). */        return array($file, $line, $func, $class);    }	}


このウェブサイトの聲明
この記事の內(nèi)容はネチズンが自主的に寄稿したものであり、著作権は原著者に帰屬します。このサイトは、それに相當する法的責(zé)任を負いません。盜作または侵害の疑いのあるコンテンツを見つけた場合は、admin@php.cn までご連絡(luò)ください。

ホットAIツール

Undress AI Tool

Undress AI Tool

脫衣畫像を無料で

Undresser.AI Undress

Undresser.AI Undress

リアルなヌード寫真を作成する AI 搭載アプリ

AI Clothes Remover

AI Clothes Remover

寫真から衣服を削除するオンライン AI ツール。

Clothoff.io

Clothoff.io

AI衣類リムーバー

Video Face Swap

Video Face Swap

完全無料の AI 顔交換ツールを使用して、あらゆるビデオの顔を簡単に交換できます。

ホットツール

メモ帳++7.3.1

メモ帳++7.3.1

使いやすく無料のコードエディター

SublimeText3 中國語版

SublimeText3 中國語版

中國語版、とても使いやすい

ゼンドスタジオ 13.0.1

ゼンドスタジオ 13.0.1

強力な PHP 統(tǒng)合開発環(huán)境

ドリームウィーバー CS6

ドリームウィーバー CS6

ビジュアル Web 開発ツール

SublimeText3 Mac版

SublimeText3 Mac版

神レベルのコード編集ソフト(SublimeText3)

PHP BLOBをファイルに変換する方法 PHP BLOBをファイルに変換する方法 Mar 16, 2023 am 10:47 AM

PHP BLOB をファイルに変換する方法: 1. PHP サンプル ファイルを作成します; 2. 「function blobToFile(blob) {return new File([blob], 'screenshot.png', { type: 'image/jpeg' })」を通じて} 」メソッドを使用して、Blob をファイルに変換できます。

JavaのFile.length()関數(shù)を使用してファイルのサイズを取得します。 JavaのFile.length()関數(shù)を使用してファイルのサイズを取得します。 Jul 24, 2023 am 08:36 AM

ファイルのサイズを取得するには、Java の File.length() 関數(shù)を使用します。ファイル操作を扱うとき、ファイル サイズは非常に一般的な要件です。Java では、ファイルのサイズを取得するための非常に便利な方法、つまり length( ) File クラスのメソッド。この記事では、このメソッドを使用してファイルのサイズを取得する方法と、対応するコード例を紹介します。まず、サイズを取得したいファイルを表す File オブジェクトを作成する必要があります。 File オブジェクトを作成する方法は次のとおりです: Filef

紅夢ネイティブアプリケーションのランダムな詩 紅夢ネイティブアプリケーションのランダムな詩 Feb 19, 2024 pm 01:36 PM

オープン ソースの詳細については、次のサイトを參照してください。 51CTO Honmeng 開発者コミュニティ https://ost.51cto.com 実行環(huán)境 DAYU200:4.0.10.16SDK: 4.0.10.15IDE: 4.0.600 1. アプリケーションを作成するには、[ファイル] をクリックします。 >新しいファイル ->プロジェクトの作成。テンプレートを選択します: [OpenHarmony] EmptyAbility: プロジェクト名 shici、アプリケーション パッケージ名 com.nut.shici、およびアプリケーションの保存場所 XXX (中國語、特殊文字、スペースは含まれません) を入力します。 CompileSDK10、モデル: ステージ。デバイス

JavaのFile.renameTo()関數(shù)を使用してファイルの名前を変更する JavaのFile.renameTo()関數(shù)を使用してファイルの名前を変更する Jul 25, 2023 pm 03:45 PM

Java の File.renameTo() 関數(shù)を使用してファイルの名前を変更する Java プログラミングでは、ファイルの名前を変更する必要がよくあります。 Java には、ファイル操作を処理するための File クラスが用意されており、その renameTo() 関數(shù)でファイルの名前を簡単に変更できます。この記事では、Java の File.renameTo() 関數(shù)を使用してファイルの名前を変更する方法と、対応するコード例を紹介します。 File.renameTo() 関數(shù)は、File クラスのメソッドです。

JavaのFile.getParent()関數(shù)を使用してファイルの親パスを取得します。 JavaのFile.getParent()関數(shù)を使用してファイルの親パスを取得します。 Jul 24, 2023 pm 01:40 PM

ファイルの親パスを取得するには、Java の File.getParent() 関數(shù)を使用します Java プログラミングでは、ファイルやフォルダーを操作する必要がよくあります。場合によっては、ファイルの親パス、つまりファイルが存在するフォルダーのパスを取得する必要があることがあります。 Java の File クラスには、ファイルまたはフォルダーの親パスを取得する getParent() メソッドが用意されています。 File クラスは、ファイルとフォルダーを Java で抽象表現(xiàn)したもので、ファイルとフォルダーを操作するための一連のメソッドを提供します。その中で、手に入れてください

JavaのFile.getParentFile()関數(shù)を使用してファイルの親ディレクトリを取得します。 JavaのFile.getParentFile()関數(shù)を使用してファイルの親ディレクトリを取得します。 Jul 27, 2023 am 11:45 AM

ファイルの親ディレクトリを取得するには、Java の File.getParentFile() 関數(shù)を使用します Java プログラミングでは、ファイルやフォルダーを操作する必要がよくあります。ファイルの親ディレクトリを取得する必要がある場合は、Java が提供する File.getParentFile() 関數(shù)を使用できます。この記事では、この関數(shù)の使用方法とコード例を説明します。 Java の File クラスは、ファイルやフォルダーを操作するために使用される主なクラスです。ファイルのプロパティを取得および操作するための多くのメソッドを提供します

vue3 で element-plus を使用してメッセージを呼び出す方法 vue3 で element-plus を使用してメッセージを呼び出す方法 May 17, 2023 pm 03:52 PM

vue3 は、Element-plus を使用してメッセージ環(huán)境を呼び出します: vue3+typescript+element-plus1。Element のグローバルな導(dǎo)入後、Element は app.config.globalProperties にグローバル メソッド $message を追加したため、mounted(){( thisasany) を optionsAPI で直接 $message.success("this.$message");}2. CompositionAPI では、setup メソッドは 2 つの変數(shù) props と props を渡します。

Java で File.delete() メソッドを使用してファイルまたはディレクトリを削除するにはどうすればよいですか? Java で File.delete() メソッドを使用してファイルまたはディレクトリを削除するにはどうすればよいですか? Nov 18, 2023 am 08:02 AM

Java で File.delete() メソッドを使用してファイルまたはディレクトリを削除するにはどうすればよいですか?概要: Java では、File クラスの delete() メソッドを使用してファイルまたはディレクトリを削除できます。このメソッドは、指定されたファイルまたはディレクトリを削除するために使用されます。ただし、この方法では、他のプログラムによって開かれていない空のディレクトリまたはファイルしか削除できないことに注意してください。ファイルまたはディレクトリの削除が失敗した場合は、IOException をキャッチすることで特定の理由を見つけることができます。ステップ 1: 関連パッケージをインポートする まず、

See all articles