?
Path : /home/admin/public_html/old/membershop/class/sources/ |
Current File : /home/admin/public_html/old/membershop/class/sources/class.upload.php.html |
<?xml version="1.0" encoding="iso-8859-1"?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <!-- template designed by Marco Von Ballmoos --> <title>File Source for class.upload.php</title> <link rel="stylesheet" href="phpdoc/stylesheet.css" /> </head> <body> <h1>Source for file class.upload.php 0.29 </h1> <p>Documentation is available at <a href="class.upload.html">class.upload.php</a></p> <p>Webpage is available at <a href="http://www.verot.net/php_class_upload.htm">http://www.verot.net/php_class_upload.htm</a></p> <div class="src-code"> <div class="src-code"><ol><li><div class="src-line"><a name="a1"></a><span class="src-php"><?php</span></div></li> <li><div class="src-line"><a name="a2"></a><span class="src-comm">// +------------------------------------------------------------------------+</span></div></li> <li><div class="src-line"><a name="a3"></a><span class="src-comm">// | class.upload.php |</span></div></li> <li><div class="src-line"><a name="a4"></a><span class="src-comm">// +------------------------------------------------------------------------+</span></div></li> <li><div class="src-line"><a name="a5"></a><span class="src-comm">// | Copyright (c) Colin Verot 2003-2009. All rights reserved. |</span></div></li> <li><div class="src-line"><a name="a6"></a><span class="src-comm">// | Version 0.29 |</span></div></li> <li><div class="src-line"><a name="a7"></a><span class="src-comm">// | Last modified 03/02/2010 |</span></div></li> <li><div class="src-line"><a name="a8"></a><span class="src-comm">// | Email colin@verot.net |</span></div></li> <li><div class="src-line"><a name="a9"></a><span class="src-comm">// | Web http://www.verot.net |</span></div></li> <li><div class="src-line"><a name="a10"></a><span class="src-comm">// +------------------------------------------------------------------------+</span></div></li> <li><div class="src-line"><a name="a11"></a><span class="src-comm">// | This program is free software; you can redistribute it and/or modify |</span></div></li> <li><div class="src-line"><a name="a12"></a><span class="src-comm">// | it under the terms of the GNU General Public License version 2 as |</span></div></li> <li><div class="src-line"><a name="a13"></a><span class="src-comm">// | published by the Free Software Foundation. |</span></div></li> <li><div class="src-line"><a name="a14"></a><span class="src-comm">// | |</span></div></li> <li><div class="src-line"><a name="a15"></a><span class="src-comm">// | This program is distributed in the hope that it will be useful, |</span></div></li> <li><div class="src-line"><a name="a16"></a><span class="src-comm">// | but WITHOUT ANY WARRANTY; without even the implied warranty of |</span></div></li> <li><div class="src-line"><a name="a17"></a><span class="src-comm">// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |</span></div></li> <li><div class="src-line"><a name="a18"></a><span class="src-comm">// | GNU General Public License for more details. |</span></div></li> <li><div class="src-line"><a name="a19"></a><span class="src-comm">// | |</span></div></li> <li><div class="src-line"><a name="a20"></a><span class="src-comm">// | You should have received a copy of the GNU General Public License |</span></div></li> <li><div class="src-line"><a name="a21"></a><span class="src-comm">// | along with this program; if not, write to the |</span></div></li> <li><div class="src-line"><a name="a22"></a><span class="src-comm">// | Free Software Foundation, Inc., 59 Temple Place, Suite 330, |</span></div></li> <li><div class="src-line"><a name="a23"></a><span class="src-comm">// | Boston, MA 02111-1307 USA |</span></div></li> <li><div class="src-line"><a name="a24"></a><span class="src-comm">// | |</span></div></li> <li><div class="src-line"><a name="a25"></a><span class="src-comm">// | Please give credit on sites that use class.upload and submit changes |</span></div></li> <li><div class="src-line"><a name="a26"></a><span class="src-comm">// | of the script so other people can use them as well. |</span></div></li> <li><div class="src-line"><a name="a27"></a><span class="src-comm">// | This script is free to use, don't abuse. |</span></div></li> <li><div class="src-line"><a name="a28"></a><span class="src-comm">// +------------------------------------------------------------------------+</span></div></li> <li><div class="src-line"><a name="a29"></a><span class="src-comm">//</span></div></li> <li><div class="src-line"><a name="a30"></a> </div></li> <li><div class="src-line"><a name="a31"></a><span class="src-doc">/**</span></div></li> <li><div class="src-line"><a name="a32"></a><span class="src-doc"> * Class upload</span></div></li> <li><div class="src-line"><a name="a33"></a><span class="src-doc"> *</span></div></li> <li><div class="src-line"><a name="a34"></a><span class="src-doc"> * </span><span class="src-doc-coretag">@version</span><span class="src-doc"> 0.29</span></div></li> <li><div class="src-line"><a name="a35"></a><span class="src-doc"> * </span><span class="src-doc-coretag">@author</span><span class="src-doc"> Colin Verot <colin@verot.net></span></div></li> <li><div class="src-line"><a name="a36"></a><span class="src-doc"> * </span><span class="src-doc-coretag">@license</span><span class="src-doc"> http://opensource.org/licenses/gpl-license.php GNU Public License</span></div></li> <li><div class="src-line"><a name="a37"></a><span class="src-doc"> * </span><span class="src-doc-coretag">@copyright</span><span class="src-doc"> Colin Verot</span></div></li> <li><div class="src-line"><a name="a38"></a><span class="src-doc"> * </span><span class="src-doc-coretag">@package</span><span class="src-doc"> cmf</span></div></li> <li><div class="src-line"><a name="a39"></a><span class="src-doc"> * </span><span class="src-doc-coretag">@subpackage</span><span class="src-doc"> external</span></div></li> <li><div class="src-line"><a name="a40"></a><span class="src-doc"> */</span></div></li> <li><div class="src-line"><a name="a41"></a> </div></li> <li><div class="src-line"><a name="a42"></a><span class="src-doc">/**</span></div></li> <li><div class="src-line"><a name="a43"></a><span class="src-doc"> * Class upload</span></div></li> <li><div class="src-line"><a name="a44"></a><span class="src-doc"> *</span></div></li> <li><div class="src-line"><a name="a45"></a><span class="src-doc"> * <b>What does it do?</b></span></div></li> <li><div class="src-line"><a name="a46"></a><span class="src-doc"> *</span></div></li> <li><div class="src-line"><a name="a47"></a><span class="src-doc"> * It manages file uploads for you. In short, it manages the uploaded file,</span></div></li> <li><div class="src-line"><a name="a48"></a><span class="src-doc"> * and allows you to do whatever you want with the file, especially if it</span></div></li> <li><div class="src-line"><a name="a49"></a><span class="src-doc"> * is an image, and as many times as you want.</span></div></li> <li><div class="src-line"><a name="a50"></a><span class="src-doc"> *</span></div></li> <li><div class="src-line"><a name="a51"></a><span class="src-doc"> * It is the ideal class to quickly integrate file upload in your site.</span></div></li> <li><div class="src-line"><a name="a52"></a><span class="src-doc"> * If the file is an image, you can convert, resize, crop it in many ways.</span></div></li> <li><div class="src-line"><a name="a53"></a><span class="src-doc"> * You can also apply filters, add borders, text, watermarks, etc...</span></div></li> <li><div class="src-line"><a name="a54"></a><span class="src-doc"> * That's all you need for a gallery script for instance. Supported formats</span></div></li> <li><div class="src-line"><a name="a55"></a><span class="src-doc"> * are PNG, JPG, GIF and BMP.</span></div></li> <li><div class="src-line"><a name="a56"></a><span class="src-doc"> *</span></div></li> <li><div class="src-line"><a name="a57"></a><span class="src-doc"> * You can also use the class to work on local files, which is especially</span></div></li> <li><div class="src-line"><a name="a58"></a><span class="src-doc"> * useful to use the image manipulation features. The class also supports</span></div></li> <li><div class="src-line"><a name="a59"></a><span class="src-doc"> * Flash uploaders.</span></div></li> <li><div class="src-line"><a name="a60"></a><span class="src-doc"> *</span></div></li> <li><div class="src-line"><a name="a61"></a><span class="src-doc"> * The class works with PHP 4 and 5, and its error messages can</span></div></li> <li><div class="src-line"><a name="a62"></a><span class="src-doc"> * be localized at will.</span></div></li> <li><div class="src-line"><a name="a63"></a><span class="src-doc"> *</span></div></li> <li><div class="src-line"><a name="a64"></a><span class="src-doc"> * <b>How does it work?</b></span></div></li> <li><div class="src-line"><a name="a65"></a><span class="src-doc"> *</span></div></li> <li><div class="src-line"><a name="a66"></a><span class="src-doc"> * You instanciate the class with the $_FILES['my_field'] array</span></div></li> <li><div class="src-line"><a name="a67"></a><span class="src-doc"> * where my_field is the field name from your upload form.</span></div></li> <li><div class="src-line"><a name="a68"></a><span class="src-doc"> * The class will check if the original file has been uploaded</span></div></li> <li><div class="src-line"><a name="a69"></a><span class="src-doc"> * to its temporary location (alternatively, you can instanciate</span></div></li> <li><div class="src-line"><a name="a70"></a><span class="src-doc"> * the class with a local filename).</span></div></li> <li><div class="src-line"><a name="a71"></a><span class="src-doc"> *</span></div></li> <li><div class="src-line"><a name="a72"></a><span class="src-doc"> * You can then set a number of processing variables to act on the file.</span></div></li> <li><div class="src-line"><a name="a73"></a><span class="src-doc"> * For instance, you can rename the file, and if it is an image,</span></div></li> <li><div class="src-line"><a name="a74"></a><span class="src-doc"> * convert and resize it in many ways.</span></div></li> <li><div class="src-line"><a name="a75"></a><span class="src-doc"> * You can also set what will the class do if the file already exists.</span></div></li> <li><div class="src-line"><a name="a76"></a><span class="src-doc"> *</span></div></li> <li><div class="src-line"><a name="a77"></a><span class="src-doc"> * Then you call the function </span><span class="src-doc-inlinetag">{@link process}</span><span class="src-doc"> to actually perform the actions</span></div></li> <li><div class="src-line"><a name="a78"></a><span class="src-doc"> * according to the processing parameters you set above.</span></div></li> <li><div class="src-line"><a name="a79"></a><span class="src-doc"> * It will create new instances of the original file,</span></div></li> <li><div class="src-line"><a name="a80"></a><span class="src-doc"> * so the original file remains the same between each process.</span></div></li> <li><div class="src-line"><a name="a81"></a><span class="src-doc"> * The file will be manipulated, and copied to the given location.</span></div></li> <li><div class="src-line"><a name="a82"></a><span class="src-doc"> * The processing variables will be reset once it is done.</span></div></li> <li><div class="src-line"><a name="a83"></a><span class="src-doc"> *</span></div></li> <li><div class="src-line"><a name="a84"></a><span class="src-doc"> * You can repeat setting up a new set of processing variables,</span></div></li> <li><div class="src-line"><a name="a85"></a><span class="src-doc"> * and calling </span><span class="src-doc-inlinetag">{@link process}</span><span class="src-doc"> again as many times as you want.</span></div></li> <li><div class="src-line"><a name="a86"></a><span class="src-doc"> * When you have finished, you can call </span><span class="src-doc-inlinetag">{@link clean}</span><span class="src-doc"> to delete</span></div></li> <li><div class="src-line"><a name="a87"></a><span class="src-doc"> * the original uploaded file.</span></div></li> <li><div class="src-line"><a name="a88"></a><span class="src-doc"> *</span></div></li> <li><div class="src-line"><a name="a89"></a><span class="src-doc"> * If you don't set any processing parameters and call </span><span class="src-doc-inlinetag">{@link process}</span></div></li> <li><div class="src-line"><a name="a90"></a><span class="src-doc"> * just after instanciating the class. The uploaded file will be simply</span></div></li> <li><div class="src-line"><a name="a91"></a><span class="src-doc"> * copied to the given location without any alteration or checks.</span></div></li> <li><div class="src-line"><a name="a92"></a><span class="src-doc"> *</span></div></li> <li><div class="src-line"><a name="a93"></a><span class="src-doc"> * Don't forget to add <i>enctype="multipart/form-data"</i> in your form</span></div></li> <li><div class="src-line"><a name="a94"></a><span class="src-doc"> * tag <form> if you want your form to upload the file.</span></div></li> <li><div class="src-line"><a name="a95"></a><span class="src-doc"> *</span></div></li> <li><div class="src-line"><a name="a96"></a><span class="src-doc"> * <b>How to use it?</b><br></span></div></li> <li><div class="src-line"><a name="a97"></a><span class="src-doc"> * Create a simple HTML file, with a form such as:</span></div></li> <li><div class="src-line"><a name="a98"></a><span class="src-doc"> * <pre></span></div></li> <li><div class="src-line"><a name="a99"></a><span class="src-doc"> * <form enctype="multipart/form-data" method="post" action="upload.php"></span></div></li> <li><div class="src-line"><a name="a100"></a><span class="src-doc"> * <input type="file" size="32" name="image_field" value=""></span></div></li> <li><div class="src-line"><a name="a101"></a><span class="src-doc"> * <input type="submit" name="Submit" value="upload"></span></div></li> <li><div class="src-line"><a name="a102"></a><span class="src-doc"> * </form></span></div></li> <li><div class="src-line"><a name="a103"></a><span class="src-doc"> * </pre></span></div></li> <li><div class="src-line"><a name="a104"></a><span class="src-doc"> * Create a file called upload.php:</span></div></li> <li><div class="src-line"><a name="a105"></a><span class="src-doc"> * <pre></span></div></li> <li><div class="src-line"><a name="a106"></a><span class="src-doc"> * $handle = new upload($_FILES['image_field']);</span></div></li> <li><div class="src-line"><a name="a107"></a><span class="src-doc"> * if ($handle->uploaded) {</span></div></li> <li><div class="src-line"><a name="a108"></a><span class="src-doc"> * $handle->file_new_name_body = 'image_resized';</span></div></li> <li><div class="src-line"><a name="a109"></a><span class="src-doc"> * $handle->image_resize = true;</span></div></li> <li><div class="src-line"><a name="a110"></a><span class="src-doc"> * $handle->image_x = 100;</span></div></li> <li><div class="src-line"><a name="a111"></a><span class="src-doc"> * $handle->image_ratio_y = true;</span></div></li> <li><div class="src-line"><a name="a112"></a><span class="src-doc"> * $handle->process('/home/user/files/');</span></div></li> <li><div class="src-line"><a name="a113"></a><span class="src-doc"> * if ($handle->processed) {</span></div></li> <li><div class="src-line"><a name="a114"></a><span class="src-doc"> * echo 'image resized';</span></div></li> <li><div class="src-line"><a name="a115"></a><span class="src-doc"> * $handle->clean();</span></div></li> <li><div class="src-line"><a name="a116"></a><span class="src-doc"> * } else {</span></div></li> <li><div class="src-line"><a name="a117"></a><span class="src-doc"> * echo 'error : ' . $handle->error;</span></div></li> <li><div class="src-line"><a name="a118"></a><span class="src-doc"> * }</span></div></li> <li><div class="src-line"><a name="a119"></a><span class="src-doc"> * }</span></div></li> <li><div class="src-line"><a name="a120"></a><span class="src-doc"> * </pre></span></div></li> <li><div class="src-line"><a name="a121"></a><span class="src-doc"> *</span></div></li> <li><div class="src-line"><a name="a122"></a><span class="src-doc"> * <b>How to process local files?</b><br></span></div></li> <li><div class="src-line"><a name="a123"></a><span class="src-doc"> * Use the class as following, the rest being the same as above:</span></div></li> <li><div class="src-line"><a name="a124"></a><span class="src-doc"> * <pre></span></div></li> <li><div class="src-line"><a name="a125"></a><span class="src-doc"> * $handle = new upload('/home/user/myfile.jpg');</span></div></li> <li><div class="src-line"><a name="a126"></a><span class="src-doc"> * </pre></span></div></li> <li><div class="src-line"><a name="a127"></a><span class="src-doc"> *</span></div></li> <li><div class="src-line"><a name="a128"></a><span class="src-doc"> * <b>How to set the language?</b><br></span></div></li> <li><div class="src-line"><a name="a129"></a><span class="src-doc"> * Instantiate the class with a second argument being the language code:</span></div></li> <li><div class="src-line"><a name="a130"></a><span class="src-doc"> * <pre></span></div></li> <li><div class="src-line"><a name="a131"></a><span class="src-doc"> * $handle = new upload($_FILES['image_field'], 'fr_FR');</span></div></li> <li><div class="src-line"><a name="a132"></a><span class="src-doc"> * $handle = new upload('/home/user/myfile.jpg', 'fr_FR');</span></div></li> <li><div class="src-line"><a name="a133"></a><span class="src-doc"> * </pre></span></div></li> <li><div class="src-line"><a name="a134"></a><span class="src-doc"> *</span></div></li> <li><div class="src-line"><a name="a135"></a><span class="src-doc"> * <b>How to output the resulting file or picture directly to the browser?</b><br></span></div></li> <li><div class="src-line"><a name="a136"></a><span class="src-doc"> * Simply call </span><span class="src-doc-inlinetag">{@link process}</span><span class="src-doc">() without an argument (or with null as first argument):</span></div></li> <li><div class="src-line"><a name="a137"></a><span class="src-doc"> * <pre></span></div></li> <li><div class="src-line"><a name="a138"></a><span class="src-doc"> * $handle = new upload($_FILES['image_field']);</span></div></li> <li><div class="src-line"><a name="a139"></a><span class="src-doc"> * header('Content-type: ' . $handle->file_src_mime);</span></div></li> <li><div class="src-line"><a name="a140"></a><span class="src-doc"> * echo $handle->Process();</span></div></li> <li><div class="src-line"><a name="a141"></a><span class="src-doc"> * die();</span></div></li> <li><div class="src-line"><a name="a142"></a><span class="src-doc"> * </pre></span></div></li> <li><div class="src-line"><a name="a143"></a><span class="src-doc"> * Or if you want to force the download of the file:</span></div></li> <li><div class="src-line"><a name="a144"></a><span class="src-doc"> * <pre></span></div></li> <li><div class="src-line"><a name="a145"></a><span class="src-doc"> * $handle = new upload($_FILES['image_field']);</span></div></li> <li><div class="src-line"><a name="a146"></a><span class="src-doc"> * header('Content-type: ' . $handle->file_src_mime);</span></div></li> <li><div class="src-line"><a name="a147"></a><span class="src-doc"> * header("Content-Disposition: attachment; filename=".rawurlencode($handle->file_src_name).";");</span></div></li> <li><div class="src-line"><a name="a148"></a><span class="src-doc"> * echo $handle->Process();</span></div></li> <li><div class="src-line"><a name="a149"></a><span class="src-doc"> * die();</span></div></li> <li><div class="src-line"><a name="a150"></a><span class="src-doc"> * </pre></span></div></li> <li><div class="src-line"><a name="a151"></a><span class="src-doc"> *</span></div></li> <li><div class="src-line"><a name="a152"></a><span class="src-doc"> * <b>Processing parameters</b> (reset after each process)</span></div></li> <li><div class="src-line"><a name="a153"></a><span class="src-doc"> * <ul></span></div></li> <li><div class="src-line"><a name="a154"></a><span class="src-doc"> * <li><b>file_new_name_body</b> replaces the name body (default: '')<br></span></div></li> <li><div class="src-line"><a name="a155"></a><span class="src-doc"> * <pre>$handle->file_new_name_body = 'new name';</pre></li></span></div></li> <li><div class="src-line"><a name="a156"></a><span class="src-doc"> * <li><b>file_name_body_add</b> appends to the name body (default: '')<br></span></div></li> <li><div class="src-line"><a name="a157"></a><span class="src-doc"> * <pre>$handle->file_name_body_add = '_uploaded';</pre></li></span></div></li> <li><div class="src-line"><a name="a158"></a><span class="src-doc"> * <li><b>file_name_body_pre</b> prepends to the name body (default: '')<br></span></div></li> <li><div class="src-line"><a name="a159"></a><span class="src-doc"> * <pre>$handle->file_name_body_pre = 'thumb_';</pre></li></span></div></li> <li><div class="src-line"><a name="a160"></a><span class="src-doc"> * <li><b>file_new_name_ext</b> replaces the file extension (default: '')<br></span></div></li> <li><div class="src-line"><a name="a161"></a><span class="src-doc"> * <pre>$handle->file_new_name_ext = 'txt';</pre></li></span></div></li> <li><div class="src-line"><a name="a162"></a><span class="src-doc"> * <li><b>file_safe_name</b> formats the filename (spaces changed to _) (default: true)<br></span></div></li> <li><div class="src-line"><a name="a163"></a><span class="src-doc"> * <pre>$handle->file_safe_name = true;</pre></li></span></div></li> <li><div class="src-line"><a name="a164"></a><span class="src-doc"> * <li><b>file_overwrite</b> sets behaviour if file already exists (default: false)<br></span></div></li> <li><div class="src-line"><a name="a165"></a><span class="src-doc"> * <pre>$handle->file_overwrite = true;</pre></li></span></div></li> <li><div class="src-line"><a name="a166"></a><span class="src-doc"> * <li><b>file_auto_rename</b> automatically renames file if it already exists (default: true)<br></span></div></li> <li><div class="src-line"><a name="a167"></a><span class="src-doc"> * <pre>$handle->file_auto_rename = true;</pre></li></span></div></li> <li><div class="src-line"><a name="a168"></a><span class="src-doc"> * <li><b>auto_create_dir</b> automatically creates destination directory if missing (default: true)<br></span></div></li> <li><div class="src-line"><a name="a169"></a><span class="src-doc"> * <pre>$handle->auto_create_dir = true;</pre></li></span></div></li> <li><div class="src-line"><a name="a170"></a><span class="src-doc"> * <li><b>dir_auto_chmod</b> automatically attempts to chmod the destination directory if not writeable (default: true)<br></span></div></li> <li><div class="src-line"><a name="a171"></a><span class="src-doc"> * <pre>$handle->dir_auto_chmod = true;</pre></li></span></div></li> <li><div class="src-line"><a name="a172"></a><span class="src-doc"> * <li><b>dir_chmod</b> chmod used when creating directory or if directory not writeable (default: 0777)<br></span></div></li> <li><div class="src-line"><a name="a173"></a><span class="src-doc"> * <pre>$handle->dir_chmod = 0777;</pre></li></span></div></li> <li><div class="src-line"><a name="a174"></a><span class="src-doc"> * <li><b>file_max_size</b> sets maximum upload size (default: upload_max_filesize from php.ini)<br></span></div></li> <li><div class="src-line"><a name="a175"></a><span class="src-doc"> * <pre>$handle->file_max_size = '1024'; // 1KB</pre></li></span></div></li> <li><div class="src-line"><a name="a176"></a><span class="src-doc"> * <li><b>mime_check</b> sets if the class check the MIME against the </span><span class="src-doc-inlinetag">{@link allowed}</span><span class="src-doc"> list (default: true)<br></span></div></li> <li><div class="src-line"><a name="a177"></a><span class="src-doc"> * <pre>$handle->mime_check = true;</pre></li></span></div></li> <li><div class="src-line"><a name="a178"></a><span class="src-doc"> * <li><b>no_script</b> sets if the class turns scripts into text files (default: true)<br></span></div></li> <li><div class="src-line"><a name="a179"></a><span class="src-doc"> * <pre>$handle->no_script = false;</pre></li></span></div></li> <li><div class="src-line"><a name="a180"></a><span class="src-doc"> * <li><b>allowed</b> array of allowed mime-types. wildcard accepted, as in image/* (default: check </span><span class="src-doc-inlinetag">{@link Init}</span><span class="src-doc">)<br></span></div></li> <li><div class="src-line"><a name="a181"></a><span class="src-doc"> * <pre>$handle->allowed = array('application/pdf','application/msword', 'image/*');</pre></li></span></div></li> <li><div class="src-line"><a name="a182"></a><span class="src-doc"> * <li><b>forbidden</b> array of forbidden mime-types. wildcard accepted, as in image/* (default: check </span><span class="src-doc-inlinetag">{@link Init}</span><span class="src-doc">)<br></span></div></li> <li><div class="src-line"><a name="a183"></a><span class="src-doc"> * <pre>$handle->forbidden = array('application/*');</pre></li></span></div></li> <li><div class="src-line"><a name="a184"></a><span class="src-doc"> * </ul></span></div></li> <li><div class="src-line"><a name="a185"></a><span class="src-doc"> * <ul></span></div></li> <li><div class="src-line"><a name="a186"></a><span class="src-doc"> * <li><b>image_convert</b> if set, image will be converted (possible values : ''|'png'|'jpeg'|'gif'|'bmp'; default: '')<br></span></div></li> <li><div class="src-line"><a name="a187"></a><span class="src-doc"> * <pre>$handle->image_convert = 'jpg';</pre></li></span></div></li> <li><div class="src-line"><a name="a188"></a><span class="src-doc"> * <li><b>image_background_color</b> if set, will forcibly fill transparent areas with the color, in hexadecimal (default: null)<br></span></div></li> <li><div class="src-line"><a name="a189"></a><span class="src-doc"> * <pre>$handle->image_background_color = '#FF00FF';</pre></li></span></div></li> <li><div class="src-line"><a name="a190"></a><span class="src-doc"> * <li><b>image_default_color</b> fallback color background color for non alpha-transparent output formats, such as JPEG or BMP, in hexadecimal (default: #FFFFFF)<br></span></div></li> <li><div class="src-line"><a name="a191"></a><span class="src-doc"> * <pre>$handle->image_default_color = '#FF00FF';</pre></li></span></div></li> <li><div class="src-line"><a name="a192"></a><span class="src-doc"> * <li><b>jpeg_quality</b> sets the compression quality for JPEG images (default: 85)<br></span></div></li> <li><div class="src-line"><a name="a193"></a><span class="src-doc"> * <pre>$handle->jpeg_quality = 50;</pre></li></span></div></li> <li><div class="src-line"><a name="a194"></a><span class="src-doc"> * <li><b>jpeg_size</b> if set to a size in bytes, will approximate </span><span class="src-doc-inlinetag">{@link jpeg_quality}</span><span class="src-doc"> so the output image fits within the size (default: null)<br></span></div></li> <li><div class="src-line"><a name="a195"></a><span class="src-doc"> * <pre>$handle->jpeg_size = 3072;</pre></li></span></div></li> <li><div class="src-line"><a name="a196"></a><span class="src-doc"> * </ul></span></div></li> <li><div class="src-line"><a name="a197"></a><span class="src-doc"> * The following eight settings can be used to invalidate an upload if the file is an image (note that <i>open_basedir</i> restrictions prevent the use of these settings)</span></div></li> <li><div class="src-line"><a name="a198"></a><span class="src-doc"> * <ul></span></div></li> <li><div class="src-line"><a name="a199"></a><span class="src-doc"> * <li><b>image_max_width</b> if set to a dimension in pixels, the upload will be invalid if the image width is greater (default: null)<br></span></div></li> <li><div class="src-line"><a name="a200"></a><span class="src-doc"> * <pre>$handle->image_max_width = 200;</pre></li></span></div></li> <li><div class="src-line"><a name="a201"></a><span class="src-doc"> * <li><b>image_max_height</b> if set to a dimension in pixels, the upload will be invalid if the image height is greater (default: null)<br></span></div></li> <li><div class="src-line"><a name="a202"></a><span class="src-doc"> * <pre>$handle->image_max_height = 100;</pre></li></span></div></li> <li><div class="src-line"><a name="a203"></a><span class="src-doc"> * <li><b>image_max_pixels</b> if set to a number of pixels, the upload will be invalid if the image number of pixels is greater (default: null)<br></span></div></li> <li><div class="src-line"><a name="a204"></a><span class="src-doc"> * <pre>$handle->image_max_pixels = 50000;</pre></li></span></div></li> <li><div class="src-line"><a name="a205"></a><span class="src-doc"> * <li><b>image_max_ratio</b> if set to a aspect ratio (width/height), the upload will be invalid if the image apect ratio is greater (default: null)<br></span></div></li> <li><div class="src-line"><a name="a206"></a><span class="src-doc"> * <pre>$handle->image_max_ratio = 1.5;</pre></li></span></div></li> <li><div class="src-line"><a name="a207"></a><span class="src-doc"> * <li><b>image_min_width</b> if set to a dimension in pixels, the upload will be invalid if the image width is lower (default: null)<br></span></div></li> <li><div class="src-line"><a name="a208"></a><span class="src-doc"> * <pre>$handle->image_min_width = 100;</pre></li></span></div></li> <li><div class="src-line"><a name="a209"></a><span class="src-doc"> * <li><b>image_min_height</b> if set to a dimension in pixels, the upload will be invalid if the image height is lower (default: null)<br></span></div></li> <li><div class="src-line"><a name="a210"></a><span class="src-doc"> * <pre>$handle->image_min_height = 500;</pre></li></span></div></li> <li><div class="src-line"><a name="a211"></a><span class="src-doc"> * <li><b>image_min_pixels</b> if set to a number of pixels, the upload will be invalid if the image number of pixels is lower (default: null)<br></span></div></li> <li><div class="src-line"><a name="a212"></a><span class="src-doc"> * <pre>$handle->image_min_pixels = 20000;</pre></li></span></div></li> <li><div class="src-line"><a name="a213"></a><span class="src-doc"> * <li><b>image_min_ratio</b> if set to a aspect ratio (width/height), the upload will be invalid if the image apect ratio is lower (default: null)<br></span></div></li> <li><div class="src-line"><a name="a214"></a><span class="src-doc"> * <pre>$handle->image_min_ratio = 0.5;</pre></li></span></div></li> <li><div class="src-line"><a name="a215"></a><span class="src-doc"> * </ul></span></div></li> <li><div class="src-line"><a name="a216"></a><span class="src-doc"> * <ul></span></div></li> <li><div class="src-line"><a name="a217"></a><span class="src-doc"> * <li><b>image_resize</b> determines is an image will be resized (default: false)<br></span></div></li> <li><div class="src-line"><a name="a218"></a><span class="src-doc"> * <pre>$handle->image_resize = true;</pre></li></span></div></li> <li><div class="src-line"><a name="a219"></a><span class="src-doc"> * </ul></span></div></li> <li><div class="src-line"><a name="a220"></a><span class="src-doc"> * The following variables are used only if </span><span class="src-doc-inlinetag">{@link image_resize}</span><span class="src-doc"> == true</span></div></li> <li><div class="src-line"><a name="a221"></a><span class="src-doc"> * <ul></span></div></li> <li><div class="src-line"><a name="a222"></a><span class="src-doc"> * <li><b>image_x</b> destination image width (default: 150)<br></span></div></li> <li><div class="src-line"><a name="a223"></a><span class="src-doc"> * <pre>$handle->image_x = 100;</pre></li></span></div></li> <li><div class="src-line"><a name="a224"></a><span class="src-doc"> * <li><b>image_y</b> destination image height (default: 150)<br></span></div></li> <li><div class="src-line"><a name="a225"></a><span class="src-doc"> * <pre>$handle->image_y = 200;</pre></li></span></div></li> <li><div class="src-line"><a name="a226"></a><span class="src-doc"> * </ul></span></div></li> <li><div class="src-line"><a name="a227"></a><span class="src-doc"> * Use either one of the following</span></div></li> <li><div class="src-line"><a name="a228"></a><span class="src-doc"> * <ul></span></div></li> <li><div class="src-line"><a name="a229"></a><span class="src-doc"> * <li><b>image_ratio</b> if true, resize image conserving the original sizes ratio, using </span><span class="src-doc-inlinetag">{@link image_x}</span><span class="src-doc"> AND </span><span class="src-doc-inlinetag">{@link image_y}</span><span class="src-doc"> as max sizes if true (default: false)<br></span></div></li> <li><div class="src-line"><a name="a230"></a><span class="src-doc"> * <pre>$handle->image_ratio = true;</pre></li></span></div></li> <li><div class="src-line"><a name="a231"></a><span class="src-doc"> * <li><b>image_ratio_crop</b> if true, resize image conserving the original sizes ratio, using </span><span class="src-doc-inlinetag">{@link image_x}</span><span class="src-doc"> AND </span><span class="src-doc-inlinetag">{@link image_y}</span><span class="src-doc"> as max sizes, and cropping excedent to fill the space. setting can also be a string, with one or more from 'TBLR', indicating which side of the image will be kept while cropping (default: false)<br></span></div></li> <li><div class="src-line"><a name="a232"></a><span class="src-doc"> * <pre>$handle->image_ratio_crop = true;</pre></li></span></div></li> <li><div class="src-line"><a name="a233"></a><span class="src-doc"> * <li><b>image_ratio_fill</b> if true, resize image conserving the original sizes ratio, using </span><span class="src-doc-inlinetag">{@link image_x}</span><span class="src-doc"> AND </span><span class="src-doc-inlinetag">{@link image_y}</span><span class="src-doc"> as max sizes, fitting the image in the space and coloring the remaining space. setting can also be a string, with one or more from 'TBLR', indicating which side of the space the image will be in (default: false)<br></span></div></li> <li><div class="src-line"><a name="a234"></a><span class="src-doc"> * <pre>$handle->image_ratio_fill = true;</pre></li></span></div></li> <li><div class="src-line"><a name="a235"></a><span class="src-doc"> * <li><b>image_ratio_no_zoom_in</b> same as </span><span class="src-doc-inlinetag">{@link image_ratio}</span><span class="src-doc">, but won't resize if the source image is smaller than </span><span class="src-doc-inlinetag">{@link image_x}</span><span class="src-doc"> x </span><span class="src-doc-inlinetag">{@link image_y}</span><span class="src-doc"> (default: false)<br></span></div></li> <li><div class="src-line"><a name="a236"></a><span class="src-doc"> * <pre>$handle->image_ratio_no_zoom_in = true;</pre></li></span></div></li> <li><div class="src-line"><a name="a237"></a><span class="src-doc"> * <li><b>image_ratio_no_zoom_out</b> same as </span><span class="src-doc-inlinetag">{@link image_ratio}</span><span class="src-doc">, but won't resize if the source image is bigger than </span><span class="src-doc-inlinetag">{@link image_x}</span><span class="src-doc"> x </span><span class="src-doc-inlinetag">{@link image_y}</span><span class="src-doc"> (default: false)<br></span></div></li> <li><div class="src-line"><a name="a238"></a><span class="src-doc"> * <pre>$handle->image_ratio_no_zoom_out = true;</pre></li></span></div></li> <li><div class="src-line"><a name="a239"></a><span class="src-doc"> * <li><b>image_ratio_x</b> if true, resize image, calculating </span><span class="src-doc-inlinetag">{@link image_x}</span><span class="src-doc"> from </span><span class="src-doc-inlinetag">{@link image_y}</span><span class="src-doc"> and conserving the original sizes ratio (default: false)<br></span></div></li> <li><div class="src-line"><a name="a240"></a><span class="src-doc"> * <pre>$handle->image_ratio_x = true;</pre></li></span></div></li> <li><div class="src-line"><a name="a241"></a><span class="src-doc"> * <li><b>image_ratio_y</b> if true, resize image, calculating </span><span class="src-doc-inlinetag">{@link image_y}</span><span class="src-doc"> from </span><span class="src-doc-inlinetag">{@link image_x}</span><span class="src-doc"> and conserving the original sizes ratio (default: false)<br></span></div></li> <li><div class="src-line"><a name="a242"></a><span class="src-doc"> * <pre>$handle->image_ratio_y = true;</pre></li></span></div></li> <li><div class="src-line"><a name="a243"></a><span class="src-doc"> * <li><b>image_ratio_pixels</b> if set to a long integer, resize image, calculating </span><span class="src-doc-inlinetag">{@link image_y}</span><span class="src-doc"> and </span><span class="src-doc-inlinetag">{@link image_x}</span><span class="src-doc"> to match a the number of pixels (default: false)<br></span></div></li> <li><div class="src-line"><a name="a244"></a><span class="src-doc"> * <pre>$handle->image_ratio_pixels = 25000;</pre></li></span></div></li> <li><div class="src-line"><a name="a245"></a><span class="src-doc"> * </ul></span></div></li> <li><div class="src-line"><a name="a246"></a><span class="src-doc"> * The following image manipulations require GD2+</span></div></li> <li><div class="src-line"><a name="a247"></a><span class="src-doc"> * <ul></span></div></li> <li><div class="src-line"><a name="a248"></a><span class="src-doc"> * <li><b>image_brightness</b> if set, corrects the brightness. value between -127 and 127 (default: null)<br></span></div></li> <li><div class="src-line"><a name="a249"></a><span class="src-doc"> * <pre>$handle->image_brightness = 40;</pre></li></span></div></li> <li><div class="src-line"><a name="a250"></a><span class="src-doc"> * <li><b>image_contrast</b> if set, corrects the contrast. value between -127 and 127 (default: null)<br></span></div></li> <li><div class="src-line"><a name="a251"></a><span class="src-doc"> * <pre>$handle->image_contrast = 50;</pre></li></span></div></li> <li><div class="src-line"><a name="a252"></a><span class="src-doc"> * <li><b>image_tint_color</b> if set, will tint the image with a color, value as hexadecimal #FFFFFF (default: null)<br></span></div></li> <li><div class="src-line"><a name="a253"></a><span class="src-doc"> * <pre>$handle->image_tint_color = '#FF0000';</pre></li></span></div></li> <li><div class="src-line"><a name="a254"></a><span class="src-doc"> * <li><b>image_overlay_color</b> if set, will add a colored overlay, value as hexadecimal #FFFFFF (default: null)<br></span></div></li> <li><div class="src-line"><a name="a255"></a><span class="src-doc"> * <pre>$handle->image_overlay_color = '#FF0000';</pre></li></span></div></li> <li><div class="src-line"><a name="a256"></a><span class="src-doc"> * <li><b>image_overlay_percent</b> used when </span><span class="src-doc-inlinetag">{@link image_overlay_color}</span><span class="src-doc"> is set, determines the opacity (default: 50)<br></span></div></li> <li><div class="src-line"><a name="a257"></a><span class="src-doc"> * <pre>$handle->image_overlay_percent = 20;</pre></li></span></div></li> <li><div class="src-line"><a name="a258"></a><span class="src-doc"> * <li><b>image_negative</b> inverts the colors in the image (default: false)<br></span></div></li> <li><div class="src-line"><a name="a259"></a><span class="src-doc"> * <pre>$handle->image_negative = true;</pre></li></span></div></li> <li><div class="src-line"><a name="a260"></a><span class="src-doc"> * <li><b>image_greyscale</b> transforms an image into greyscale (default: false)<br></span></div></li> <li><div class="src-line"><a name="a261"></a><span class="src-doc"> * <pre>$handle->image_greyscale = true;</pre></li></span></div></li> <li><div class="src-line"><a name="a262"></a><span class="src-doc"> * <li><b>image_threshold</b> applies a threshold filter. value between -127 and 127 (default: null)<br></span></div></li> <li><div class="src-line"><a name="a263"></a><span class="src-doc"> * <pre>$handle->image_threshold = 20;</pre></li></span></div></li> <li><div class="src-line"><a name="a264"></a><span class="src-doc"> * </ul></span></div></li> <li><div class="src-line"><a name="a265"></a><span class="src-doc"> * <ul></span></div></li> <li><div class="src-line"><a name="a266"></a><span class="src-doc"> * <li><b>image_text</b> creates a text label on the image, value is a string, with eventual replacement tokens (default: null)<br></span></div></li> <li><div class="src-line"><a name="a267"></a><span class="src-doc"> * <pre>$handle->image_text = 'test';</pre></li></span></div></li> <li><div class="src-line"><a name="a268"></a><span class="src-doc"> * <li><b>image_text_direction</b> text label direction, either 'h' horizontal or 'v' vertical (default: 'h')<br></span></div></li> <li><div class="src-line"><a name="a269"></a><span class="src-doc"> * <pre>$handle->image_text_direction = 'v';</pre></li></span></div></li> <li><div class="src-line"><a name="a270"></a><span class="src-doc"> * <li><b>image_text_color</b> text color for the text label, in hexadecimal (default: #FFFFFF)<br></span></div></li> <li><div class="src-line"><a name="a271"></a><span class="src-doc"> * <pre>$handle->image_text_color = '#FF0000';</pre></li></span></div></li> <li><div class="src-line"><a name="a272"></a><span class="src-doc"> * <li><b>image_text_percent</b> text opacity on the text label, integer between 0 and 100 (default: 100)<br></span></div></li> <li><div class="src-line"><a name="a273"></a><span class="src-doc"> * <pre>$handle->image_text_percent = 50;</pre></li></span></div></li> <li><div class="src-line"><a name="a274"></a><span class="src-doc"> * <li><b>image_text_background</b> text label background color, in hexadecimal (default: null)<br></span></div></li> <li><div class="src-line"><a name="a275"></a><span class="src-doc"> * <pre>$handle->image_text_background = '#FFFFFF';</pre></li></span></div></li> <li><div class="src-line"><a name="a276"></a><span class="src-doc"> * <li><b>image_text_background_percent</b> text label background opacity, integer between 0 and 100 (default: 100)<br></span></div></li> <li><div class="src-line"><a name="a277"></a><span class="src-doc"> * <pre>$handle->image_text_background_percent = 50;</pre></li></span></div></li> <li><div class="src-line"><a name="a278"></a><span class="src-doc"> * <li><b>image_text_font</b> built-in font for the text label, from 1 to 5. 1 is the smallest (default: 5)<br></span></div></li> <li><div class="src-line"><a name="a279"></a><span class="src-doc"> * <pre>$handle->image_text_font = 4;</pre></li></span></div></li> <li><div class="src-line"><a name="a280"></a><span class="src-doc"> * <li><b>image_text_x</b> absolute text label position, in pixels from the left border. can be negative (default: null)<br></span></div></li> <li><div class="src-line"><a name="a281"></a><span class="src-doc"> * <pre>$handle->image_text_x = 5;</pre></li></span></div></li> <li><div class="src-line"><a name="a282"></a><span class="src-doc"> * <li><b>image_text_y</b> absolute text label position, in pixels from the top border. can be negative (default: null)<br></span></div></li> <li><div class="src-line"><a name="a283"></a><span class="src-doc"> * <pre>$handle->image_text_y = 5;</pre></li></span></div></li> <li><div class="src-line"><a name="a284"></a><span class="src-doc"> * <li><b>image_text_position</b> text label position withing the image, a combination of one or two from 'TBLR': top, bottom, left, right (default: null)<br></span></div></li> <li><div class="src-line"><a name="a285"></a><span class="src-doc"> * <pre>$handle->image_text_position = 'LR';</pre></li></span></div></li> <li><div class="src-line"><a name="a286"></a><span class="src-doc"> * <li><b>image_text_padding</b> text label padding, in pixels. can be overridden by </span><span class="src-doc-inlinetag">{@link image_text_padding_x}</span><span class="src-doc"> and </span><span class="src-doc-inlinetag">{@link image_text_padding_y}</span><span class="src-doc"> (default: 0)<br></span></div></li> <li><div class="src-line"><a name="a287"></a><span class="src-doc"> * <pre>$handle->image_text_padding = 5;</pre></li></span></div></li> <li><div class="src-line"><a name="a288"></a><span class="src-doc"> * <li><b>image_text_padding_x</b> text label horizontal padding (default: null)<br></span></div></li> <li><div class="src-line"><a name="a289"></a><span class="src-doc"> * <pre>$handle->image_text_padding_x = 2;</pre></li></span></div></li> <li><div class="src-line"><a name="a290"></a><span class="src-doc"> * <li><b>image_text_padding_y</b> text label vertical padding (default: null)<br></span></div></li> <li><div class="src-line"><a name="a291"></a><span class="src-doc"> * <pre>$handle->image_text_padding_y = 10;</pre></li></span></div></li> <li><div class="src-line"><a name="a292"></a><span class="src-doc"> * <li><b>image_text_alignment</b> text alignment when text has multiple lines, either 'L', 'C' or 'R' (default: 'C')<br></span></div></li> <li><div class="src-line"><a name="a293"></a><span class="src-doc"> * <pre>$handle->image_text_alignment = 'R';</pre></li></span></div></li> <li><div class="src-line"><a name="a294"></a><span class="src-doc"> * <li><b>image_text_line_spacing</b> space between lines in pixels, when text has multiple lines (default: 0)<br></span></div></li> <li><div class="src-line"><a name="a295"></a><span class="src-doc"> * <pre>$handle->image_text_line_spacing = 3;</pre></li></span></div></li> <li><div class="src-line"><a name="a296"></a><span class="src-doc"> * </ul></span></div></li> <li><div class="src-line"><a name="a297"></a><span class="src-doc"> * <ul></span></div></li> <li><div class="src-line"><a name="a298"></a><span class="src-doc"> * <li><b>image_flip</b> flips image, wither 'h' horizontal or 'v' vertical (default: null)<br></span></div></li> <li><div class="src-line"><a name="a299"></a><span class="src-doc"> * <pre>$handle->image_flip = 'h';</pre></li></span></div></li> <li><div class="src-line"><a name="a300"></a><span class="src-doc"> * <li><b>image_rotate</b> rotates image. possible values are 90, 180 and 270 (default: null)<br></span></div></li> <li><div class="src-line"><a name="a301"></a><span class="src-doc"> * <pre>$handle->image_rotate = 90;</pre></li></span></div></li> <li><div class="src-line"><a name="a302"></a><span class="src-doc"> * <li><b>image_crop</b> crops image. accepts 4, 2 or 1 values as 'T R B L' or 'TB LR' or 'TBLR'. dimension can be 20, or 20px or 20% (default: null)<br></span></div></li> <li><div class="src-line"><a name="a303"></a><span class="src-doc"> * <pre>$handle->image_crop = array(50,40,30,20); OR '-20 20%'...</pre></li></span></div></li> <li><div class="src-line"><a name="a304"></a><span class="src-doc"> * <li><b>image_precrop</b> crops image, before an eventual resizing. accepts 4, 2 or 1 values as 'T R B L' or 'TB LR' or 'TBLR'. dimension can be 20, or 20px or 20% (default: null)<br></span></div></li> <li><div class="src-line"><a name="a305"></a><span class="src-doc"> * <pre>$handle->image_precrop = array(50,40,30,20); OR '-20 20%'...</pre></li></span></div></li> <li><div class="src-line"><a name="a306"></a><span class="src-doc"> * </ul></span></div></li> <li><div class="src-line"><a name="a307"></a><span class="src-doc"> * <ul></span></div></li> <li><div class="src-line"><a name="a308"></a><span class="src-doc"> * <li><b>image_bevel</b> adds a bevel border to the image. value is thickness in pixels (default: null)<br></span></div></li> <li><div class="src-line"><a name="a309"></a><span class="src-doc"> * <pre>$handle->image_bevel = 20;</pre></li></span></div></li> <li><div class="src-line"><a name="a310"></a><span class="src-doc"> * <li><b>image_bevel_color1</b> top and left bevel color, in hexadecimal (default: #FFFFFF)<br></span></div></li> <li><div class="src-line"><a name="a311"></a><span class="src-doc"> * <pre>$handle->image_bevel_color1 = '#FFFFFF';</pre></li></span></div></li> <li><div class="src-line"><a name="a312"></a><span class="src-doc"> * <li><b>image_bevel_color2</b> bottom and right bevel color, in hexadecimal (default: #000000)<br></span></div></li> <li><div class="src-line"><a name="a313"></a><span class="src-doc"> * <pre>$handle->image_bevel_color2 = '#000000';</pre></li></span></div></li> <li><div class="src-line"><a name="a314"></a><span class="src-doc"> * <li><b>image_border</b> adds a unicolor border to the image. accepts 4, 2 or 1 values as 'T R B L' or 'TB LR' or 'TBLR'. dimension can be 20, or 20px or 20% (default: null)<br></span></div></li> <li><div class="src-line"><a name="a315"></a><span class="src-doc"> * <pre>$handle->image_border = '3px'; OR '-20 20%' OR array(3,2)...</pre></li></span></div></li> <li><div class="src-line"><a name="a316"></a><span class="src-doc"> * <li><b>image_border_color</b> border color, in hexadecimal (default: #FFFFFF)<br></span></div></li> <li><div class="src-line"><a name="a317"></a><span class="src-doc"> * <pre>$handle->image_border_color = '#FFFFFF';</pre></li></span></div></li> <li><div class="src-line"><a name="a318"></a><span class="src-doc"> * <li><b>image_frame</b> type of frame: 1=flat 2=crossed (default: null)<br></span></div></li> <li><div class="src-line"><a name="a319"></a><span class="src-doc"> * <pre>$handle->image_frame = 2;</pre></li></span></div></li> <li><div class="src-line"><a name="a320"></a><span class="src-doc"> * <li><b>image_frame_colors</b> list of hex colors, in an array or a space separated string (default: '#FFFFFF #999999 #666666 #000000')<br></span></div></li> <li><div class="src-line"><a name="a321"></a><span class="src-doc"> * <pre>$handle->image_frame_colors = array('#999999', '#FF0000', '#666666', '#333333', '#000000');</pre></li></span></div></li> <li><div class="src-line"><a name="a322"></a><span class="src-doc"> * </ul></span></div></li> <li><div class="src-line"><a name="a323"></a><span class="src-doc"> * <ul></span></div></li> <li><div class="src-line"><a name="a324"></a><span class="src-doc"> * <li><b>image_watermark</b> adds a watermark on the image, value is a local filename. accepted files are GIF, JPG, BMP, PNG and PNG alpha (default: null)<br></span></div></li> <li><div class="src-line"><a name="a325"></a><span class="src-doc"> * <pre>$handle->image_watermark = 'watermark.png';</pre></li></span></div></li> <li><div class="src-line"><a name="a326"></a><span class="src-doc"> * <li><b>image_watermark_x</b> absolute watermark position, in pixels from the left border. can be negative (default: null)<br></span></div></li> <li><div class="src-line"><a name="a327"></a><span class="src-doc"> * <pre>$handle->image_watermark_x = 5;</pre></li></span></div></li> <li><div class="src-line"><a name="a328"></a><span class="src-doc"> * <li><b>image_watermark_y</b> absolute watermark position, in pixels from the top border. can be negative (default: null)<br></span></div></li> <li><div class="src-line"><a name="a329"></a><span class="src-doc"> * <pre>$handle->image_watermark_y = 5;</pre></li></span></div></li> <li><div class="src-line"><a name="a330"></a><span class="src-doc"> * <li><b>image_watermark_position</b> watermark position withing the image, a combination of one or two from 'TBLR': top, bottom, left, right (default: null)<br></span></div></li> <li><div class="src-line"><a name="a331"></a><span class="src-doc"> * <pre>$handle->image_watermark_position = 'LR';</pre></li></span></div></li> <li><div class="src-line"><a name="a332"></a><span class="src-doc"> * </ul></span></div></li> <li><div class="src-line"><a name="a333"></a><span class="src-doc"> * <ul></span></div></li> <li><div class="src-line"><a name="a334"></a><span class="src-doc"> * <li><b>image_reflection_height</b> if set, a reflection will be added. Format is either in pixels or percentage, such as 40, '40', '40px' or '40%' (default: null)<br></span></div></li> <li><div class="src-line"><a name="a335"></a><span class="src-doc"> * <pre>$handle->image_reflection_height = '25%';</pre></li></span></div></li> <li><div class="src-line"><a name="a336"></a><span class="src-doc"> * <li><b>image_reflection_space</b> space in pixels between the source image and the reflection, can be negative (default: null)<br></span></div></li> <li><div class="src-line"><a name="a337"></a><span class="src-doc"> * <pre>$handle->image_reflection_space = 3;</pre></li></span></div></li> <li><div class="src-line"><a name="a338"></a><span class="src-doc"> * <li><b>image_reflection_color</b> reflection background color, in hexadecimal. Now deprecated in favor of </span><span class="src-doc-inlinetag">{@link image_default_color}</span><span class="src-doc"> (default: #FFFFFF)<br></span></div></li> <li><div class="src-line"><a name="a339"></a><span class="src-doc"> * <pre>$handle->image_default_color = '#000000';</pre></li></span></div></li> <li><div class="src-line"><a name="a340"></a><span class="src-doc"> * <li><b>image_reflection_opacity</b> opacity level at which the reflection starts, integer between 0 and 100 (default: 60)<br></span></div></li> <li><div class="src-line"><a name="a341"></a><span class="src-doc"> * <pre>$handle->image_reflection_opacity = 60;</pre></li></span></div></li> <li><div class="src-line"><a name="a342"></a><span class="src-doc"> * </ul></span></div></li> <li><div class="src-line"><a name="a343"></a><span class="src-doc"> *</span></div></li> <li><div class="src-line"><a name="a344"></a><span class="src-doc"> * <b>Values that can be read before calling </span><span class="src-doc-inlinetag">{@link process}</span><span class="src-doc">()</b></span></div></li> <li><div class="src-line"><a name="a345"></a><span class="src-doc"> * <ul></span></div></li> <li><div class="src-line"><a name="a346"></a><span class="src-doc"> * <li><b>file_src_name</b> Source file name</li></span></div></li> <li><div class="src-line"><a name="a347"></a><span class="src-doc"> * <li><b>file_src_name_body</b> Source file name body</li></span></div></li> <li><div class="src-line"><a name="a348"></a><span class="src-doc"> * <li><b>file_src_name_ext</b> Source file extension</li></span></div></li> <li><div class="src-line"><a name="a349"></a><span class="src-doc"> * <li><b>file_src_pathname</b> Source file complete path and name</li></span></div></li> <li><div class="src-line"><a name="a350"></a><span class="src-doc"> * <li><b>file_src_mime</b> Source file mime type</li></span></div></li> <li><div class="src-line"><a name="a351"></a><span class="src-doc"> * <li><b>file_src_size</b> Source file size in bytes</li></span></div></li> <li><div class="src-line"><a name="a352"></a><span class="src-doc"> * <li><b>file_src_error</b> Upload error code</li></span></div></li> <li><div class="src-line"><a name="a353"></a><span class="src-doc"> * <li><b>file_is_image</b> Boolean flag, true if the file is a supported image type</li></span></div></li> <li><div class="src-line"><a name="a354"></a><span class="src-doc"> * </ul></span></div></li> <li><div class="src-line"><a name="a355"></a><span class="src-doc"> * If the file is a supported image type (and <i>open_basedir</i> restrictions allow it)</span></div></li> <li><div class="src-line"><a name="a356"></a><span class="src-doc"> * <ul></span></div></li> <li><div class="src-line"><a name="a357"></a><span class="src-doc"> * <li><b>image_src_x</b> Source file width in pixels</li></span></div></li> <li><div class="src-line"><a name="a358"></a><span class="src-doc"> * <li><b>image_src_y</b> Source file height in pixels</li></span></div></li> <li><div class="src-line"><a name="a359"></a><span class="src-doc"> * <li><b>image_src_pixels</b> Source file number of pixels</li></span></div></li> <li><div class="src-line"><a name="a360"></a><span class="src-doc"> * <li><b>image_src_type</b> Source file type (png, jpg, gif or bmp)</li></span></div></li> <li><div class="src-line"><a name="a361"></a><span class="src-doc"> * <li><b>image_src_bits</b> Source file color depth</li></span></div></li> <li><div class="src-line"><a name="a362"></a><span class="src-doc"> * </ul></span></div></li> <li><div class="src-line"><a name="a363"></a><span class="src-doc"> *</span></div></li> <li><div class="src-line"><a name="a364"></a><span class="src-doc"> * <b>Values that can be read after calling </span><span class="src-doc-inlinetag">{@link process}</span><span class="src-doc">()</b></span></div></li> <li><div class="src-line"><a name="a365"></a><span class="src-doc"> * <ul></span></div></li> <li><div class="src-line"><a name="a366"></a><span class="src-doc"> * <li><b>file_dst_path</b> Destination file path</li></span></div></li> <li><div class="src-line"><a name="a367"></a><span class="src-doc"> * <li><b>file_dst_name_body</b> Destination file name body</li></span></div></li> <li><div class="src-line"><a name="a368"></a><span class="src-doc"> * <li><b>file_dst_name_ext</b> Destination file extension</li></span></div></li> <li><div class="src-line"><a name="a369"></a><span class="src-doc"> * <li><b>file_dst_name</b> Destination file name</li></span></div></li> <li><div class="src-line"><a name="a370"></a><span class="src-doc"> * <li><b>file_dst_pathname</b> Destination file complete path and name</li></span></div></li> <li><div class="src-line"><a name="a371"></a><span class="src-doc"> * </ul></span></div></li> <li><div class="src-line"><a name="a372"></a><span class="src-doc"> * If the file is a supported image type</span></div></li> <li><div class="src-line"><a name="a373"></a><span class="src-doc"> * <ul></span></div></li> <li><div class="src-line"><a name="a374"></a><span class="src-doc"> * <li><b>image_dst_x</b> Destination file width</li></span></div></li> <li><div class="src-line"><a name="a375"></a><span class="src-doc"> * <li><b>image_dst_y</b> Destination file height</li></span></div></li> <li><div class="src-line"><a name="a376"></a><span class="src-doc"> * <li><b>image_convert</b> Destination file format</li></span></div></li> <li><div class="src-line"><a name="a377"></a><span class="src-doc"> * </ul></span></div></li> <li><div class="src-line"><a name="a378"></a><span class="src-doc"> *</span></div></li> <li><div class="src-line"><a name="a379"></a><span class="src-doc"> * <b>Requirements</b></span></div></li> <li><div class="src-line"><a name="a380"></a><span class="src-doc"> *</span></div></li> <li><div class="src-line"><a name="a381"></a><span class="src-doc"> * Most of the image operations require GD. GD2 is greatly recommended</span></div></li> <li><div class="src-line"><a name="a382"></a><span class="src-doc"> *</span></div></li> <li><div class="src-line"><a name="a383"></a><span class="src-doc"> * The class is compatible with PHP 4.3+, and compatible with PHP5</span></div></li> <li><div class="src-line"><a name="a384"></a><span class="src-doc"> *</span></div></li> <li><div class="src-line"><a name="a385"></a><span class="src-doc"> * <b>Changelog</b></span></div></li> <li><div class="src-line"><a name="a386"></a><span class="src-doc"> * <ul></span></div></li> <li><div class="src-line"><a name="a387"></a><span class="src-doc"> * <li><b>v 0.29</b> 03/02/2010<br></span></div></li> <li><div class="src-line"><a name="a388"></a><span class="src-doc"> * - added protection against malicious images<br></span></div></li> <li><div class="src-line"><a name="a389"></a><span class="src-doc"> * - added zip and torrent MIME type<br></span></div></li> <li><div class="src-line"><a name="a390"></a><span class="src-doc"> * - replaced split() with explode()<br></span></div></li> <li><div class="src-line"><a name="a391"></a><span class="src-doc"> * - initialise image_dst_x/y with image_src_x/y<br></span></div></li> <li><div class="src-line"><a name="a392"></a><span class="src-doc"> * - removed </span><span class="src-doc-inlinetag">{@link mime_fileinfo}</span><span class="src-doc">, </span><span class="src-doc-inlinetag">{@link mime_file}</span><span class="src-doc">, </span><span class="src-doc-inlinetag">{@link mime_magic}</span><span class="src-doc"> and </span><span class="src-doc-inlinetag">{@link mime_getimagesize}</span><span class="src-doc"> from the docs since they are used before </span><span class="src-doc-inlinetag">{@link process}</span><span class="src-doc"><br></span></div></li> <li><div class="src-line"><a name="a393"></a><span class="src-doc"> * - added more extensions and MIME types<br></span></div></li> <li><div class="src-line"><a name="a394"></a><span class="src-doc"> * - improved MIME type validation<br></span></div></li> <li><div class="src-line"><a name="a395"></a><span class="src-doc"> * - improved logging</li></span></div></li> <li><div class="src-line"><a name="a396"></a><span class="src-doc"> * <li><b>v 0.28</b> 10/08/2009<br></span></div></li> <li><div class="src-line"><a name="a397"></a><span class="src-doc"> * - replaced ereg functions to be compatible with PHP 5.3<br></span></div></li> <li><div class="src-line"><a name="a398"></a><span class="src-doc"> * - added flv MIME type<br></span></div></li> <li><div class="src-line"><a name="a399"></a><span class="src-doc"> * - improved MIME type detection<br></span></div></li> <li><div class="src-line"><a name="a400"></a><span class="src-doc"> * - added </span><span class="src-doc-inlinetag">{@link file_name_body_pre}</span><span class="src-doc"> to prepend a string to the file name<br></span></div></li> <li><div class="src-line"><a name="a401"></a><span class="src-doc"> * - added </span><span class="src-doc-inlinetag">{@link mime_fileinfo}</span><span class="src-doc">, </span><span class="src-doc-inlinetag">{@link mime_file}</span><span class="src-doc">, </span><span class="src-doc-inlinetag">{@link mime_magic}</span><span class="src-doc"> and </span><span class="src-doc-inlinetag">{@link mime_getimagesize}</span><span class="src-doc"> so that it is possible to deactivate some MIME type checking method<br></span></div></li> <li><div class="src-line"><a name="a402"></a><span class="src-doc"> * - use exec() rather than shell_exec(), to play better with safe mode <br></span></div></li> <li><div class="src-line"><a name="a403"></a><span class="src-doc"> * - added some error messages<br></span></div></li> <li><div class="src-line"><a name="a404"></a><span class="src-doc"> * - fix bug when checking on conditions, </span><span class="src-doc-inlinetag">{@link processed}</span><span class="src-doc"> wasn't propagated properly</li></span></div></li> <li><div class="src-line"><a name="a405"></a><span class="src-doc"> * <li><b>v 0.27</b> 14/05/2009<br></span></div></li> <li><div class="src-line"><a name="a406"></a><span class="src-doc"> * - look for the language files directory from __FILE__<br></span></div></li> <li><div class="src-line"><a name="a407"></a><span class="src-doc"> * - deactivate </span><span class="src-doc-inlinetag">{@link file_auto_rename}</span><span class="src-doc"> if </span><span class="src-doc-inlinetag">{@link file_overwrite}</span><span class="src-doc"> is set<br></span></div></li> <li><div class="src-line"><a name="a408"></a><span class="src-doc"> * - improved transparency replacement for true color images<br></span></div></li> <li><div class="src-line"><a name="a409"></a><span class="src-doc"> * - fixed calls to newer version of UNIX file utility<br></span></div></li> <li><div class="src-line"><a name="a410"></a><span class="src-doc"> * - fixed error when using PECL Fileinfo extension in SAFE MODE, and when using the finfo class<br></span></div></li> <li><div class="src-line"><a name="a411"></a><span class="src-doc"> * - added </span><span class="src-doc-inlinetag">{@link image_precrop}</span><span class="src-doc"> to crop the image before an eventual resizing</li></span></div></li> <li><div class="src-line"><a name="a412"></a><span class="src-doc"> * <li><b>v 0.26</b> 13/11/2008<br></span></div></li> <li><div class="src-line"><a name="a413"></a><span class="src-doc"> * - rewrote conversion from palette to true color to handle transparency better<br></span></div></li> <li><div class="src-line"><a name="a414"></a><span class="src-doc"> * - fixed imagecopymergealpha() when the overlayed image is of wrong dimensions<br></span></div></li> <li><div class="src-line"><a name="a415"></a><span class="src-doc"> * - fixed imagecreatenew() when the image to create have less than 1 pixels width or height<br></span></div></li> <li><div class="src-line"><a name="a416"></a><span class="src-doc"> * - rewrote MIME type detection to be more secure and not rely on browser information; now using Fileinfo PECL extension, UNIX file() command, MIME magic, and getimagesize(), in that order<br></span></div></li> <li><div class="src-line"><a name="a417"></a><span class="src-doc"> * - added support for Flash uploaders<br></span></div></li> <li><div class="src-line"><a name="a418"></a><span class="src-doc"> * - some bug fixing and error handling</li></span></div></li> <li><div class="src-line"><a name="a419"></a><span class="src-doc"> * <li><b>v 0.25</b> 17/11/2007<br></span></div></li> <li><div class="src-line"><a name="a420"></a><span class="src-doc"> * - added translation files and mechanism to instantiate the class with a language different from English<br></span></div></li> <li><div class="src-line"><a name="a421"></a><span class="src-doc"> * - added </span><span class="src-doc-inlinetag">{@link forbidden}</span><span class="src-doc"> to set an array of forbidden MIME types<br></span></div></li> <li><div class="src-line"><a name="a422"></a><span class="src-doc"> * - implemented support for simple wildcards in </span><span class="src-doc-inlinetag">{@link allowed}</span><span class="src-doc"> and </span><span class="src-doc-inlinetag">{@link forbidden}</span><span class="src-doc">, such as image/*<br></span></div></li> <li><div class="src-line"><a name="a423"></a><span class="src-doc"> * - preset the file extension to the desired conversion format when converting an image<br></span></div></li> <li><div class="src-line"><a name="a424"></a><span class="src-doc"> * - added read and write support for BMP images<br></span></div></li> <li><div class="src-line"><a name="a425"></a><span class="src-doc"> * - added a flag </span><span class="src-doc-inlinetag">{@link file_is_image}</span><span class="src-doc"> to determine if the file is a supported image type<br></span></div></li> <li><div class="src-line"><a name="a426"></a><span class="src-doc"> * - the class now provides some information about the image, before calling </span><span class="src-doc-inlinetag">{@link process}</span><span class="src-doc">(). Available are </span><span class="src-doc-inlinetag">{@link image_src_x}</span><span class="src-doc">, </span><span class="src-doc-inlinetag">{@link image_src_y}</span><span class="src-doc"> and the newly introduced </span><span class="src-doc-inlinetag">{@link image_src_bits}</span><span class="src-doc">, </span><span class="src-doc-inlinetag">{@link image_src_pixels}</span><span class="src-doc"> and </span><span class="src-doc-inlinetag">{@link image_src_type}</span><span class="src-doc">. Note that this will not work if <i>open_basedir</i> restrictions are in place<br></span></div></li> <li><div class="src-line"><a name="a427"></a><span class="src-doc"> * - improved logging; now provides useful system information<br></span></div></li> <li><div class="src-line"><a name="a428"></a><span class="src-doc"> * - added some more pre-processing checks for files that are images: </span><span class="src-doc-inlinetag">{@link image_max_width}</span><span class="src-doc">, </span><span class="src-doc-inlinetag">{@link image_max_height}</span><span class="src-doc">, </span><span class="src-doc-inlinetag">{@link image_max_pixels}</span><span class="src-doc">, </span><span class="src-doc-inlinetag">{@link image_max_ratio}</span><span class="src-doc">, </span><span class="src-doc-inlinetag">{@link image_min_width}</span><span class="src-doc">, </span><span class="src-doc-inlinetag">{@link image_min_height}</span><span class="src-doc">, </span><span class="src-doc-inlinetag">{@link image_min_pixels}</span><span class="src-doc"> and </span><span class="src-doc-inlinetag">{@link image_min_ratio}</span><span class="src-doc"><br></span></div></li> <li><div class="src-line"><a name="a429"></a><span class="src-doc"> * - added </span><span class="src-doc-inlinetag">{@link image_ratio_pixels}</span><span class="src-doc"> to resize an image to a number of pixels, keeping aspect ratio<br></span></div></li> <li><div class="src-line"><a name="a430"></a><span class="src-doc"> * - added </span><span class="src-doc-inlinetag">{@link image_is_palette}</span><span class="src-doc"> and </span><span class="src-doc-inlinetag">{@link image_is_transparent}</span><span class="src-doc"> and </span><span class="src-doc-inlinetag">{@link image_transparent_color}</span><span class="src-doc"> for GIF images<br></span></div></li> <li><div class="src-line"><a name="a431"></a><span class="src-doc"> * - added </span><span class="src-doc-inlinetag">{@link image_default_color}</span><span class="src-doc"> to define a fallback color for non alpha-transparent output formats, such as JPEG or BMP<br></span></div></li> <li><div class="src-line"><a name="a432"></a><span class="src-doc"> * - changed </span><span class="src-doc-inlinetag">{@link image_background_color}</span><span class="src-doc">, which now forces transparent areas to be painted<br></span></div></li> <li><div class="src-line"><a name="a433"></a><span class="src-doc"> * - improved reflections and color overlays so that it works with alpha transparent images<br></span></div></li> <li><div class="src-line"><a name="a434"></a><span class="src-doc"> * - </span><span class="src-doc-inlinetag">{@link image_reflection_color}</span><span class="src-doc"> is now deprecated in favour of </span><span class="src-doc-inlinetag">{@link image_default_color}</span><span class="src-doc"><br /></span></div></li> <li><div class="src-line"><a name="a435"></a><span class="src-doc"> * - transparent PNGs are now processed in true color, and fully preserving the alpha channel when doing merges<br></span></div></li> <li><div class="src-line"><a name="a436"></a><span class="src-doc"> * - transparent GIFs are now automatically detected. </span><span class="src-doc-inlinetag">{@link preserve_transparency}</span><span class="src-doc"> is deprecated<br></span></div></li> <li><div class="src-line"><a name="a437"></a><span class="src-doc"> * - transparent true color images can be saved as GIF while retaining transparency, semi transparent areas being merged with </span><span class="src-doc-inlinetag">{@link image_default_color}</span><span class="src-doc"><br></span></div></li> <li><div class="src-line"><a name="a438"></a><span class="src-doc"> * - transparent true color images can be saved as JPG/BMP with the semi transparent areas being merged with </span><span class="src-doc-inlinetag">{@link image_default_color}</span><span class="src-doc"><br></span></div></li> <li><div class="src-line"><a name="a439"></a><span class="src-doc"> * - fixed conversion of images to true color<br></span></div></li> <li><div class="src-line"><a name="a440"></a><span class="src-doc"> * - the class can now output the uploaded files content as the return value of process() if the function is called with an empty or null argumenti, or no argument</li></span></div></li> <li><div class="src-line"><a name="a441"></a><span class="src-doc"> * <li><b>v 0.24</b> 25/05/2007<br></span></div></li> <li><div class="src-line"><a name="a442"></a><span class="src-doc"> * - added </span><span class="src-doc-inlinetag">{@link image_background_color}</span><span class="src-doc">, to set the default background color of an image<br></span></div></li> <li><div class="src-line"><a name="a443"></a><span class="src-doc"> * - added possibility of using replacement tokens in text labels<br></span></div></li> <li><div class="src-line"><a name="a444"></a><span class="src-doc"> * - changed default JPEG quality to 85<br></span></div></li> <li><div class="src-line"><a name="a445"></a><span class="src-doc"> * - fixed a small bug when using greyscale filter and associated filters<br></span></div></li> <li><div class="src-line"><a name="a446"></a><span class="src-doc"> * - added </span><span class="src-doc-inlinetag">{@link image_ratio_fill}</span><span class="src-doc"> in order to fit an image within some dimensions and color the remaining space. Very similar to </span><span class="src-doc-inlinetag">{@link image_ratio_crop}</span><span class="src-doc"><br></span></div></li> <li><div class="src-line"><a name="a447"></a><span class="src-doc"> * - improved the recursive creation of directories<br></span></div></li> <li><div class="src-line"><a name="a448"></a><span class="src-doc"> * - the class now converts palette based images to true colors before doing graphic manipulations</li></span></div></li> <li><div class="src-line"><a name="a449"></a><span class="src-doc"> * <li><b>v 0.23</b> 23/12/2006<br></span></div></li> <li><div class="src-line"><a name="a450"></a><span class="src-doc"> * - fixed a bug when processing more than once the same uploaded file. If there is an open_basedir restriction, the class now creates a temporary file for the first call to process(). This file will be used for subsequent processes, and will be deleted upon calling clean()</li></span></div></li> <li><div class="src-line"><a name="a451"></a><span class="src-doc"> * <li><b>v 0.22</b> 16/12/2006<br></span></div></li> <li><div class="src-line"><a name="a452"></a><span class="src-doc"> * - added automatic creation of a temporary file if the upload directory is not within open_basedir<br></span></div></li> <li><div class="src-line"><a name="a453"></a><span class="src-doc"> * - fixed a bug which was preventing to work on a local file by overwriting it with its processed copy<br></span></div></li> <li><div class="src-line"><a name="a454"></a><span class="src-doc"> * - added MIME types video/x-ms-wmv and image/x-png and fixed PNG support for IE weird MIME types<br></span></div></li> <li><div class="src-line"><a name="a455"></a><span class="src-doc"> * - modified </span><span class="src-doc-inlinetag">{@link image_ratio_crop}</span><span class="src-doc"> so it can accept one or more from string 'TBLR', determining which side of the image is kept while cropping<br></span></div></li> <li><div class="src-line"><a name="a456"></a><span class="src-doc"> * - added support for multiple lines in the text, using "\n" as a line break<br></span></div></li> <li><div class="src-line"><a name="a457"></a><span class="src-doc"> * - added </span><span class="src-doc-inlinetag">{@link image_text_line_spacing}</span><span class="src-doc"> which allow to set the space between several lines of text<br></span></div></li> <li><div class="src-line"><a name="a458"></a><span class="src-doc"> * - added </span><span class="src-doc-inlinetag">{@link image_text_alignment}</span><span class="src-doc"> which allow to set the alignment when text has several lines<br></span></div></li> <li><div class="src-line"><a name="a459"></a><span class="src-doc"> * - </span><span class="src-doc-inlinetag">{@link image_text_font}</span><span class="src-doc"> can now be set to the path of a GDF font to load external fonts<br></span></div></li> <li><div class="src-line"><a name="a460"></a><span class="src-doc"> * - added </span><span class="src-doc-inlinetag">{@link image_reflection_height}</span><span class="src-doc"> to create a reflection of the source image, which height is in pixels or percentage<br></span></div></li> <li><div class="src-line"><a name="a461"></a><span class="src-doc"> * - added </span><span class="src-doc-inlinetag">{@link image_reflection_space}</span><span class="src-doc"> to set the space in pixels between the source image and the reflection<br></span></div></li> <li><div class="src-line"><a name="a462"></a><span class="src-doc"> * - added </span><span class="src-doc-inlinetag">{@link image_reflection_color}</span><span class="src-doc"> to set the reflection background color<br></span></div></li> <li><div class="src-line"><a name="a463"></a><span class="src-doc"> * - added </span><span class="src-doc-inlinetag">{@link image_reflection_opacity}</span><span class="src-doc"> to set the initial level of opacity of the reflection</li></span></div></li> <li><div class="src-line"><a name="a464"></a><span class="src-doc"> * <li><b>v 0.21</b> 30/09/2006<br></span></div></li> <li><div class="src-line"><a name="a465"></a><span class="src-doc"> * - added </span><span class="src-doc-inlinetag">{@link image_ratio_crop}</span><span class="src-doc"> which resizes within </span><span class="src-doc-inlinetag">{@link image_x}</span><span class="src-doc"> and </span><span class="src-doc-inlinetag">{@link image_y}</span><span class="src-doc">, keeping ratio, but filling the space by cropping excedent of image<br></span></div></li> <li><div class="src-line"><a name="a466"></a><span class="src-doc"> * - added </span><span class="src-doc-inlinetag">{@link mime_check}</span><span class="src-doc">, which default is true, to set checks against </span><span class="src-doc-inlinetag">{@link allowed}</span><span class="src-doc"> MIME list<br></span></div></li> <li><div class="src-line"><a name="a467"></a><span class="src-doc"> * - if MIME is empty, the class now triggers an error<br></span></div></li> <li><div class="src-line"><a name="a468"></a><span class="src-doc"> * - color #000000 is OK for </span><span class="src-doc-inlinetag">{@link image_text_color}</span><span class="src-doc">, and related text transparency bug fixed<br></span></div></li> <li><div class="src-line"><a name="a469"></a><span class="src-doc"> * - </span><span class="src-doc-inlinetag">{@link gd_version}</span><span class="src-doc">() now uses gd_info(), or else phpinfo()<br></span></div></li> <li><div class="src-line"><a name="a470"></a><span class="src-doc"> * - fixed path issue when the destination path has no trailing slash on Windows systems <br></span></div></li> <li><div class="src-line"><a name="a471"></a><span class="src-doc"> * - removed inline functions to be fully PHP5 compatible </li></span></div></li> <li><div class="src-line"><a name="a472"></a><span class="src-doc"> * <li><b>v 0.20</b> 11/08/2006<br></span></div></li> <li><div class="src-line"><a name="a473"></a><span class="src-doc"> * - added some more error checking and messages (GD presence, permissions...)<br></span></div></li> <li><div class="src-line"><a name="a474"></a><span class="src-doc"> * - fix when uploading files without extension<br></span></div></li> <li><div class="src-line"><a name="a475"></a><span class="src-doc"> * - changed values for </span><span class="src-doc-inlinetag">{@link image_brightness}</span><span class="src-doc"> and </span><span class="src-doc-inlinetag">{@link image_contrast}</span><span class="src-doc"> to be between -127 and 127<br></span></div></li> <li><div class="src-line"><a name="a476"></a><span class="src-doc"> * - added </span><span class="src-doc-inlinetag">{@link dir_auto_create}</span><span class="src-doc"> to automatically and recursively create destination directory if missing.<br></span></div></li> <li><div class="src-line"><a name="a477"></a><span class="src-doc"> * - added </span><span class="src-doc-inlinetag">{@link dir_auto_chmod}</span><span class="src-doc"> to automatically chmod the destination directory if not writeable.<br></span></div></li> <li><div class="src-line"><a name="a478"></a><span class="src-doc"> * - added </span><span class="src-doc-inlinetag">{@link dir_chmod}</span><span class="src-doc"> to set the default chmod to use.<br></span></div></li> <li><div class="src-line"><a name="a479"></a><span class="src-doc"> * - added </span><span class="src-doc-inlinetag">{@link image_crop}</span><span class="src-doc"> to crop images<br></span></div></li> <li><div class="src-line"><a name="a480"></a><span class="src-doc"> * - added </span><span class="src-doc-inlinetag">{@link image_negative}</span><span class="src-doc"> to invert the colors on the image<br></span></div></li> <li><div class="src-line"><a name="a481"></a><span class="src-doc"> * - added </span><span class="src-doc-inlinetag">{@link image_greyscale}</span><span class="src-doc"> to turn the image into greyscale<br></span></div></li> <li><div class="src-line"><a name="a482"></a><span class="src-doc"> * - added </span><span class="src-doc-inlinetag">{@link image_threshold}</span><span class="src-doc"> to apply a threshold filter on the image<br></span></div></li> <li><div class="src-line"><a name="a483"></a><span class="src-doc"> * - added </span><span class="src-doc-inlinetag">{@link image_bevel}</span><span class="src-doc">, </span><span class="src-doc-inlinetag">{@link image_bevel_color1}</span><span class="src-doc"> and </span><span class="src-doc-inlinetag">{@link image_bevel_color2}</span><span class="src-doc"> to add a bevel border<br></span></div></li> <li><div class="src-line"><a name="a484"></a><span class="src-doc"> * - added </span><span class="src-doc-inlinetag">{@link image_border}</span><span class="src-doc"> and </span><span class="src-doc-inlinetag">{@link image_border_color}</span><span class="src-doc"> to add a single color border<br></span></div></li> <li><div class="src-line"><a name="a485"></a><span class="src-doc"> * - added </span><span class="src-doc-inlinetag">{@link image_frame}</span><span class="src-doc"> and </span><span class="src-doc-inlinetag">{@link image_frame_colors}</span><span class="src-doc"> to add a multicolored frame</li></span></div></li> <li><div class="src-line"><a name="a486"></a><span class="src-doc"> * <li><b>v 0.19</b> 29/03/2006<br></span></div></li> <li><div class="src-line"><a name="a487"></a><span class="src-doc"> * - class is now compatible i18n (thanks Sylwester).<br></span></div></li> <li><div class="src-line"><a name="a488"></a><span class="src-doc"> * - the class can mow manipulate local files, not only uploaded files (instanciate the class with a local filename).<br></span></div></li> <li><div class="src-line"><a name="a489"></a><span class="src-doc"> * - </span><span class="src-doc-inlinetag">{@link file_safe_name}</span><span class="src-doc"> has been improved a bit.<br></span></div></li> <li><div class="src-line"><a name="a490"></a><span class="src-doc"> * - added </span><span class="src-doc-inlinetag">{@link image_brightness}</span><span class="src-doc">, </span><span class="src-doc-inlinetag">{@link image_contrast}</span><span class="src-doc">, </span><span class="src-doc-inlinetag">{@link image_tint_color}</span><span class="src-doc">, </span><span class="src-doc-inlinetag">{@link image_overlay_color}</span><span class="src-doc"> and </span><span class="src-doc-inlinetag">{@link image_overlay_percent}</span><span class="src-doc"> to do color manipulation on the images.<br></span></div></li> <li><div class="src-line"><a name="a491"></a><span class="src-doc"> * - added </span><span class="src-doc-inlinetag">{@link image_text}</span><span class="src-doc"> and all derivated settings to add a text label on the image.<br></span></div></li> <li><div class="src-line"><a name="a492"></a><span class="src-doc"> * - added </span><span class="src-doc-inlinetag">{@link image_watermark}</span><span class="src-doc"> and all derivated settings to add a watermark image on the image.<br></span></div></li> <li><div class="src-line"><a name="a493"></a><span class="src-doc"> * - added </span><span class="src-doc-inlinetag">{@link image_flip}</span><span class="src-doc"> and </span><span class="src-doc-inlinetag">{@link image_rotate}</span><span class="src-doc"> for more image manipulations<br></span></div></li> <li><div class="src-line"><a name="a494"></a><span class="src-doc"> * - added </span><span class="src-doc-inlinetag">{@link jpeg_size}</span><span class="src-doc"> to calculate the JPG compression quality in order to fit within one filesize.</li></span></div></li> <li><div class="src-line"><a name="a495"></a><span class="src-doc"> * <li><b>v 0.18</b> 02/02/2006<br></span></div></li> <li><div class="src-line"><a name="a496"></a><span class="src-doc"> * - added </span><span class="src-doc-inlinetag">{@link no_script}</span><span class="src-doc"> to turn dangerous scripts into text files.<br></span></div></li> <li><div class="src-line"><a name="a497"></a><span class="src-doc"> * - added </span><span class="src-doc-inlinetag">{@link mime_magic_check}</span><span class="src-doc"> to set the class to use mime_magic.<br></span></div></li> <li><div class="src-line"><a name="a498"></a><span class="src-doc"> * - added </span><span class="src-doc-inlinetag">{@link preserve_transparency}</span><span class="src-doc"> *experimental*. Thanks Gregor.<br></span></div></li> <li><div class="src-line"><a name="a499"></a><span class="src-doc"> * - fixed size and mime checking, wasn't working :/ Thanks Willem.<br></span></div></li> <li><div class="src-line"><a name="a500"></a><span class="src-doc"> * - fixed memory leak when resizing images.<br></span></div></li> <li><div class="src-line"><a name="a501"></a><span class="src-doc"> * - when resizing, it is not necessary anymore to set </span><span class="src-doc-inlinetag">{@link image_convert}</span><span class="src-doc">.<br></span></div></li> <li><div class="src-line"><a name="a502"></a><span class="src-doc"> * - il is now possible to simply convert an image, with no resizing.<br></span></div></li> <li><div class="src-line"><a name="a503"></a><span class="src-doc"> * - sets the default </span><span class="src-doc-inlinetag">{@link file_max_size}</span><span class="src-doc"> to upload_max_filesize from php.ini. Thanks Edward</li></span></div></li> <li><div class="src-line"><a name="a504"></a><span class="src-doc"> * <li><b>v 0.17</b> 28/05/2005<br></span></div></li> <li><div class="src-line"><a name="a505"></a><span class="src-doc"> * - the class can be used with any version of GD.<br></span></div></li> <li><div class="src-line"><a name="a506"></a><span class="src-doc"> * - added security check on the file with a list of mime-types.<br></span></div></li> <li><div class="src-line"><a name="a507"></a><span class="src-doc"> * - changed the license to GPL v2 only</li></span></div></li> <li><div class="src-line"><a name="a508"></a><span class="src-doc"> * <li><b>v 0.16</b> 19/05/2005<br></span></div></li> <li><div class="src-line"><a name="a509"></a><span class="src-doc"> * - added </span><span class="src-doc-inlinetag">{@link file_auto_rename}</span><span class="src-doc"> automatic file renaming if the same filename already exists.<br></span></div></li> <li><div class="src-line"><a name="a510"></a><span class="src-doc"> * - added </span><span class="src-doc-inlinetag">{@link file_safe_name}</span><span class="src-doc"> safe formatting of the filename (spaces to _underscores so far).<br></span></div></li> <li><div class="src-line"><a name="a511"></a><span class="src-doc"> * - added some more error reporting to avoid crash if GD is not present</li></span></div></li> <li><div class="src-line"><a name="a512"></a><span class="src-doc"> * <li><b>v 0.15</b> 16/04/2005<br></span></div></li> <li><div class="src-line"><a name="a513"></a><span class="src-doc"> * - added JPEG compression quality setting. Thanks Vad</li></span></div></li> <li><div class="src-line"><a name="a514"></a><span class="src-doc"> * <li><b>v 0.14</b> 14/03/2005<br></span></div></li> <li><div class="src-line"><a name="a515"></a><span class="src-doc"> * - reworked the class file to allow parsing with phpDocumentor</li></span></div></li> <li><div class="src-line"><a name="a516"></a><span class="src-doc"> * <li><b>v 0.13</b> 07/03/2005<br></span></div></li> <li><div class="src-line"><a name="a517"></a><span class="src-doc"> * - fixed a bug with </span><span class="src-doc-inlinetag">{@link image_ratio}</span><span class="src-doc">. Thanks Justin.<br></span></div></li> <li><div class="src-line"><a name="a518"></a><span class="src-doc"> * - added </span><span class="src-doc-inlinetag">{@link image_ratio_no_zoom_in}</span><span class="src-doc"> and </span><span class="src-doc-inlinetag">{@link image_ratio_no_zoom_out}</span><span class="src-doc"> </li></span></div></li> <li><div class="src-line"><a name="a519"></a><span class="src-doc"> * <li><b>v 0.12</b> 21/01/2005<br></span></div></li> <li><div class="src-line"><a name="a520"></a><span class="src-doc"> * - added </span><span class="src-doc-inlinetag">{@link image_ratio}</span><span class="src-doc"> to resize within max values, keeping image ratio</li></span></div></li> <li><div class="src-line"><a name="a521"></a><span class="src-doc"> * <li><b>v 0.11</b> 22/08/2003<br></span></div></li> <li><div class="src-line"><a name="a522"></a><span class="src-doc"> * - update for GD2 (changed imageresized() into imagecopyresampled() and imagecreate() into imagecreatetruecolor())</li></span></div></li> <li><div class="src-line"><a name="a523"></a><span class="src-doc"> * </ul></span></div></li> <li><div class="src-line"><a name="a524"></a><span class="src-doc"> *</span></div></li> <li><div class="src-line"><a name="a525"></a><span class="src-doc"> * </span><span class="src-doc-coretag">@package</span><span class="src-doc"> cmf</span></div></li> <li><div class="src-line"><a name="a526"></a><span class="src-doc"> * </span><span class="src-doc-coretag">@subpackage</span><span class="src-doc"> external</span></div></li> <li><div class="src-line"><a name="a527"></a><span class="src-doc"> */</span></div></li> <li><div class="src-line"><a name="a528"></a><span class="src-key">class </span><a href="class.upload.html">upload</a> <span class="src-sym">{</span></div></li> <li><div class="src-line"><a name="a529"></a> </div></li> <li><div class="src-line"><a name="a530"></a> </div></li> <li><div class="src-line"><a name="a531"></a> <span class="src-doc">/**</span></div></li> <li><div class="src-line"><a name="a532"></a><span class="src-doc"> * Class version</span></div></li> <li><div class="src-line"><a name="a533"></a><span class="src-doc"> *</span></div></li> <li><div class="src-line"><a name="a534"></a><span class="src-doc"> * </span><span class="src-doc-coretag">@access</span><span class="src-doc"> public</span></div></li> <li><div class="src-line"><a name="a535"></a><span class="src-doc"> * </span><span class="src-doc-coretag">@var </span><span class="src-doc-type">string </span></div></li> <li><div class="src-line"><a name="a536"></a><span class="src-doc"> */</span></div></li> <li><div class="src-line"><a name="a537"></a> <span class="src-key">var </span><a href="class.upload.html#var$version">$version</a><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a538"></a> </div></li> <li><div class="src-line"><a name="a539"></a> <span class="src-doc">/**</span></div></li> <li><div class="src-line"><a name="a540"></a><span class="src-doc"> * Uploaded file name</span></div></li> <li><div class="src-line"><a name="a541"></a><span class="src-doc"> *</span></div></li> <li><div class="src-line"><a name="a542"></a><span class="src-doc"> * </span><span class="src-doc-coretag">@access</span><span class="src-doc"> public</span></div></li> <li><div class="src-line"><a name="a543"></a><span class="src-doc"> * </span><span class="src-doc-coretag">@var </span><span class="src-doc-type">string </span></div></li> <li><div class="src-line"><a name="a544"></a><span class="src-doc"> */</span></div></li> <li><div class="src-line"><a name="a545"></a> <span class="src-key">var </span><a href="class.upload.html#var$file_src_name">$file_src_name</a><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a546"></a> </div></li> <li><div class="src-line"><a name="a547"></a> <span class="src-doc">/**</span></div></li> <li><div class="src-line"><a name="a548"></a><span class="src-doc"> * Uploaded file name body (i.e. without extension)</span></div></li> <li><div class="src-line"><a name="a549"></a><span class="src-doc"> *</span></div></li> <li><div class="src-line"><a name="a550"></a><span class="src-doc"> * </span><span class="src-doc-coretag">@access</span><span class="src-doc"> public</span></div></li> <li><div class="src-line"><a name="a551"></a><span class="src-doc"> * </span><span class="src-doc-coretag">@var </span><span class="src-doc-type">string </span></div></li> <li><div class="src-line"><a name="a552"></a><span class="src-doc"> */</span></div></li> <li><div class="src-line"><a name="a553"></a> <span class="src-key">var </span><a href="class.upload.html#var$file_src_name_body">$file_src_name_body</a><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a554"></a> </div></li> <li><div class="src-line"><a name="a555"></a> <span class="src-doc">/**</span></div></li> <li><div class="src-line"><a name="a556"></a><span class="src-doc"> * Uploaded file name extension</span></div></li> <li><div class="src-line"><a name="a557"></a><span class="src-doc"> *</span></div></li> <li><div class="src-line"><a name="a558"></a><span class="src-doc"> * </span><span class="src-doc-coretag">@access</span><span class="src-doc"> public</span></div></li> <li><div class="src-line"><a name="a559"></a><span class="src-doc"> * </span><span class="src-doc-coretag">@var </span><span class="src-doc-type">string </span></div></li> <li><div class="src-line"><a name="a560"></a><span class="src-doc"> */</span></div></li> <li><div class="src-line"><a name="a561"></a> <span class="src-key">var </span><a href="class.upload.html#var$file_src_name_ext">$file_src_name_ext</a><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a562"></a> </div></li> <li><div class="src-line"><a name="a563"></a> <span class="src-doc">/**</span></div></li> <li><div class="src-line"><a name="a564"></a><span class="src-doc"> * Uploaded file MIME type</span></div></li> <li><div class="src-line"><a name="a565"></a><span class="src-doc"> *</span></div></li> <li><div class="src-line"><a name="a566"></a><span class="src-doc"> * </span><span class="src-doc-coretag">@access</span><span class="src-doc"> public</span></div></li> <li><div class="src-line"><a name="a567"></a><span class="src-doc"> * </span><span class="src-doc-coretag">@var </span><span class="src-doc-type">string </span></div></li> <li><div class="src-line"><a name="a568"></a><span class="src-doc"> */</span></div></li> <li><div class="src-line"><a name="a569"></a> <span class="src-key">var </span><a href="class.upload.html#var$file_src_mime">$file_src_mime</a><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a570"></a> </div></li> <li><div class="src-line"><a name="a571"></a> <span class="src-doc">/**</span></div></li> <li><div class="src-line"><a name="a572"></a><span class="src-doc"> * Uploaded file size, in bytes</span></div></li> <li><div class="src-line"><a name="a573"></a><span class="src-doc"> *</span></div></li> <li><div class="src-line"><a name="a574"></a><span class="src-doc"> * </span><span class="src-doc-coretag">@access</span><span class="src-doc"> public</span></div></li> <li><div class="src-line"><a name="a575"></a><span class="src-doc"> * </span><span class="src-doc-coretag">@var </span><span class="src-doc-type">double </span></div></li> <li><div class="src-line"><a name="a576"></a><span class="src-doc"> */</span></div></li> <li><div class="src-line"><a name="a577"></a> <span class="src-key">var </span><a href="class.upload.html#var$file_src_size">$file_src_size</a><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a578"></a> </div></li> <li><div class="src-line"><a name="a579"></a> <span class="src-doc">/**</span></div></li> <li><div class="src-line"><a name="a580"></a><span class="src-doc"> * Holds eventual PHP error code from $_FILES</span></div></li> <li><div class="src-line"><a name="a581"></a><span class="src-doc"> *</span></div></li> <li><div class="src-line"><a name="a582"></a><span class="src-doc"> * </span><span class="src-doc-coretag">@access</span><span class="src-doc"> public</span></div></li> <li><div class="src-line"><a name="a583"></a><span class="src-doc"> * </span><span class="src-doc-coretag">@var </span><span class="src-doc-type">string </span></div></li> <li><div class="src-line"><a name="a584"></a><span class="src-doc"> */</span></div></li> <li><div class="src-line"><a name="a585"></a> <span class="src-key">var </span><a href="class.upload.html#var$file_src_error">$file_src_error</a><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a586"></a> </div></li> <li><div class="src-line"><a name="a587"></a> <span class="src-doc">/**</span></div></li> <li><div class="src-line"><a name="a588"></a><span class="src-doc"> * Uloaded file name, including server path</span></div></li> <li><div class="src-line"><a name="a589"></a><span class="src-doc"> *</span></div></li> <li><div class="src-line"><a name="a590"></a><span class="src-doc"> * </span><span class="src-doc-coretag">@access</span><span class="src-doc"> private</span></div></li> <li><div class="src-line"><a name="a591"></a><span class="src-doc"> * </span><span class="src-doc-coretag">@var </span><span class="src-doc-type">string </span></div></li> <li><div class="src-line"><a name="a592"></a><span class="src-doc"> */</span></div></li> <li><div class="src-line"><a name="a593"></a> <span class="src-key">var </span><span class="src-var">$file_src_pathname</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a594"></a> </div></li> <li><div class="src-line"><a name="a595"></a> <span class="src-doc">/**</span></div></li> <li><div class="src-line"><a name="a596"></a><span class="src-doc"> * Uloaded file name temporary copy</span></div></li> <li><div class="src-line"><a name="a597"></a><span class="src-doc"> *</span></div></li> <li><div class="src-line"><a name="a598"></a><span class="src-doc"> * </span><span class="src-doc-coretag">@access</span><span class="src-doc"> private</span></div></li> <li><div class="src-line"><a name="a599"></a><span class="src-doc"> * </span><span class="src-doc-coretag">@var </span><span class="src-doc-type">string </span></div></li> <li><div class="src-line"><a name="a600"></a><span class="src-doc"> */</span></div></li> <li><div class="src-line"><a name="a601"></a> <span class="src-key">var </span><span class="src-var">$file_src_temp</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a602"></a> </div></li> <li><div class="src-line"><a name="a603"></a> <span class="src-doc">/**</span></div></li> <li><div class="src-line"><a name="a604"></a><span class="src-doc"> * Destination file name</span></div></li> <li><div class="src-line"><a name="a605"></a><span class="src-doc"> *</span></div></li> <li><div class="src-line"><a name="a606"></a><span class="src-doc"> * </span><span class="src-doc-coretag">@access</span><span class="src-doc"> private</span></div></li> <li><div class="src-line"><a name="a607"></a><span class="src-doc"> * </span><span class="src-doc-coretag">@var </span><span class="src-doc-type">string </span></div></li> <li><div class="src-line"><a name="a608"></a><span class="src-doc"> */</span></div></li> <li><div class="src-line"><a name="a609"></a> <span class="src-key">var </span><span class="src-var">$file_dst_path</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a610"></a> </div></li> <li><div class="src-line"><a name="a611"></a> <span class="src-doc">/**</span></div></li> <li><div class="src-line"><a name="a612"></a><span class="src-doc"> * Destination file name</span></div></li> <li><div class="src-line"><a name="a613"></a><span class="src-doc"> *</span></div></li> <li><div class="src-line"><a name="a614"></a><span class="src-doc"> * </span><span class="src-doc-coretag">@access</span><span class="src-doc"> public</span></div></li> <li><div class="src-line"><a name="a615"></a><span class="src-doc"> * </span><span class="src-doc-coretag">@var </span><span class="src-doc-type">string </span></div></li> <li><div class="src-line"><a name="a616"></a><span class="src-doc"> */</span></div></li> <li><div class="src-line"><a name="a617"></a> <span class="src-key">var </span><a href="class.upload.html#var$file_dst_name">$file_dst_name</a><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a618"></a> </div></li> <li><div class="src-line"><a name="a619"></a> <span class="src-doc">/**</span></div></li> <li><div class="src-line"><a name="a620"></a><span class="src-doc"> * Destination file name body (i.e. without extension)</span></div></li> <li><div class="src-line"><a name="a621"></a><span class="src-doc"> *</span></div></li> <li><div class="src-line"><a name="a622"></a><span class="src-doc"> * </span><span class="src-doc-coretag">@access</span><span class="src-doc"> public</span></div></li> <li><div class="src-line"><a name="a623"></a><span class="src-doc"> * </span><span class="src-doc-coretag">@var </span><span class="src-doc-type">string </span></div></li> <li><div class="src-line"><a name="a624"></a><span class="src-doc"> */</span></div></li> <li><div class="src-line"><a name="a625"></a> <span class="src-key">var </span><a href="class.upload.html#var$file_dst_name_body">$file_dst_name_body</a><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a626"></a> </div></li> <li><div class="src-line"><a name="a627"></a> <span class="src-doc">/**</span></div></li> <li><div class="src-line"><a name="a628"></a><span class="src-doc"> * Destination file extension</span></div></li> <li><div class="src-line"><a name="a629"></a><span class="src-doc"> *</span></div></li> <li><div class="src-line"><a name="a630"></a><span class="src-doc"> * </span><span class="src-doc-coretag">@access</span><span class="src-doc"> public</span></div></li> <li><div class="src-line"><a name="a631"></a><span class="src-doc"> * </span><span class="src-doc-coretag">@var </span><span class="src-doc-type">string </span></div></li> <li><div class="src-line"><a name="a632"></a><span class="src-doc"> */</span></div></li> <li><div class="src-line"><a name="a633"></a> <span class="src-key">var </span><a href="class.upload.html#var$file_dst_name_ext">$file_dst_name_ext</a><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a634"></a> </div></li> <li><div class="src-line"><a name="a635"></a> <span class="src-doc">/**</span></div></li> <li><div class="src-line"><a name="a636"></a><span class="src-doc"> * Destination file name, including path</span></div></li> <li><div class="src-line"><a name="a637"></a><span class="src-doc"> *</span></div></li> <li><div class="src-line"><a name="a638"></a><span class="src-doc"> * </span><span class="src-doc-coretag">@access</span><span class="src-doc"> private</span></div></li> <li><div class="src-line"><a name="a639"></a><span class="src-doc"> * </span><span class="src-doc-coretag">@var </span><span class="src-doc-type">string </span></div></li> <li><div class="src-line"><a name="a640"></a><span class="src-doc"> */</span></div></li> <li><div class="src-line"><a name="a641"></a> <span class="src-key">var </span><span class="src-var">$file_dst_pathname</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a642"></a> </div></li> <li><div class="src-line"><a name="a643"></a> <span class="src-doc">/**</span></div></li> <li><div class="src-line"><a name="a644"></a><span class="src-doc"> * Source image width</span></div></li> <li><div class="src-line"><a name="a645"></a><span class="src-doc"> *</span></div></li> <li><div class="src-line"><a name="a646"></a><span class="src-doc"> * </span><span class="src-doc-coretag">@access</span><span class="src-doc"> private</span></div></li> <li><div class="src-line"><a name="a647"></a><span class="src-doc"> * </span><span class="src-doc-coretag">@var </span><span class="src-doc-type">integer </span></div></li> <li><div class="src-line"><a name="a648"></a><span class="src-doc"> */</span></div></li> <li><div class="src-line"><a name="a649"></a> <span class="src-key">var </span><span class="src-var">$image_src_x</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a650"></a> </div></li> <li><div class="src-line"><a name="a651"></a> <span class="src-doc">/**</span></div></li> <li><div class="src-line"><a name="a652"></a><span class="src-doc"> * Source image height</span></div></li> <li><div class="src-line"><a name="a653"></a><span class="src-doc"> *</span></div></li> <li><div class="src-line"><a name="a654"></a><span class="src-doc"> * </span><span class="src-doc-coretag">@access</span><span class="src-doc"> private</span></div></li> <li><div class="src-line"><a name="a655"></a><span class="src-doc"> * </span><span class="src-doc-coretag">@var </span><span class="src-doc-type">integer </span></div></li> <li><div class="src-line"><a name="a656"></a><span class="src-doc"> */</span></div></li> <li><div class="src-line"><a name="a657"></a> <span class="src-key">var </span><span class="src-var">$image_src_y</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a658"></a> </div></li> <li><div class="src-line"><a name="a659"></a> <span class="src-doc">/**</span></div></li> <li><div class="src-line"><a name="a660"></a><span class="src-doc"> * Source image color depth</span></div></li> <li><div class="src-line"><a name="a661"></a><span class="src-doc"> *</span></div></li> <li><div class="src-line"><a name="a662"></a><span class="src-doc"> * </span><span class="src-doc-coretag">@access</span><span class="src-doc"> private</span></div></li> <li><div class="src-line"><a name="a663"></a><span class="src-doc"> * </span><span class="src-doc-coretag">@var </span><span class="src-doc-type">integer </span></div></li> <li><div class="src-line"><a name="a664"></a><span class="src-doc"> */</span></div></li> <li><div class="src-line"><a name="a665"></a> <span class="src-key">var </span><span class="src-var">$image_src_bits</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a666"></a> </div></li> <li><div class="src-line"><a name="a667"></a> <span class="src-doc">/**</span></div></li> <li><div class="src-line"><a name="a668"></a><span class="src-doc"> * Number of pixels</span></div></li> <li><div class="src-line"><a name="a669"></a><span class="src-doc"> *</span></div></li> <li><div class="src-line"><a name="a670"></a><span class="src-doc"> * </span><span class="src-doc-coretag">@access</span><span class="src-doc"> private</span></div></li> <li><div class="src-line"><a name="a671"></a><span class="src-doc"> * </span><span class="src-doc-coretag">@var </span><span class="src-doc-type">long </span></div></li> <li><div class="src-line"><a name="a672"></a><span class="src-doc"> */</span></div></li> <li><div class="src-line"><a name="a673"></a> <span class="src-key">var </span><span class="src-var">$image_src_pixels</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a674"></a> </div></li> <li><div class="src-line"><a name="a675"></a> <span class="src-doc">/**</span></div></li> <li><div class="src-line"><a name="a676"></a><span class="src-doc"> * Type of image (png, gif, jpg or bmp)</span></div></li> <li><div class="src-line"><a name="a677"></a><span class="src-doc"> *</span></div></li> <li><div class="src-line"><a name="a678"></a><span class="src-doc"> * </span><span class="src-doc-coretag">@access</span><span class="src-doc"> private</span></div></li> <li><div class="src-line"><a name="a679"></a><span class="src-doc"> * </span><span class="src-doc-coretag">@var </span><span class="src-doc-type">string </span></div></li> <li><div class="src-line"><a name="a680"></a><span class="src-doc"> */</span></div></li> <li><div class="src-line"><a name="a681"></a> <span class="src-key">var </span><span class="src-var">$image_src_type</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a682"></a> </div></li> <li><div class="src-line"><a name="a683"></a> <span class="src-doc">/**</span></div></li> <li><div class="src-line"><a name="a684"></a><span class="src-doc"> * Destination image width</span></div></li> <li><div class="src-line"><a name="a685"></a><span class="src-doc"> *</span></div></li> <li><div class="src-line"><a name="a686"></a><span class="src-doc"> * </span><span class="src-doc-coretag">@access</span><span class="src-doc"> private</span></div></li> <li><div class="src-line"><a name="a687"></a><span class="src-doc"> * </span><span class="src-doc-coretag">@var </span><span class="src-doc-type">integer </span></div></li> <li><div class="src-line"><a name="a688"></a><span class="src-doc"> */</span></div></li> <li><div class="src-line"><a name="a689"></a> <span class="src-key">var </span><span class="src-var">$image_dst_x</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a690"></a> </div></li> <li><div class="src-line"><a name="a691"></a> <span class="src-doc">/**</span></div></li> <li><div class="src-line"><a name="a692"></a><span class="src-doc"> * Destination image height</span></div></li> <li><div class="src-line"><a name="a693"></a><span class="src-doc"> *</span></div></li> <li><div class="src-line"><a name="a694"></a><span class="src-doc"> * </span><span class="src-doc-coretag">@access</span><span class="src-doc"> private</span></div></li> <li><div class="src-line"><a name="a695"></a><span class="src-doc"> * </span><span class="src-doc-coretag">@var </span><span class="src-doc-type">integer </span></div></li> <li><div class="src-line"><a name="a696"></a><span class="src-doc"> */</span></div></li> <li><div class="src-line"><a name="a697"></a> <span class="src-key">var </span><span class="src-var">$image_dst_y</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a698"></a> </div></li> <li><div class="src-line"><a name="a699"></a> <span class="src-doc">/**</span></div></li> <li><div class="src-line"><a name="a700"></a><span class="src-doc"> * Supported image formats</span></div></li> <li><div class="src-line"><a name="a701"></a><span class="src-doc"> *</span></div></li> <li><div class="src-line"><a name="a702"></a><span class="src-doc"> * </span><span class="src-doc-coretag">@access</span><span class="src-doc"> private</span></div></li> <li><div class="src-line"><a name="a703"></a><span class="src-doc"> * </span><span class="src-doc-coretag">@var </span><span class="src-doc-type">array </span></div></li> <li><div class="src-line"><a name="a704"></a><span class="src-doc"> */</span></div></li> <li><div class="src-line"><a name="a705"></a> <span class="src-key">var </span><span class="src-var">$image_supported</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a706"></a> </div></li> <li><div class="src-line"><a name="a707"></a> <span class="src-doc">/**</span></div></li> <li><div class="src-line"><a name="a708"></a><span class="src-doc"> * Flag to determine if the source file is an image</span></div></li> <li><div class="src-line"><a name="a709"></a><span class="src-doc"> *</span></div></li> <li><div class="src-line"><a name="a710"></a><span class="src-doc"> * </span><span class="src-doc-coretag">@access</span><span class="src-doc"> private</span></div></li> <li><div class="src-line"><a name="a711"></a><span class="src-doc"> * </span><span class="src-doc-coretag">@var </span><span class="src-doc-type">boolean </span></div></li> <li><div class="src-line"><a name="a712"></a><span class="src-doc"> */</span></div></li> <li><div class="src-line"><a name="a713"></a> <span class="src-key">var </span><span class="src-var">$file_is_image</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a714"></a> </div></li> <li><div class="src-line"><a name="a715"></a> <span class="src-doc">/**</span></div></li> <li><div class="src-line"><a name="a716"></a><span class="src-doc"> * Flag set after instanciating the class</span></div></li> <li><div class="src-line"><a name="a717"></a><span class="src-doc"> *</span></div></li> <li><div class="src-line"><a name="a718"></a><span class="src-doc"> * Indicates if the file has been uploaded properly</span></div></li> <li><div class="src-line"><a name="a719"></a><span class="src-doc"> *</span></div></li> <li><div class="src-line"><a name="a720"></a><span class="src-doc"> * </span><span class="src-doc-coretag">@access</span><span class="src-doc"> public</span></div></li> <li><div class="src-line"><a name="a721"></a><span class="src-doc"> * </span><span class="src-doc-coretag">@var </span><span class="src-doc-type">bool </span></div></li> <li><div class="src-line"><a name="a722"></a><span class="src-doc"> */</span></div></li> <li><div class="src-line"><a name="a723"></a> <span class="src-key">var </span><a href="class.upload.html#var$uploaded">$uploaded</a><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a724"></a> </div></li> <li><div class="src-line"><a name="a725"></a> <span class="src-doc">/**</span></div></li> <li><div class="src-line"><a name="a726"></a><span class="src-doc"> * Flag stopping PHP upload checks</span></div></li> <li><div class="src-line"><a name="a727"></a><span class="src-doc"> *</span></div></li> <li><div class="src-line"><a name="a728"></a><span class="src-doc"> * Indicates whether we instanciated the class with a filename, in which case</span></div></li> <li><div class="src-line"><a name="a729"></a><span class="src-doc"> * we will not check on the validity of the PHP *upload*</span></div></li> <li><div class="src-line"><a name="a730"></a><span class="src-doc"> *</span></div></li> <li><div class="src-line"><a name="a731"></a><span class="src-doc"> * This flag is automatically set to true when working on a local file</span></div></li> <li><div class="src-line"><a name="a732"></a><span class="src-doc"> *</span></div></li> <li><div class="src-line"><a name="a733"></a><span class="src-doc"> * Warning: for uploads, this flag MUST be set to false for security reason</span></div></li> <li><div class="src-line"><a name="a734"></a><span class="src-doc"> *</span></div></li> <li><div class="src-line"><a name="a735"></a><span class="src-doc"> * </span><span class="src-doc-coretag">@access</span><span class="src-doc"> public</span></div></li> <li><div class="src-line"><a name="a736"></a><span class="src-doc"> * </span><span class="src-doc-coretag">@var </span><span class="src-doc-type">bool </span></div></li> <li><div class="src-line"><a name="a737"></a><span class="src-doc"> */</span></div></li> <li><div class="src-line"><a name="a738"></a> <span class="src-key">var </span><a href="class.upload.html#var$no_upload_check">$no_upload_check</a><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a739"></a> </div></li> <li><div class="src-line"><a name="a740"></a> <span class="src-doc">/**</span></div></li> <li><div class="src-line"><a name="a741"></a><span class="src-doc"> * Flag set after calling a process</span></div></li> <li><div class="src-line"><a name="a742"></a><span class="src-doc"> *</span></div></li> <li><div class="src-line"><a name="a743"></a><span class="src-doc"> * Indicates if the processing, and copy of the resulting file went OK</span></div></li> <li><div class="src-line"><a name="a744"></a><span class="src-doc"> *</span></div></li> <li><div class="src-line"><a name="a745"></a><span class="src-doc"> * </span><span class="src-doc-coretag">@access</span><span class="src-doc"> public</span></div></li> <li><div class="src-line"><a name="a746"></a><span class="src-doc"> * </span><span class="src-doc-coretag">@var </span><span class="src-doc-type">bool </span></div></li> <li><div class="src-line"><a name="a747"></a><span class="src-doc"> */</span></div></li> <li><div class="src-line"><a name="a748"></a> <span class="src-key">var </span><a href="class.upload.html#var$processed">$processed</a><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a749"></a> </div></li> <li><div class="src-line"><a name="a750"></a> <span class="src-doc">/**</span></div></li> <li><div class="src-line"><a name="a751"></a><span class="src-doc"> * Holds eventual error message in plain english</span></div></li> <li><div class="src-line"><a name="a752"></a><span class="src-doc"> *</span></div></li> <li><div class="src-line"><a name="a753"></a><span class="src-doc"> * </span><span class="src-doc-coretag">@access</span><span class="src-doc"> public</span></div></li> <li><div class="src-line"><a name="a754"></a><span class="src-doc"> * </span><span class="src-doc-coretag">@var </span><span class="src-doc-type">string </span></div></li> <li><div class="src-line"><a name="a755"></a><span class="src-doc"> */</span></div></li> <li><div class="src-line"><a name="a756"></a> <span class="src-key">var </span><a href="class.upload.html#var$error">$error</a><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a757"></a> </div></li> <li><div class="src-line"><a name="a758"></a> <span class="src-doc">/**</span></div></li> <li><div class="src-line"><a name="a759"></a><span class="src-doc"> * Holds an HTML formatted log</span></div></li> <li><div class="src-line"><a name="a760"></a><span class="src-doc"> *</span></div></li> <li><div class="src-line"><a name="a761"></a><span class="src-doc"> * </span><span class="src-doc-coretag">@access</span><span class="src-doc"> public</span></div></li> <li><div class="src-line"><a name="a762"></a><span class="src-doc"> * </span><span class="src-doc-coretag">@var </span><span class="src-doc-type">string </span></div></li> <li><div class="src-line"><a name="a763"></a><span class="src-doc"> */</span></div></li> <li><div class="src-line"><a name="a764"></a> <span class="src-key">var </span><a href="class.upload.html#var$log">$log</a><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a765"></a> </div></li> <li><div class="src-line"><a name="a766"></a> </div></li> <li><div class="src-line"><a name="a767"></a> <span class="src-comm">// overiddable processing variables</span></div></li> <li><div class="src-line"><a name="a768"></a> </div></li> <li><div class="src-line"><a name="a769"></a> </div></li> <li><div class="src-line"><a name="a770"></a> <span class="src-doc">/**</span></div></li> <li><div class="src-line"><a name="a771"></a><span class="src-doc"> * Set this variable to replace the name body (i.e. without extension)</span></div></li> <li><div class="src-line"><a name="a772"></a><span class="src-doc"> *</span></div></li> <li><div class="src-line"><a name="a773"></a><span class="src-doc"> * </span><span class="src-doc-coretag">@access</span><span class="src-doc"> public</span></div></li> <li><div class="src-line"><a name="a774"></a><span class="src-doc"> * </span><span class="src-doc-coretag">@var </span><span class="src-doc-type">string </span></div></li> <li><div class="src-line"><a name="a775"></a><span class="src-doc"> */</span></div></li> <li><div class="src-line"><a name="a776"></a> <span class="src-key">var </span><a href="class.upload.html#var$file_new_name_body">$file_new_name_body</a><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a777"></a> </div></li> <li><div class="src-line"><a name="a778"></a> <span class="src-doc">/**</span></div></li> <li><div class="src-line"><a name="a779"></a><span class="src-doc"> * Set this variable to append a string to the file name body</span></div></li> <li><div class="src-line"><a name="a780"></a><span class="src-doc"> *</span></div></li> <li><div class="src-line"><a name="a781"></a><span class="src-doc"> * </span><span class="src-doc-coretag">@access</span><span class="src-doc"> public</span></div></li> <li><div class="src-line"><a name="a782"></a><span class="src-doc"> * </span><span class="src-doc-coretag">@var </span><span class="src-doc-type">string </span></div></li> <li><div class="src-line"><a name="a783"></a><span class="src-doc"> */</span></div></li> <li><div class="src-line"><a name="a784"></a> <span class="src-key">var </span><a href="class.upload.html#var$file_name_body_add">$file_name_body_add</a><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a785"></a> </div></li> <li><div class="src-line"><a name="a786"></a> <span class="src-doc">/**</span></div></li> <li><div class="src-line"><a name="a787"></a><span class="src-doc"> * Set this variable to prepend a string to the file name body</span></div></li> <li><div class="src-line"><a name="a788"></a><span class="src-doc"> *</span></div></li> <li><div class="src-line"><a name="a789"></a><span class="src-doc"> * </span><span class="src-doc-coretag">@access</span><span class="src-doc"> public</span></div></li> <li><div class="src-line"><a name="a790"></a><span class="src-doc"> * </span><span class="src-doc-coretag">@var </span><span class="src-doc-type">string </span></div></li> <li><div class="src-line"><a name="a791"></a><span class="src-doc"> */</span></div></li> <li><div class="src-line"><a name="a792"></a> <span class="src-key">var </span><a href="class.upload.html#var$file_name_body_pre">$file_name_body_pre</a><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a793"></a> </div></li> <li><div class="src-line"><a name="a794"></a> <span class="src-doc">/**</span></div></li> <li><div class="src-line"><a name="a795"></a><span class="src-doc"> * Set this variable to change the file extension</span></div></li> <li><div class="src-line"><a name="a796"></a><span class="src-doc"> *</span></div></li> <li><div class="src-line"><a name="a797"></a><span class="src-doc"> * </span><span class="src-doc-coretag">@access</span><span class="src-doc"> public</span></div></li> <li><div class="src-line"><a name="a798"></a><span class="src-doc"> * </span><span class="src-doc-coretag">@var </span><span class="src-doc-type">string </span></div></li> <li><div class="src-line"><a name="a799"></a><span class="src-doc"> */</span></div></li> <li><div class="src-line"><a name="a800"></a> <span class="src-key">var </span><a href="class.upload.html#var$file_new_name_ext">$file_new_name_ext</a><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a801"></a> </div></li> <li><div class="src-line"><a name="a802"></a> <span class="src-doc">/**</span></div></li> <li><div class="src-line"><a name="a803"></a><span class="src-doc"> * Set this variable to format the filename (spaces changed to _)</span></div></li> <li><div class="src-line"><a name="a804"></a><span class="src-doc"> *</span></div></li> <li><div class="src-line"><a name="a805"></a><span class="src-doc"> * </span><span class="src-doc-coretag">@access</span><span class="src-doc"> public</span></div></li> <li><div class="src-line"><a name="a806"></a><span class="src-doc"> * </span><span class="src-doc-coretag">@var </span><span class="src-doc-type">boolean </span></div></li> <li><div class="src-line"><a name="a807"></a><span class="src-doc"> */</span></div></li> <li><div class="src-line"><a name="a808"></a> <span class="src-key">var </span><a href="class.upload.html#var$file_safe_name">$file_safe_name</a><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a809"></a> </div></li> <li><div class="src-line"><a name="a810"></a> <span class="src-doc">/**</span></div></li> <li><div class="src-line"><a name="a811"></a><span class="src-doc"> * Set this variable to false if you don't want to check the MIME against the allowed list</span></div></li> <li><div class="src-line"><a name="a812"></a><span class="src-doc"> *</span></div></li> <li><div class="src-line"><a name="a813"></a><span class="src-doc"> * This variable is set to true by default for security reason</span></div></li> <li><div class="src-line"><a name="a814"></a><span class="src-doc"> *</span></div></li> <li><div class="src-line"><a name="a815"></a><span class="src-doc"> * </span><span class="src-doc-coretag">@access</span><span class="src-doc"> public</span></div></li> <li><div class="src-line"><a name="a816"></a><span class="src-doc"> * </span><span class="src-doc-coretag">@var </span><span class="src-doc-type">boolean </span></div></li> <li><div class="src-line"><a name="a817"></a><span class="src-doc"> */</span></div></li> <li><div class="src-line"><a name="a818"></a> <span class="src-key">var </span><a href="class.upload.html#var$mime_check">$mime_check</a><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a819"></a> </div></li> <li><div class="src-line"><a name="a820"></a> <span class="src-doc">/**</span></div></li> <li><div class="src-line"><a name="a821"></a><span class="src-doc"> * Set this variable to false if you don't want to check the MIME with Fileinfo PECL extension</span></div></li> <li><div class="src-line"><a name="a822"></a><span class="src-doc"> *</span></div></li> <li><div class="src-line"><a name="a823"></a><span class="src-doc"> * You can also set it with the path of the magic database file.</span></div></li> <li><div class="src-line"><a name="a824"></a><span class="src-doc"> * If set to true, the class will try to read the MAGIC environment variable</span></div></li> <li><div class="src-line"><a name="a825"></a><span class="src-doc"> * and if it is empty, will default to '/usr/share/file/magic'</span></div></li> <li><div class="src-line"><a name="a826"></a><span class="src-doc"> * If set to an empty string, it will call finfo_open without the path argument</span></div></li> <li><div class="src-line"><a name="a827"></a><span class="src-doc"> *</span></div></li> <li><div class="src-line"><a name="a828"></a><span class="src-doc"> * This variable is set to true by default for security reason</span></div></li> <li><div class="src-line"><a name="a829"></a><span class="src-doc"> *</span></div></li> <li><div class="src-line"><a name="a830"></a><span class="src-doc"> * </span><span class="src-doc-coretag">@access</span><span class="src-doc"> public</span></div></li> <li><div class="src-line"><a name="a831"></a><span class="src-doc"> * </span><span class="src-doc-coretag">@var </span><span class="src-doc-type">boolean </span></div></li> <li><div class="src-line"><a name="a832"></a><span class="src-doc"> */</span></div></li> <li><div class="src-line"><a name="a833"></a> <span class="src-key">var </span><a href="class.upload.html#var$mime_fileinfo">$mime_fileinfo</a><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a834"></a> </div></li> <li><div class="src-line"><a name="a835"></a> <span class="src-doc">/**</span></div></li> <li><div class="src-line"><a name="a836"></a><span class="src-doc"> * Set this variable to false if you don't want to check the MIME with UNIX file() command</span></div></li> <li><div class="src-line"><a name="a837"></a><span class="src-doc"> *</span></div></li> <li><div class="src-line"><a name="a838"></a><span class="src-doc"> * This variable is set to true by default for security reason</span></div></li> <li><div class="src-line"><a name="a839"></a><span class="src-doc"> *</span></div></li> <li><div class="src-line"><a name="a840"></a><span class="src-doc"> * </span><span class="src-doc-coretag">@access</span><span class="src-doc"> public</span></div></li> <li><div class="src-line"><a name="a841"></a><span class="src-doc"> * </span><span class="src-doc-coretag">@var </span><span class="src-doc-type">boolean </span></div></li> <li><div class="src-line"><a name="a842"></a><span class="src-doc"> */</span></div></li> <li><div class="src-line"><a name="a843"></a> <span class="src-key">var </span><a href="class.upload.html#var$mime_file">$mime_file</a><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a844"></a> </div></li> <li><div class="src-line"><a name="a845"></a> <span class="src-doc">/**</span></div></li> <li><div class="src-line"><a name="a846"></a><span class="src-doc"> * Set this variable to false if you don't want to check the MIME with the magic.mime file</span></div></li> <li><div class="src-line"><a name="a847"></a><span class="src-doc"> *</span></div></li> <li><div class="src-line"><a name="a848"></a><span class="src-doc"> * The function mime_content_type() will be deprecated,</span></div></li> <li><div class="src-line"><a name="a849"></a><span class="src-doc"> * and this variable will be set to false in a future release</span></div></li> <li><div class="src-line"><a name="a850"></a><span class="src-doc"> *</span></div></li> <li><div class="src-line"><a name="a851"></a><span class="src-doc"> * This variable is set to true by default for security reason</span></div></li> <li><div class="src-line"><a name="a852"></a><span class="src-doc"> *</span></div></li> <li><div class="src-line"><a name="a853"></a><span class="src-doc"> * </span><span class="src-doc-coretag">@access</span><span class="src-doc"> public</span></div></li> <li><div class="src-line"><a name="a854"></a><span class="src-doc"> * </span><span class="src-doc-coretag">@var </span><span class="src-doc-type">boolean </span></div></li> <li><div class="src-line"><a name="a855"></a><span class="src-doc"> */</span></div></li> <li><div class="src-line"><a name="a856"></a> <span class="src-key">var </span><a href="class.upload.html#var$mime_magic">$mime_magic</a><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a857"></a> </div></li> <li><div class="src-line"><a name="a858"></a> <span class="src-doc">/**</span></div></li> <li><div class="src-line"><a name="a859"></a><span class="src-doc"> * Set this variable to false if you don't want to check the MIME with getimagesize()</span></div></li> <li><div class="src-line"><a name="a860"></a><span class="src-doc"> *</span></div></li> <li><div class="src-line"><a name="a861"></a><span class="src-doc"> * The class tries to get a MIME type from getimagesize()</span></div></li> <li><div class="src-line"><a name="a862"></a><span class="src-doc"> * If no MIME is returned, it tries to guess the MIME type from the file type</span></div></li> <li><div class="src-line"><a name="a863"></a><span class="src-doc"> *</span></div></li> <li><div class="src-line"><a name="a864"></a><span class="src-doc"> * This variable is set to true by default for security reason</span></div></li> <li><div class="src-line"><a name="a865"></a><span class="src-doc"> *</span></div></li> <li><div class="src-line"><a name="a866"></a><span class="src-doc"> * </span><span class="src-doc-coretag">@access</span><span class="src-doc"> public</span></div></li> <li><div class="src-line"><a name="a867"></a><span class="src-doc"> * </span><span class="src-doc-coretag">@var </span><span class="src-doc-type">boolean </span></div></li> <li><div class="src-line"><a name="a868"></a><span class="src-doc"> */</span></div></li> <li><div class="src-line"><a name="a869"></a> <span class="src-key">var </span><a href="class.upload.html#var$mime_getimagesize">$mime_getimagesize</a><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a870"></a> </div></li> <li><div class="src-line"><a name="a871"></a> <span class="src-doc">/**</span></div></li> <li><div class="src-line"><a name="a872"></a><span class="src-doc"> * Set this variable to false if you don't want to turn dangerous scripts into simple text files</span></div></li> <li><div class="src-line"><a name="a873"></a><span class="src-doc"> *</span></div></li> <li><div class="src-line"><a name="a874"></a><span class="src-doc"> * </span><span class="src-doc-coretag">@access</span><span class="src-doc"> public</span></div></li> <li><div class="src-line"><a name="a875"></a><span class="src-doc"> * </span><span class="src-doc-coretag">@var </span><span class="src-doc-type">boolean </span></div></li> <li><div class="src-line"><a name="a876"></a><span class="src-doc"> */</span></div></li> <li><div class="src-line"><a name="a877"></a> <span class="src-key">var </span><a href="class.upload.html#var$no_script">$no_script</a><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a878"></a> </div></li> <li><div class="src-line"><a name="a879"></a> <span class="src-doc">/**</span></div></li> <li><div class="src-line"><a name="a880"></a><span class="src-doc"> * Set this variable to true to allow automatic renaming of the file</span></div></li> <li><div class="src-line"><a name="a881"></a><span class="src-doc"> * if the file already exists</span></div></li> <li><div class="src-line"><a name="a882"></a><span class="src-doc"> *</span></div></li> <li><div class="src-line"><a name="a883"></a><span class="src-doc"> * Default value is true</span></div></li> <li><div class="src-line"><a name="a884"></a><span class="src-doc"> *</span></div></li> <li><div class="src-line"><a name="a885"></a><span class="src-doc"> * For instance, on uploading foo.ext,<br></span></div></li> <li><div class="src-line"><a name="a886"></a><span class="src-doc"> * if foo.ext already exists, upload will be renamed foo_1.ext<br></span></div></li> <li><div class="src-line"><a name="a887"></a><span class="src-doc"> * and if foo_1.ext already exists, upload will be renamed foo_2.ext<br></span></div></li> <li><div class="src-line"><a name="a888"></a><span class="src-doc"> *</span></div></li> <li><div class="src-line"><a name="a889"></a><span class="src-doc"> * Note that this option doesn't have any effect if </span><span class="src-doc-inlinetag">{@link file_overwrite}</span><span class="src-doc"> is true</span></div></li> <li><div class="src-line"><a name="a890"></a><span class="src-doc"> *</span></div></li> <li><div class="src-line"><a name="a891"></a><span class="src-doc"> * </span><span class="src-doc-coretag">@access</span><span class="src-doc"> public</span></div></li> <li><div class="src-line"><a name="a892"></a><span class="src-doc"> * </span><span class="src-doc-coretag">@var </span><span class="src-doc-type">bool </span></div></li> <li><div class="src-line"><a name="a893"></a><span class="src-doc"> */</span></div></li> <li><div class="src-line"><a name="a894"></a> <span class="src-key">var </span><a href="class.upload.html#var$file_auto_rename">$file_auto_rename</a><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a895"></a> </div></li> <li><div class="src-line"><a name="a896"></a> <span class="src-doc">/**</span></div></li> <li><div class="src-line"><a name="a897"></a><span class="src-doc"> * Set this variable to true to allow automatic creation of the destination</span></div></li> <li><div class="src-line"><a name="a898"></a><span class="src-doc"> * directory if it is missing (works recursively)</span></div></li> <li><div class="src-line"><a name="a899"></a><span class="src-doc"> *</span></div></li> <li><div class="src-line"><a name="a900"></a><span class="src-doc"> * Default value is true</span></div></li> <li><div class="src-line"><a name="a901"></a><span class="src-doc"> *</span></div></li> <li><div class="src-line"><a name="a902"></a><span class="src-doc"> * </span><span class="src-doc-coretag">@access</span><span class="src-doc"> public</span></div></li> <li><div class="src-line"><a name="a903"></a><span class="src-doc"> * </span><span class="src-doc-coretag">@var </span><span class="src-doc-type">bool </span></div></li> <li><div class="src-line"><a name="a904"></a><span class="src-doc"> */</span></div></li> <li><div class="src-line"><a name="a905"></a> <span class="src-key">var </span><a href="class.upload.html#var$dir_auto_create">$dir_auto_create</a><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a906"></a> </div></li> <li><div class="src-line"><a name="a907"></a> <span class="src-doc">/**</span></div></li> <li><div class="src-line"><a name="a908"></a><span class="src-doc"> * Set this variable to true to allow automatic chmod of the destination</span></div></li> <li><div class="src-line"><a name="a909"></a><span class="src-doc"> * directory if it is not writeable</span></div></li> <li><div class="src-line"><a name="a910"></a><span class="src-doc"> *</span></div></li> <li><div class="src-line"><a name="a911"></a><span class="src-doc"> * Default value is true</span></div></li> <li><div class="src-line"><a name="a912"></a><span class="src-doc"> *</span></div></li> <li><div class="src-line"><a name="a913"></a><span class="src-doc"> * </span><span class="src-doc-coretag">@access</span><span class="src-doc"> public</span></div></li> <li><div class="src-line"><a name="a914"></a><span class="src-doc"> * </span><span class="src-doc-coretag">@var </span><span class="src-doc-type">bool </span></div></li> <li><div class="src-line"><a name="a915"></a><span class="src-doc"> */</span></div></li> <li><div class="src-line"><a name="a916"></a> <span class="src-key">var </span><a href="class.upload.html#var$dir_auto_chmod">$dir_auto_chmod</a><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a917"></a> </div></li> <li><div class="src-line"><a name="a918"></a> <span class="src-doc">/**</span></div></li> <li><div class="src-line"><a name="a919"></a><span class="src-doc"> * Set this variable to the default chmod you want the class to use</span></div></li> <li><div class="src-line"><a name="a920"></a><span class="src-doc"> * when creating directories, or attempting to write in a directory</span></div></li> <li><div class="src-line"><a name="a921"></a><span class="src-doc"> *</span></div></li> <li><div class="src-line"><a name="a922"></a><span class="src-doc"> * Default value is 0777 (without quotes)</span></div></li> <li><div class="src-line"><a name="a923"></a><span class="src-doc"> *</span></div></li> <li><div class="src-line"><a name="a924"></a><span class="src-doc"> * </span><span class="src-doc-coretag">@access</span><span class="src-doc"> public</span></div></li> <li><div class="src-line"><a name="a925"></a><span class="src-doc"> * </span><span class="src-doc-coretag">@var </span><span class="src-doc-type">bool </span></div></li> <li><div class="src-line"><a name="a926"></a><span class="src-doc"> */</span></div></li> <li><div class="src-line"><a name="a927"></a> <span class="src-key">var </span><a href="class.upload.html#var$dir_chmod">$dir_chmod</a><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a928"></a> </div></li> <li><div class="src-line"><a name="a929"></a> <span class="src-doc">/**</span></div></li> <li><div class="src-line"><a name="a930"></a><span class="src-doc"> * Set this variable tu true to allow overwriting of an existing file</span></div></li> <li><div class="src-line"><a name="a931"></a><span class="src-doc"> *</span></div></li> <li><div class="src-line"><a name="a932"></a><span class="src-doc"> * Default value is false, so no files will be overwritten</span></div></li> <li><div class="src-line"><a name="a933"></a><span class="src-doc"> *</span></div></li> <li><div class="src-line"><a name="a934"></a><span class="src-doc"> * </span><span class="src-doc-coretag">@access</span><span class="src-doc"> public</span></div></li> <li><div class="src-line"><a name="a935"></a><span class="src-doc"> * </span><span class="src-doc-coretag">@var </span><span class="src-doc-type">bool </span></div></li> <li><div class="src-line"><a name="a936"></a><span class="src-doc"> */</span></div></li> <li><div class="src-line"><a name="a937"></a> <span class="src-key">var </span><a href="class.upload.html#var$file_overwrite">$file_overwrite</a><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a938"></a> </div></li> <li><div class="src-line"><a name="a939"></a> <span class="src-doc">/**</span></div></li> <li><div class="src-line"><a name="a940"></a><span class="src-doc"> * Set this variable to change the maximum size in bytes for an uploaded file</span></div></li> <li><div class="src-line"><a name="a941"></a><span class="src-doc"> *</span></div></li> <li><div class="src-line"><a name="a942"></a><span class="src-doc"> * Default value is the value <i>upload_max_filesize</i> from php.ini</span></div></li> <li><div class="src-line"><a name="a943"></a><span class="src-doc"> *</span></div></li> <li><div class="src-line"><a name="a944"></a><span class="src-doc"> * </span><span class="src-doc-coretag">@access</span><span class="src-doc"> public</span></div></li> <li><div class="src-line"><a name="a945"></a><span class="src-doc"> * </span><span class="src-doc-coretag">@var </span><span class="src-doc-type">double </span></div></li> <li><div class="src-line"><a name="a946"></a><span class="src-doc"> */</span></div></li> <li><div class="src-line"><a name="a947"></a> <span class="src-key">var </span><a href="class.upload.html#var$file_max_size">$file_max_size</a><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a948"></a> </div></li> <li><div class="src-line"><a name="a949"></a> <span class="src-doc">/**</span></div></li> <li><div class="src-line"><a name="a950"></a><span class="src-doc"> * Set this variable to true to resize the file if it is an image</span></div></li> <li><div class="src-line"><a name="a951"></a><span class="src-doc"> *</span></div></li> <li><div class="src-line"><a name="a952"></a><span class="src-doc"> * You will probably want to set </span><span class="src-doc-inlinetag">{@link image_x}</span><span class="src-doc"> and </span><span class="src-doc-inlinetag">{@link image_y}</span><span class="src-doc">, and maybe one of the ratio variables</span></div></li> <li><div class="src-line"><a name="a953"></a><span class="src-doc"> *</span></div></li> <li><div class="src-line"><a name="a954"></a><span class="src-doc"> * Default value is false (no resizing)</span></div></li> <li><div class="src-line"><a name="a955"></a><span class="src-doc"> *</span></div></li> <li><div class="src-line"><a name="a956"></a><span class="src-doc"> * </span><span class="src-doc-coretag">@access</span><span class="src-doc"> public</span></div></li> <li><div class="src-line"><a name="a957"></a><span class="src-doc"> * </span><span class="src-doc-coretag">@var </span><span class="src-doc-type">bool </span></div></li> <li><div class="src-line"><a name="a958"></a><span class="src-doc"> */</span></div></li> <li><div class="src-line"><a name="a959"></a> <span class="src-key">var </span><a href="class.upload.html#var$image_resize">$image_resize</a><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a960"></a> </div></li> <li><div class="src-line"><a name="a961"></a> <span class="src-doc">/**</span></div></li> <li><div class="src-line"><a name="a962"></a><span class="src-doc"> * Set this variable to convert the file if it is an image</span></div></li> <li><div class="src-line"><a name="a963"></a><span class="src-doc"> *</span></div></li> <li><div class="src-line"><a name="a964"></a><span class="src-doc"> * Possibles values are : ''; 'png'; 'jpeg'; 'gif'; 'bmp'</span></div></li> <li><div class="src-line"><a name="a965"></a><span class="src-doc"> *</span></div></li> <li><div class="src-line"><a name="a966"></a><span class="src-doc"> * Default value is '' (no conversion)<br></span></div></li> <li><div class="src-line"><a name="a967"></a><span class="src-doc"> * If </span><span class="src-doc-inlinetag">{@link resize}</span><span class="src-doc"> is true, </span><span class="src-doc-inlinetag">{@link convert}</span><span class="src-doc"> will be set to the source file extension</span></div></li> <li><div class="src-line"><a name="a968"></a><span class="src-doc"> *</span></div></li> <li><div class="src-line"><a name="a969"></a><span class="src-doc"> * </span><span class="src-doc-coretag">@access</span><span class="src-doc"> public</span></div></li> <li><div class="src-line"><a name="a970"></a><span class="src-doc"> * </span><span class="src-doc-coretag">@var </span><span class="src-doc-type">string </span></div></li> <li><div class="src-line"><a name="a971"></a><span class="src-doc"> */</span></div></li> <li><div class="src-line"><a name="a972"></a> <span class="src-key">var </span><a href="class.upload.html#var$image_convert">$image_convert</a><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a973"></a> </div></li> <li><div class="src-line"><a name="a974"></a> <span class="src-doc">/**</span></div></li> <li><div class="src-line"><a name="a975"></a><span class="src-doc"> * Set this variable to the wanted (or maximum/minimum) width for the processed image, in pixels</span></div></li> <li><div class="src-line"><a name="a976"></a><span class="src-doc"> *</span></div></li> <li><div class="src-line"><a name="a977"></a><span class="src-doc"> * Default value is 150</span></div></li> <li><div class="src-line"><a name="a978"></a><span class="src-doc"> *</span></div></li> <li><div class="src-line"><a name="a979"></a><span class="src-doc"> * </span><span class="src-doc-coretag">@access</span><span class="src-doc"> public</span></div></li> <li><div class="src-line"><a name="a980"></a><span class="src-doc"> * </span><span class="src-doc-coretag">@var </span><span class="src-doc-type">integer </span></div></li> <li><div class="src-line"><a name="a981"></a><span class="src-doc"> */</span></div></li> <li><div class="src-line"><a name="a982"></a> <span class="src-key">var </span><a href="class.upload.html#var$image_x">$image_x</a><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a983"></a> </div></li> <li><div class="src-line"><a name="a984"></a> <span class="src-doc">/**</span></div></li> <li><div class="src-line"><a name="a985"></a><span class="src-doc"> * Set this variable to the wanted (or maximum/minimum) height for the processed image, in pixels</span></div></li> <li><div class="src-line"><a name="a986"></a><span class="src-doc"> *</span></div></li> <li><div class="src-line"><a name="a987"></a><span class="src-doc"> * Default value is 150</span></div></li> <li><div class="src-line"><a name="a988"></a><span class="src-doc"> *</span></div></li> <li><div class="src-line"><a name="a989"></a><span class="src-doc"> * </span><span class="src-doc-coretag">@access</span><span class="src-doc"> public</span></div></li> <li><div class="src-line"><a name="a990"></a><span class="src-doc"> * </span><span class="src-doc-coretag">@var </span><span class="src-doc-type">integer </span></div></li> <li><div class="src-line"><a name="a991"></a><span class="src-doc"> */</span></div></li> <li><div class="src-line"><a name="a992"></a> <span class="src-key">var </span><a href="class.upload.html#var$image_y">$image_y</a><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a993"></a> </div></li> <li><div class="src-line"><a name="a994"></a> <span class="src-doc">/**</span></div></li> <li><div class="src-line"><a name="a995"></a><span class="src-doc"> * Set this variable to keep the original size ratio to fit within </span><span class="src-doc-inlinetag">{@link image_x}</span><span class="src-doc"> x </span><span class="src-doc-inlinetag">{@link image_y}</span></div></li> <li><div class="src-line"><a name="a996"></a><span class="src-doc"> *</span></div></li> <li><div class="src-line"><a name="a997"></a><span class="src-doc"> * Default value is false</span></div></li> <li><div class="src-line"><a name="a998"></a><span class="src-doc"> *</span></div></li> <li><div class="src-line"><a name="a999"></a><span class="src-doc"> * </span><span class="src-doc-coretag">@access</span><span class="src-doc"> public</span></div></li> <li><div class="src-line"><a name="a1000"></a><span class="src-doc"> * </span><span class="src-doc-coretag">@var </span><span class="src-doc-type">bool </span></div></li> <li><div class="src-line"><a name="a1001"></a><span class="src-doc"> */</span></div></li> <li><div class="src-line"><a name="a1002"></a> <span class="src-key">var </span><a href="class.upload.html#var$image_ratio">$image_ratio</a><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a1003"></a> </div></li> <li><div class="src-line"><a name="a1004"></a> <span class="src-doc">/**</span></div></li> <li><div class="src-line"><a name="a1005"></a><span class="src-doc"> * Set this variable to keep the original size ratio to fit within </span><span class="src-doc-inlinetag">{@link image_x}</span><span class="src-doc"> x </span><span class="src-doc-inlinetag">{@link image_y}</span></div></li> <li><div class="src-line"><a name="a1006"></a><span class="src-doc"> *</span></div></li> <li><div class="src-line"><a name="a1007"></a><span class="src-doc"> * The image will be resized as to fill the whole space, and excedent will be cropped</span></div></li> <li><div class="src-line"><a name="a1008"></a><span class="src-doc"> *</span></div></li> <li><div class="src-line"><a name="a1009"></a><span class="src-doc"> * Value can also be a string, one or more character from 'TBLR' (top, bottom, left and right)</span></div></li> <li><div class="src-line"><a name="a1010"></a><span class="src-doc"> * If set as a string, it determines which side of the image is kept while cropping.</span></div></li> <li><div class="src-line"><a name="a1011"></a><span class="src-doc"> * By default, the part of the image kept is in the center, i.e. it crops equally on both sides</span></div></li> <li><div class="src-line"><a name="a1012"></a><span class="src-doc"> *</span></div></li> <li><div class="src-line"><a name="a1013"></a><span class="src-doc"> * Default value is false</span></div></li> <li><div class="src-line"><a name="a1014"></a><span class="src-doc"> *</span></div></li> <li><div class="src-line"><a name="a1015"></a><span class="src-doc"> * </span><span class="src-doc-coretag">@access</span><span class="src-doc"> public</span></div></li> <li><div class="src-line"><a name="a1016"></a><span class="src-doc"> * </span><span class="src-doc-coretag">@var </span><span class="src-doc-type">mixed </span></div></li> <li><div class="src-line"><a name="a1017"></a><span class="src-doc"> */</span></div></li> <li><div class="src-line"><a name="a1018"></a> <span class="src-key">var </span><a href="class.upload.html#var$image_ratio_crop">$image_ratio_crop</a><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a1019"></a> </div></li> <li><div class="src-line"><a name="a1020"></a> <span class="src-doc">/**</span></div></li> <li><div class="src-line"><a name="a1021"></a><span class="src-doc"> * Set this variable to keep the original size ratio to fit within </span><span class="src-doc-inlinetag">{@link image_x}</span><span class="src-doc"> x </span><span class="src-doc-inlinetag">{@link image_y}</span></div></li> <li><div class="src-line"><a name="a1022"></a><span class="src-doc"> *</span></div></li> <li><div class="src-line"><a name="a1023"></a><span class="src-doc"> * The image will be resized to fit entirely in the space, and the rest will be colored.</span></div></li> <li><div class="src-line"><a name="a1024"></a><span class="src-doc"> * The default color is white, but can be set with </span><span class="src-doc-inlinetag">{@link image_default_color}</span></div></li> <li><div class="src-line"><a name="a1025"></a><span class="src-doc"> *</span></div></li> <li><div class="src-line"><a name="a1026"></a><span class="src-doc"> * Value can also be a string, one or more character from 'TBLR' (top, bottom, left and right)</span></div></li> <li><div class="src-line"><a name="a1027"></a><span class="src-doc"> * If set as a string, it determines in which side of the space the image is displayed.</span></div></li> <li><div class="src-line"><a name="a1028"></a><span class="src-doc"> * By default, the image is displayed in the center, i.e. it fills the remaining space equally on both sides</span></div></li> <li><div class="src-line"><a name="a1029"></a><span class="src-doc"> *</span></div></li> <li><div class="src-line"><a name="a1030"></a><span class="src-doc"> * Default value is false</span></div></li> <li><div class="src-line"><a name="a1031"></a><span class="src-doc"> *</span></div></li> <li><div class="src-line"><a name="a1032"></a><span class="src-doc"> * </span><span class="src-doc-coretag">@access</span><span class="src-doc"> public</span></div></li> <li><div class="src-line"><a name="a1033"></a><span class="src-doc"> * </span><span class="src-doc-coretag">@var </span><span class="src-doc-type">mixed </span></div></li> <li><div class="src-line"><a name="a1034"></a><span class="src-doc"> */</span></div></li> <li><div class="src-line"><a name="a1035"></a> <span class="src-key">var </span><a href="class.upload.html#var$image_ratio_fill">$image_ratio_fill</a><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a1036"></a> </div></li> <li><div class="src-line"><a name="a1037"></a> <span class="src-doc">/**</span></div></li> <li><div class="src-line"><a name="a1038"></a><span class="src-doc"> * Set this variable to a number of pixels so that </span><span class="src-doc-inlinetag">{@link image_x}</span><span class="src-doc"> and </span><span class="src-doc-inlinetag">{@link image_y}</span><span class="src-doc"> are the best match possible</span></div></li> <li><div class="src-line"><a name="a1039"></a><span class="src-doc"> *</span></div></li> <li><div class="src-line"><a name="a1040"></a><span class="src-doc"> * The image will be resized to have approximatively the number of pixels</span></div></li> <li><div class="src-line"><a name="a1041"></a><span class="src-doc"> * The aspect ratio wil be conserved</span></div></li> <li><div class="src-line"><a name="a1042"></a><span class="src-doc"> *</span></div></li> <li><div class="src-line"><a name="a1043"></a><span class="src-doc"> * Default value is false</span></div></li> <li><div class="src-line"><a name="a1044"></a><span class="src-doc"> *</span></div></li> <li><div class="src-line"><a name="a1045"></a><span class="src-doc"> * </span><span class="src-doc-coretag">@access</span><span class="src-doc"> public</span></div></li> <li><div class="src-line"><a name="a1046"></a><span class="src-doc"> * </span><span class="src-doc-coretag">@var </span><span class="src-doc-type">mixed </span></div></li> <li><div class="src-line"><a name="a1047"></a><span class="src-doc"> */</span></div></li> <li><div class="src-line"><a name="a1048"></a> <span class="src-key">var </span><a href="class.upload.html#var$image_ratio_pixels">$image_ratio_pixels</a><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a1049"></a> </div></li> <li><div class="src-line"><a name="a1050"></a> <span class="src-doc">/**</span></div></li> <li><div class="src-line"><a name="a1051"></a><span class="src-doc"> * Set this variable to keep the original size ratio to fit within </span><span class="src-doc-inlinetag">{@link image_x}</span><span class="src-doc"> x </span><span class="src-doc-inlinetag">{@link image_y}</span><span class="src-doc">,</span></div></li> <li><div class="src-line"><a name="a1052"></a><span class="src-doc"> * but only if original image is bigger</span></div></li> <li><div class="src-line"><a name="a1053"></a><span class="src-doc"> *</span></div></li> <li><div class="src-line"><a name="a1054"></a><span class="src-doc"> * Default value is false</span></div></li> <li><div class="src-line"><a name="a1055"></a><span class="src-doc"> *</span></div></li> <li><div class="src-line"><a name="a1056"></a><span class="src-doc"> * </span><span class="src-doc-coretag">@access</span><span class="src-doc"> public</span></div></li> <li><div class="src-line"><a name="a1057"></a><span class="src-doc"> * </span><span class="src-doc-coretag">@var </span><span class="src-doc-type">bool </span></div></li> <li><div class="src-line"><a name="a1058"></a><span class="src-doc"> */</span></div></li> <li><div class="src-line"><a name="a1059"></a> <span class="src-key">var </span><a href="class.upload.html#var$image_ratio_no_zoom_in">$image_ratio_no_zoom_in</a><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a1060"></a> </div></li> <li><div class="src-line"><a name="a1061"></a> <span class="src-doc">/**</span></div></li> <li><div class="src-line"><a name="a1062"></a><span class="src-doc"> * Set this variable to keep the original size ratio to fit within </span><span class="src-doc-inlinetag">{@link image_x}</span><span class="src-doc"> x </span><span class="src-doc-inlinetag">{@link image_y}</span><span class="src-doc">,</span></div></li> <li><div class="src-line"><a name="a1063"></a><span class="src-doc"> * but only if original image is smaller</span></div></li> <li><div class="src-line"><a name="a1064"></a><span class="src-doc"> *</span></div></li> <li><div class="src-line"><a name="a1065"></a><span class="src-doc"> * Default value is false</span></div></li> <li><div class="src-line"><a name="a1066"></a><span class="src-doc"> *</span></div></li> <li><div class="src-line"><a name="a1067"></a><span class="src-doc"> * </span><span class="src-doc-coretag">@access</span><span class="src-doc"> public</span></div></li> <li><div class="src-line"><a name="a1068"></a><span class="src-doc"> * </span><span class="src-doc-coretag">@var </span><span class="src-doc-type">bool </span></div></li> <li><div class="src-line"><a name="a1069"></a><span class="src-doc"> */</span></div></li> <li><div class="src-line"><a name="a1070"></a> <span class="src-key">var </span><a href="class.upload.html#var$image_ratio_no_zoom_out">$image_ratio_no_zoom_out</a><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a1071"></a> </div></li> <li><div class="src-line"><a name="a1072"></a> <span class="src-doc">/**</span></div></li> <li><div class="src-line"><a name="a1073"></a><span class="src-doc"> * Set this variable to calculate </span><span class="src-doc-inlinetag">{@link image_x}</span><span class="src-doc"> automatically , using </span><span class="src-doc-inlinetag">{@link image_y}</span><span class="src-doc"> and conserving ratio</span></div></li> <li><div class="src-line"><a name="a1074"></a><span class="src-doc"> *</span></div></li> <li><div class="src-line"><a name="a1075"></a><span class="src-doc"> * Default value is false</span></div></li> <li><div class="src-line"><a name="a1076"></a><span class="src-doc"> *</span></div></li> <li><div class="src-line"><a name="a1077"></a><span class="src-doc"> * </span><span class="src-doc-coretag">@access</span><span class="src-doc"> public</span></div></li> <li><div class="src-line"><a name="a1078"></a><span class="src-doc"> * </span><span class="src-doc-coretag">@var </span><span class="src-doc-type">bool </span></div></li> <li><div class="src-line"><a name="a1079"></a><span class="src-doc"> */</span></div></li> <li><div class="src-line"><a name="a1080"></a> <span class="src-key">var </span><a href="class.upload.html#var$image_ratio_x">$image_ratio_x</a><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a1081"></a> </div></li> <li><div class="src-line"><a name="a1082"></a> <span class="src-doc">/**</span></div></li> <li><div class="src-line"><a name="a1083"></a><span class="src-doc"> * Set this variable to calculate </span><span class="src-doc-inlinetag">{@link image_y}</span><span class="src-doc"> automatically , using </span><span class="src-doc-inlinetag">{@link image_x}</span><span class="src-doc"> and conserving ratio</span></div></li> <li><div class="src-line"><a name="a1084"></a><span class="src-doc"> *</span></div></li> <li><div class="src-line"><a name="a1085"></a><span class="src-doc"> * Default value is false</span></div></li> <li><div class="src-line"><a name="a1086"></a><span class="src-doc"> *</span></div></li> <li><div class="src-line"><a name="a1087"></a><span class="src-doc"> * </span><span class="src-doc-coretag">@access</span><span class="src-doc"> public</span></div></li> <li><div class="src-line"><a name="a1088"></a><span class="src-doc"> * </span><span class="src-doc-coretag">@var </span><span class="src-doc-type">bool </span></div></li> <li><div class="src-line"><a name="a1089"></a><span class="src-doc"> */</span></div></li> <li><div class="src-line"><a name="a1090"></a> <span class="src-key">var </span><a href="class.upload.html#var$image_ratio_y">$image_ratio_y</a><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a1091"></a> </div></li> <li><div class="src-line"><a name="a1092"></a> <span class="src-doc">/**</span></div></li> <li><div class="src-line"><a name="a1093"></a><span class="src-doc"> * Set this variable to set a maximum image width, above which the upload will be invalid</span></div></li> <li><div class="src-line"><a name="a1094"></a><span class="src-doc"> *</span></div></li> <li><div class="src-line"><a name="a1095"></a><span class="src-doc"> * Default value is null</span></div></li> <li><div class="src-line"><a name="a1096"></a><span class="src-doc"> *</span></div></li> <li><div class="src-line"><a name="a1097"></a><span class="src-doc"> * </span><span class="src-doc-coretag">@access</span><span class="src-doc"> public</span></div></li> <li><div class="src-line"><a name="a1098"></a><span class="src-doc"> * </span><span class="src-doc-coretag">@var </span><span class="src-doc-type">integer </span></div></li> <li><div class="src-line"><a name="a1099"></a><span class="src-doc"> */</span></div></li> <li><div class="src-line"><a name="a1100"></a> <span class="src-key">var </span><a href="class.upload.html#var$image_max_width">$image_max_width</a><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a1101"></a> </div></li> <li><div class="src-line"><a name="a1102"></a> <span class="src-doc">/**</span></div></li> <li><div class="src-line"><a name="a1103"></a><span class="src-doc"> * Set this variable to set a maximum image height, above which the upload will be invalid</span></div></li> <li><div class="src-line"><a name="a1104"></a><span class="src-doc"> *</span></div></li> <li><div class="src-line"><a name="a1105"></a><span class="src-doc"> * Default value is null</span></div></li> <li><div class="src-line"><a name="a1106"></a><span class="src-doc"> *</span></div></li> <li><div class="src-line"><a name="a1107"></a><span class="src-doc"> * </span><span class="src-doc-coretag">@access</span><span class="src-doc"> public</span></div></li> <li><div class="src-line"><a name="a1108"></a><span class="src-doc"> * </span><span class="src-doc-coretag">@var </span><span class="src-doc-type">integer </span></div></li> <li><div class="src-line"><a name="a1109"></a><span class="src-doc"> */</span></div></li> <li><div class="src-line"><a name="a1110"></a> <span class="src-key">var </span><a href="class.upload.html#var$image_max_height">$image_max_height</a><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a1111"></a> </div></li> <li><div class="src-line"><a name="a1112"></a> <span class="src-doc">/**</span></div></li> <li><div class="src-line"><a name="a1113"></a><span class="src-doc"> * Set this variable to set a maximum number of pixels for an image, above which the upload will be invalid</span></div></li> <li><div class="src-line"><a name="a1114"></a><span class="src-doc"> *</span></div></li> <li><div class="src-line"><a name="a1115"></a><span class="src-doc"> * Default value is null</span></div></li> <li><div class="src-line"><a name="a1116"></a><span class="src-doc"> *</span></div></li> <li><div class="src-line"><a name="a1117"></a><span class="src-doc"> * </span><span class="src-doc-coretag">@access</span><span class="src-doc"> public</span></div></li> <li><div class="src-line"><a name="a1118"></a><span class="src-doc"> * </span><span class="src-doc-coretag">@var </span><span class="src-doc-type">long </span></div></li> <li><div class="src-line"><a name="a1119"></a><span class="src-doc"> */</span></div></li> <li><div class="src-line"><a name="a1120"></a> <span class="src-key">var </span><a href="class.upload.html#var$image_max_pixels">$image_max_pixels</a><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a1121"></a> </div></li> <li><div class="src-line"><a name="a1122"></a> <span class="src-doc">/**</span></div></li> <li><div class="src-line"><a name="a1123"></a><span class="src-doc"> * Set this variable to set a maximum image aspect ratio, above which the upload will be invalid</span></div></li> <li><div class="src-line"><a name="a1124"></a><span class="src-doc"> *</span></div></li> <li><div class="src-line"><a name="a1125"></a><span class="src-doc"> * Note that ratio = width / height</span></div></li> <li><div class="src-line"><a name="a1126"></a><span class="src-doc"> *</span></div></li> <li><div class="src-line"><a name="a1127"></a><span class="src-doc"> * Default value is null</span></div></li> <li><div class="src-line"><a name="a1128"></a><span class="src-doc"> *</span></div></li> <li><div class="src-line"><a name="a1129"></a><span class="src-doc"> * </span><span class="src-doc-coretag">@access</span><span class="src-doc"> public</span></div></li> <li><div class="src-line"><a name="a1130"></a><span class="src-doc"> * </span><span class="src-doc-coretag">@var </span><span class="src-doc-type">float </span></div></li> <li><div class="src-line"><a name="a1131"></a><span class="src-doc"> */</span></div></li> <li><div class="src-line"><a name="a1132"></a> <span class="src-key">var </span><a href="class.upload.html#var$image_max_ratio">$image_max_ratio</a><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a1133"></a> </div></li> <li><div class="src-line"><a name="a1134"></a> <span class="src-doc">/**</span></div></li> <li><div class="src-line"><a name="a1135"></a><span class="src-doc"> * Set this variable to set a minimum image width, below which the upload will be invalid</span></div></li> <li><div class="src-line"><a name="a1136"></a><span class="src-doc"> *</span></div></li> <li><div class="src-line"><a name="a1137"></a><span class="src-doc"> * Default value is null</span></div></li> <li><div class="src-line"><a name="a1138"></a><span class="src-doc"> *</span></div></li> <li><div class="src-line"><a name="a1139"></a><span class="src-doc"> * </span><span class="src-doc-coretag">@access</span><span class="src-doc"> public</span></div></li> <li><div class="src-line"><a name="a1140"></a><span class="src-doc"> * </span><span class="src-doc-coretag">@var </span><span class="src-doc-type">integer </span></div></li> <li><div class="src-line"><a name="a1141"></a><span class="src-doc"> */</span></div></li> <li><div class="src-line"><a name="a1142"></a> <span class="src-key">var </span><a href="class.upload.html#var$image_min_width">$image_min_width</a><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a1143"></a> </div></li> <li><div class="src-line"><a name="a1144"></a> <span class="src-doc">/**</span></div></li> <li><div class="src-line"><a name="a1145"></a><span class="src-doc"> * Set this variable to set a minimum image height, below which the upload will be invalid</span></div></li> <li><div class="src-line"><a name="a1146"></a><span class="src-doc"> *</span></div></li> <li><div class="src-line"><a name="a1147"></a><span class="src-doc"> * Default value is null</span></div></li> <li><div class="src-line"><a name="a1148"></a><span class="src-doc"> *</span></div></li> <li><div class="src-line"><a name="a1149"></a><span class="src-doc"> * </span><span class="src-doc-coretag">@access</span><span class="src-doc"> public</span></div></li> <li><div class="src-line"><a name="a1150"></a><span class="src-doc"> * </span><span class="src-doc-coretag">@var </span><span class="src-doc-type">integer </span></div></li> <li><div class="src-line"><a name="a1151"></a><span class="src-doc"> */</span></div></li> <li><div class="src-line"><a name="a1152"></a> <span class="src-key">var </span><a href="class.upload.html#var$image_min_height">$image_min_height</a><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a1153"></a> </div></li> <li><div class="src-line"><a name="a1154"></a> <span class="src-doc">/**</span></div></li> <li><div class="src-line"><a name="a1155"></a><span class="src-doc"> * Set this variable to set a minimum number of pixels for an image, below which the upload will be invalid</span></div></li> <li><div class="src-line"><a name="a1156"></a><span class="src-doc"> *</span></div></li> <li><div class="src-line"><a name="a1157"></a><span class="src-doc"> * Default value is null</span></div></li> <li><div class="src-line"><a name="a1158"></a><span class="src-doc"> *</span></div></li> <li><div class="src-line"><a name="a1159"></a><span class="src-doc"> * </span><span class="src-doc-coretag">@access</span><span class="src-doc"> public</span></div></li> <li><div class="src-line"><a name="a1160"></a><span class="src-doc"> * </span><span class="src-doc-coretag">@var </span><span class="src-doc-type">long </span></div></li> <li><div class="src-line"><a name="a1161"></a><span class="src-doc"> */</span></div></li> <li><div class="src-line"><a name="a1162"></a> <span class="src-key">var </span><a href="class.upload.html#var$image_min_pixels">$image_min_pixels</a><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a1163"></a> </div></li> <li><div class="src-line"><a name="a1164"></a> <span class="src-doc">/**</span></div></li> <li><div class="src-line"><a name="a1165"></a><span class="src-doc"> * Set this variable to set a minimum image aspect ratio, below which the upload will be invalid</span></div></li> <li><div class="src-line"><a name="a1166"></a><span class="src-doc"> *</span></div></li> <li><div class="src-line"><a name="a1167"></a><span class="src-doc"> * Note that ratio = width / height</span></div></li> <li><div class="src-line"><a name="a1168"></a><span class="src-doc"> *</span></div></li> <li><div class="src-line"><a name="a1169"></a><span class="src-doc"> * Default value is null</span></div></li> <li><div class="src-line"><a name="a1170"></a><span class="src-doc"> *</span></div></li> <li><div class="src-line"><a name="a1171"></a><span class="src-doc"> * </span><span class="src-doc-coretag">@access</span><span class="src-doc"> public</span></div></li> <li><div class="src-line"><a name="a1172"></a><span class="src-doc"> * </span><span class="src-doc-coretag">@var </span><span class="src-doc-type">float </span></div></li> <li><div class="src-line"><a name="a1173"></a><span class="src-doc"> */</span></div></li> <li><div class="src-line"><a name="a1174"></a> <span class="src-key">var </span><a href="class.upload.html#var$image_min_ratio">$image_min_ratio</a><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a1175"></a> </div></li> <li><div class="src-line"><a name="a1176"></a> <span class="src-doc">/**</span></div></li> <li><div class="src-line"><a name="a1177"></a><span class="src-doc"> * Quality of JPEG created/converted destination image</span></div></li> <li><div class="src-line"><a name="a1178"></a><span class="src-doc"> *</span></div></li> <li><div class="src-line"><a name="a1179"></a><span class="src-doc"> * Default value is 85</span></div></li> <li><div class="src-line"><a name="a1180"></a><span class="src-doc"> *</span></div></li> <li><div class="src-line"><a name="a1181"></a><span class="src-doc"> * </span><span class="src-doc-coretag">@access</span><span class="src-doc"> public</span></div></li> <li><div class="src-line"><a name="a1182"></a><span class="src-doc"> * </span><span class="src-doc-coretag">@var </span><span class="src-doc-type">integer </span></div></li> <li><div class="src-line"><a name="a1183"></a><span class="src-doc"> */</span></div></li> <li><div class="src-line"><a name="a1184"></a> <span class="src-key">var </span><a href="class.upload.html#var$jpeg_quality">$jpeg_quality</a><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a1185"></a> </div></li> <li><div class="src-line"><a name="a1186"></a> <span class="src-doc">/**</span></div></li> <li><div class="src-line"><a name="a1187"></a><span class="src-doc"> * Determines the quality of the JPG image to fit a desired file size</span></div></li> <li><div class="src-line"><a name="a1188"></a><span class="src-doc"> *</span></div></li> <li><div class="src-line"><a name="a1189"></a><span class="src-doc"> * Value is in bytes. The JPG quality will be set between 1 and 100%</span></div></li> <li><div class="src-line"><a name="a1190"></a><span class="src-doc"> * The calculations are approximations.</span></div></li> <li><div class="src-line"><a name="a1191"></a><span class="src-doc"> *</span></div></li> <li><div class="src-line"><a name="a1192"></a><span class="src-doc"> * Default value is null (no calculations)</span></div></li> <li><div class="src-line"><a name="a1193"></a><span class="src-doc"> *</span></div></li> <li><div class="src-line"><a name="a1194"></a><span class="src-doc"> * </span><span class="src-doc-coretag">@access</span><span class="src-doc"> public</span></div></li> <li><div class="src-line"><a name="a1195"></a><span class="src-doc"> * </span><span class="src-doc-coretag">@var </span><span class="src-doc-type">integer </span></div></li> <li><div class="src-line"><a name="a1196"></a><span class="src-doc"> */</span></div></li> <li><div class="src-line"><a name="a1197"></a> <span class="src-key">var </span><a href="class.upload.html#var$jpeg_size">$jpeg_size</a><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a1198"></a> </div></li> <li><div class="src-line"><a name="a1199"></a> <span class="src-doc">/**</span></div></li> <li><div class="src-line"><a name="a1200"></a><span class="src-doc"> * Preserve transparency when resizing or converting an image (deprecated)</span></div></li> <li><div class="src-line"><a name="a1201"></a><span class="src-doc"> *</span></div></li> <li><div class="src-line"><a name="a1202"></a><span class="src-doc"> * Default value is automatically set to true for transparent GIFs</span></div></li> <li><div class="src-line"><a name="a1203"></a><span class="src-doc"> * This setting is now deprecated</span></div></li> <li><div class="src-line"><a name="a1204"></a><span class="src-doc"> *</span></div></li> <li><div class="src-line"><a name="a1205"></a><span class="src-doc"> * </span><span class="src-doc-coretag">@access</span><span class="src-doc"> public</span></div></li> <li><div class="src-line"><a name="a1206"></a><span class="src-doc"> * </span><span class="src-doc-coretag">@var </span><span class="src-doc-type">integer </span></div></li> <li><div class="src-line"><a name="a1207"></a><span class="src-doc"> */</span></div></li> <li><div class="src-line"><a name="a1208"></a> <span class="src-key">var </span><a href="class.upload.html#var$preserve_transparency">$preserve_transparency</a><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a1209"></a> </div></li> <li><div class="src-line"><a name="a1210"></a> <span class="src-doc">/**</span></div></li> <li><div class="src-line"><a name="a1211"></a><span class="src-doc"> * Flag set to true when the image is transparent</span></div></li> <li><div class="src-line"><a name="a1212"></a><span class="src-doc"> *</span></div></li> <li><div class="src-line"><a name="a1213"></a><span class="src-doc"> * This is actually used only for transparent GIFs</span></div></li> <li><div class="src-line"><a name="a1214"></a><span class="src-doc"> *</span></div></li> <li><div class="src-line"><a name="a1215"></a><span class="src-doc"> * </span><span class="src-doc-coretag">@access</span><span class="src-doc"> public</span></div></li> <li><div class="src-line"><a name="a1216"></a><span class="src-doc"> * </span><span class="src-doc-coretag">@var </span><span class="src-doc-type">boolean </span></div></li> <li><div class="src-line"><a name="a1217"></a><span class="src-doc"> */</span></div></li> <li><div class="src-line"><a name="a1218"></a> <span class="src-key">var </span><a href="class.upload.html#var$image_is_transparent">$image_is_transparent</a><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a1219"></a> </div></li> <li><div class="src-line"><a name="a1220"></a> <span class="src-doc">/**</span></div></li> <li><div class="src-line"><a name="a1221"></a><span class="src-doc"> * Transparent color in a palette</span></div></li> <li><div class="src-line"><a name="a1222"></a><span class="src-doc"> *</span></div></li> <li><div class="src-line"><a name="a1223"></a><span class="src-doc"> * This is actually used only for transparent GIFs</span></div></li> <li><div class="src-line"><a name="a1224"></a><span class="src-doc"> *</span></div></li> <li><div class="src-line"><a name="a1225"></a><span class="src-doc"> * </span><span class="src-doc-coretag">@access</span><span class="src-doc"> public</span></div></li> <li><div class="src-line"><a name="a1226"></a><span class="src-doc"> * </span><span class="src-doc-coretag">@var </span><span class="src-doc-type">boolean </span></div></li> <li><div class="src-line"><a name="a1227"></a><span class="src-doc"> */</span></div></li> <li><div class="src-line"><a name="a1228"></a> <span class="src-key">var </span><a href="class.upload.html#var$image_transparent_color">$image_transparent_color</a><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a1229"></a> </div></li> <li><div class="src-line"><a name="a1230"></a> <span class="src-doc">/**</span></div></li> <li><div class="src-line"><a name="a1231"></a><span class="src-doc"> * Background color, used to paint transparent areas with</span></div></li> <li><div class="src-line"><a name="a1232"></a><span class="src-doc"> *</span></div></li> <li><div class="src-line"><a name="a1233"></a><span class="src-doc"> * If set, it will forcibly remove transparency by painting transparent areas with the color</span></div></li> <li><div class="src-line"><a name="a1234"></a><span class="src-doc"> * This setting will fill in all transparent areas in PNG and GIF, as opposed to </span><span class="src-doc-inlinetag">{@link image_default_color}</span></div></li> <li><div class="src-line"><a name="a1235"></a><span class="src-doc"> * which will do so only in BMP, JPEG, and alpha transparent areas in transparent GIFs</span></div></li> <li><div class="src-line"><a name="a1236"></a><span class="src-doc"> * This setting overrides </span><span class="src-doc-inlinetag">{@link image_default_color}</span></div></li> <li><div class="src-line"><a name="a1237"></a><span class="src-doc"> *</span></div></li> <li><div class="src-line"><a name="a1238"></a><span class="src-doc"> * Default value is null</span></div></li> <li><div class="src-line"><a name="a1239"></a><span class="src-doc"> *</span></div></li> <li><div class="src-line"><a name="a1240"></a><span class="src-doc"> * </span><span class="src-doc-coretag">@access</span><span class="src-doc"> public</span></div></li> <li><div class="src-line"><a name="a1241"></a><span class="src-doc"> * </span><span class="src-doc-coretag">@var </span><span class="src-doc-type">string </span></div></li> <li><div class="src-line"><a name="a1242"></a><span class="src-doc"> */</span></div></li> <li><div class="src-line"><a name="a1243"></a> <span class="src-key">var </span><a href="class.upload.html#var$image_background_color">$image_background_color</a><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a1244"></a> </div></li> <li><div class="src-line"><a name="a1245"></a> <span class="src-doc">/**</span></div></li> <li><div class="src-line"><a name="a1246"></a><span class="src-doc"> * Default color for non alpha-transparent images</span></div></li> <li><div class="src-line"><a name="a1247"></a><span class="src-doc"> *</span></div></li> <li><div class="src-line"><a name="a1248"></a><span class="src-doc"> * This setting is to be used to define a background color for semi transparent areas</span></div></li> <li><div class="src-line"><a name="a1249"></a><span class="src-doc"> * of an alpha transparent when the output format doesn't support alpha transparency</span></div></li> <li><div class="src-line"><a name="a1250"></a><span class="src-doc"> * This is useful when, from an alpha transparent PNG image, or an image with alpha transparent features</span></div></li> <li><div class="src-line"><a name="a1251"></a><span class="src-doc"> * if you want to output it as a transparent GIFs for instance, you can set a blending color for transparent areas</span></div></li> <li><div class="src-line"><a name="a1252"></a><span class="src-doc"> * If you output in JPEG or BMP, this color will be used to fill in the previously transparent areas</span></div></li> <li><div class="src-line"><a name="a1253"></a><span class="src-doc"> *</span></div></li> <li><div class="src-line"><a name="a1254"></a><span class="src-doc"> * The default color white</span></div></li> <li><div class="src-line"><a name="a1255"></a><span class="src-doc"> *</span></div></li> <li><div class="src-line"><a name="a1256"></a><span class="src-doc"> * </span><span class="src-doc-coretag">@access</span><span class="src-doc"> public</span></div></li> <li><div class="src-line"><a name="a1257"></a><span class="src-doc"> * </span><span class="src-doc-coretag">@var </span><span class="src-doc-type">boolean </span></div></li> <li><div class="src-line"><a name="a1258"></a><span class="src-doc"> */</span></div></li> <li><div class="src-line"><a name="a1259"></a> <span class="src-key">var </span><a href="class.upload.html#var$image_default_color">$image_default_color</a><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a1260"></a> </div></li> <li><div class="src-line"><a name="a1261"></a> <span class="src-doc">/**</span></div></li> <li><div class="src-line"><a name="a1262"></a><span class="src-doc"> * Flag set to true when the image is not true color</span></div></li> <li><div class="src-line"><a name="a1263"></a><span class="src-doc"> *</span></div></li> <li><div class="src-line"><a name="a1264"></a><span class="src-doc"> * </span><span class="src-doc-coretag">@access</span><span class="src-doc"> public</span></div></li> <li><div class="src-line"><a name="a1265"></a><span class="src-doc"> * </span><span class="src-doc-coretag">@var </span><span class="src-doc-type">boolean </span></div></li> <li><div class="src-line"><a name="a1266"></a><span class="src-doc"> */</span></div></li> <li><div class="src-line"><a name="a1267"></a> <span class="src-key">var </span><a href="class.upload.html#var$image_is_palette">$image_is_palette</a><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a1268"></a> </div></li> <li><div class="src-line"><a name="a1269"></a> <span class="src-doc">/**</span></div></li> <li><div class="src-line"><a name="a1270"></a><span class="src-doc"> * Corrects the image brightness</span></div></li> <li><div class="src-line"><a name="a1271"></a><span class="src-doc"> *</span></div></li> <li><div class="src-line"><a name="a1272"></a><span class="src-doc"> * Value can range between -127 and 127</span></div></li> <li><div class="src-line"><a name="a1273"></a><span class="src-doc"> *</span></div></li> <li><div class="src-line"><a name="a1274"></a><span class="src-doc"> * Default value is null</span></div></li> <li><div class="src-line"><a name="a1275"></a><span class="src-doc"> *</span></div></li> <li><div class="src-line"><a name="a1276"></a><span class="src-doc"> * </span><span class="src-doc-coretag">@access</span><span class="src-doc"> public</span></div></li> <li><div class="src-line"><a name="a1277"></a><span class="src-doc"> * </span><span class="src-doc-coretag">@var </span><span class="src-doc-type">integer </span></div></li> <li><div class="src-line"><a name="a1278"></a><span class="src-doc"> */</span></div></li> <li><div class="src-line"><a name="a1279"></a> <span class="src-key">var </span><a href="class.upload.html#var$image_brightness">$image_brightness</a><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a1280"></a> </div></li> <li><div class="src-line"><a name="a1281"></a> <span class="src-doc">/**</span></div></li> <li><div class="src-line"><a name="a1282"></a><span class="src-doc"> * Corrects the image contrast</span></div></li> <li><div class="src-line"><a name="a1283"></a><span class="src-doc"> *</span></div></li> <li><div class="src-line"><a name="a1284"></a><span class="src-doc"> * Value can range between -127 and 127</span></div></li> <li><div class="src-line"><a name="a1285"></a><span class="src-doc"> *</span></div></li> <li><div class="src-line"><a name="a1286"></a><span class="src-doc"> * Default value is null</span></div></li> <li><div class="src-line"><a name="a1287"></a><span class="src-doc"> *</span></div></li> <li><div class="src-line"><a name="a1288"></a><span class="src-doc"> * </span><span class="src-doc-coretag">@access</span><span class="src-doc"> public</span></div></li> <li><div class="src-line"><a name="a1289"></a><span class="src-doc"> * </span><span class="src-doc-coretag">@var </span><span class="src-doc-type">integer </span></div></li> <li><div class="src-line"><a name="a1290"></a><span class="src-doc"> */</span></div></li> <li><div class="src-line"><a name="a1291"></a> <span class="src-key">var </span><a href="class.upload.html#var$image_contrast">$image_contrast</a><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a1292"></a> </div></li> <li><div class="src-line"><a name="a1293"></a> <span class="src-doc">/**</span></div></li> <li><div class="src-line"><a name="a1294"></a><span class="src-doc"> * Applies threshold filter</span></div></li> <li><div class="src-line"><a name="a1295"></a><span class="src-doc"> *</span></div></li> <li><div class="src-line"><a name="a1296"></a><span class="src-doc"> * Value can range between -127 and 127</span></div></li> <li><div class="src-line"><a name="a1297"></a><span class="src-doc"> *</span></div></li> <li><div class="src-line"><a name="a1298"></a><span class="src-doc"> * Default value is null</span></div></li> <li><div class="src-line"><a name="a1299"></a><span class="src-doc"> *</span></div></li> <li><div class="src-line"><a name="a1300"></a><span class="src-doc"> * </span><span class="src-doc-coretag">@access</span><span class="src-doc"> public</span></div></li> <li><div class="src-line"><a name="a1301"></a><span class="src-doc"> * </span><span class="src-doc-coretag">@var </span><span class="src-doc-type">integer </span></div></li> <li><div class="src-line"><a name="a1302"></a><span class="src-doc"> */</span></div></li> <li><div class="src-line"><a name="a1303"></a> <span class="src-key">var </span><a href="class.upload.html#var$image_threshold">$image_threshold</a><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a1304"></a> </div></li> <li><div class="src-line"><a name="a1305"></a> <span class="src-doc">/**</span></div></li> <li><div class="src-line"><a name="a1306"></a><span class="src-doc"> * Applies a tint on the image</span></div></li> <li><div class="src-line"><a name="a1307"></a><span class="src-doc"> *</span></div></li> <li><div class="src-line"><a name="a1308"></a><span class="src-doc"> * Value is an hexadecimal color, such as #FFFFFF</span></div></li> <li><div class="src-line"><a name="a1309"></a><span class="src-doc"> *</span></div></li> <li><div class="src-line"><a name="a1310"></a><span class="src-doc"> * Default value is null</span></div></li> <li><div class="src-line"><a name="a1311"></a><span class="src-doc"> *</span></div></li> <li><div class="src-line"><a name="a1312"></a><span class="src-doc"> * </span><span class="src-doc-coretag">@access</span><span class="src-doc"> public</span></div></li> <li><div class="src-line"><a name="a1313"></a><span class="src-doc"> * </span><span class="src-doc-coretag">@var </span><span class="src-doc-type">string; </span></div></li> <li><div class="src-line"><a name="a1314"></a><span class="src-doc"> */</span></div></li> <li><div class="src-line"><a name="a1315"></a> <span class="src-key">var </span><a href="class.upload.html#var$image_tint_color">$image_tint_color</a><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a1316"></a> </div></li> <li><div class="src-line"><a name="a1317"></a> <span class="src-doc">/**</span></div></li> <li><div class="src-line"><a name="a1318"></a><span class="src-doc"> * Applies a colored overlay on the image</span></div></li> <li><div class="src-line"><a name="a1319"></a><span class="src-doc"> *</span></div></li> <li><div class="src-line"><a name="a1320"></a><span class="src-doc"> * Value is an hexadecimal color, such as #FFFFFF</span></div></li> <li><div class="src-line"><a name="a1321"></a><span class="src-doc"> *</span></div></li> <li><div class="src-line"><a name="a1322"></a><span class="src-doc"> * To use with </span><span class="src-doc-inlinetag">{@link image_overlay_percent}</span></div></li> <li><div class="src-line"><a name="a1323"></a><span class="src-doc"> *</span></div></li> <li><div class="src-line"><a name="a1324"></a><span class="src-doc"> * Default value is null</span></div></li> <li><div class="src-line"><a name="a1325"></a><span class="src-doc"> *</span></div></li> <li><div class="src-line"><a name="a1326"></a><span class="src-doc"> * </span><span class="src-doc-coretag">@access</span><span class="src-doc"> public</span></div></li> <li><div class="src-line"><a name="a1327"></a><span class="src-doc"> * </span><span class="src-doc-coretag">@var </span><span class="src-doc-type">string; </span></div></li> <li><div class="src-line"><a name="a1328"></a><span class="src-doc"> */</span></div></li> <li><div class="src-line"><a name="a1329"></a> <span class="src-key">var </span><a href="class.upload.html#var$image_overlay_color">$image_overlay_color</a><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a1330"></a> </div></li> <li><div class="src-line"><a name="a1331"></a> <span class="src-doc">/**</span></div></li> <li><div class="src-line"><a name="a1332"></a><span class="src-doc"> * Sets the percentage for the colored overlay</span></div></li> <li><div class="src-line"><a name="a1333"></a><span class="src-doc"> *</span></div></li> <li><div class="src-line"><a name="a1334"></a><span class="src-doc"> * Value is a percentage, as an integer between 0 and 100</span></div></li> <li><div class="src-line"><a name="a1335"></a><span class="src-doc"> *</span></div></li> <li><div class="src-line"><a name="a1336"></a><span class="src-doc"> * Unless used with </span><span class="src-doc-inlinetag">{@link image_overlay_color}</span><span class="src-doc">, this setting has no effect</span></div></li> <li><div class="src-line"><a name="a1337"></a><span class="src-doc"> *</span></div></li> <li><div class="src-line"><a name="a1338"></a><span class="src-doc"> * Default value is 50</span></div></li> <li><div class="src-line"><a name="a1339"></a><span class="src-doc"> *</span></div></li> <li><div class="src-line"><a name="a1340"></a><span class="src-doc"> * </span><span class="src-doc-coretag">@access</span><span class="src-doc"> public</span></div></li> <li><div class="src-line"><a name="a1341"></a><span class="src-doc"> * </span><span class="src-doc-coretag">@var </span><span class="src-doc-type">integer </span></div></li> <li><div class="src-line"><a name="a1342"></a><span class="src-doc"> */</span></div></li> <li><div class="src-line"><a name="a1343"></a> <span class="src-key">var </span><a href="class.upload.html#var$image_overlay_percent">$image_overlay_percent</a><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a1344"></a> </div></li> <li><div class="src-line"><a name="a1345"></a> <span class="src-doc">/**</span></div></li> <li><div class="src-line"><a name="a1346"></a><span class="src-doc"> * Inverts the color of an image</span></div></li> <li><div class="src-line"><a name="a1347"></a><span class="src-doc"> *</span></div></li> <li><div class="src-line"><a name="a1348"></a><span class="src-doc"> * Default value is FALSE</span></div></li> <li><div class="src-line"><a name="a1349"></a><span class="src-doc"> *</span></div></li> <li><div class="src-line"><a name="a1350"></a><span class="src-doc"> * </span><span class="src-doc-coretag">@access</span><span class="src-doc"> public</span></div></li> <li><div class="src-line"><a name="a1351"></a><span class="src-doc"> * </span><span class="src-doc-coretag">@var </span><span class="src-doc-type">boolean; </span></div></li> <li><div class="src-line"><a name="a1352"></a><span class="src-doc"> */</span></div></li> <li><div class="src-line"><a name="a1353"></a> <span class="src-key">var </span><a href="class.upload.html#var$image_negative">$image_negative</a><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a1354"></a> </div></li> <li><div class="src-line"><a name="a1355"></a> <span class="src-doc">/**</span></div></li> <li><div class="src-line"><a name="a1356"></a><span class="src-doc"> * Turns the image into greyscale</span></div></li> <li><div class="src-line"><a name="a1357"></a><span class="src-doc"> *</span></div></li> <li><div class="src-line"><a name="a1358"></a><span class="src-doc"> * Default value is FALSE</span></div></li> <li><div class="src-line"><a name="a1359"></a><span class="src-doc"> *</span></div></li> <li><div class="src-line"><a name="a1360"></a><span class="src-doc"> * </span><span class="src-doc-coretag">@access</span><span class="src-doc"> public</span></div></li> <li><div class="src-line"><a name="a1361"></a><span class="src-doc"> * </span><span class="src-doc-coretag">@var </span><span class="src-doc-type">boolean; </span></div></li> <li><div class="src-line"><a name="a1362"></a><span class="src-doc"> */</span></div></li> <li><div class="src-line"><a name="a1363"></a> <span class="src-key">var </span><a href="class.upload.html#var$image_greyscale">$image_greyscale</a><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a1364"></a> </div></li> <li><div class="src-line"><a name="a1365"></a> <span class="src-doc">/**</span></div></li> <li><div class="src-line"><a name="a1366"></a><span class="src-doc"> * Adds a text label on the image</span></div></li> <li><div class="src-line"><a name="a1367"></a><span class="src-doc"> *</span></div></li> <li><div class="src-line"><a name="a1368"></a><span class="src-doc"> * Value is a string, any text. Text will not word-wrap, although you can use breaklines in your text "\n"</span></div></li> <li><div class="src-line"><a name="a1369"></a><span class="src-doc"> *</span></div></li> <li><div class="src-line"><a name="a1370"></a><span class="src-doc"> * If set, this setting allow the use of all other settings starting with image_text_</span></div></li> <li><div class="src-line"><a name="a1371"></a><span class="src-doc"> *</span></div></li> <li><div class="src-line"><a name="a1372"></a><span class="src-doc"> * Replacement tokens can be used in the string:</span></div></li> <li><div class="src-line"><a name="a1373"></a><span class="src-doc"> * <pre></span></div></li> <li><div class="src-line"><a name="a1374"></a><span class="src-doc"> * gd_version src_name src_name_body src_name_ext</span></div></li> <li><div class="src-line"><a name="a1375"></a><span class="src-doc"> * src_pathname src_mime src_x src_y</span></div></li> <li><div class="src-line"><a name="a1376"></a><span class="src-doc"> * src_type src_bits src_pixels</span></div></li> <li><div class="src-line"><a name="a1377"></a><span class="src-doc"> * src_size src_size_kb src_size_mb src_size_human</span></div></li> <li><div class="src-line"><a name="a1378"></a><span class="src-doc"> * dst_path dst_name_body dst_pathname</span></div></li> <li><div class="src-line"><a name="a1379"></a><span class="src-doc"> * dst_name dst_name_ext dst_x dst_y</span></div></li> <li><div class="src-line"><a name="a1380"></a><span class="src-doc"> * date time host server ip</span></div></li> <li><div class="src-line"><a name="a1381"></a><span class="src-doc"> * </pre></span></div></li> <li><div class="src-line"><a name="a1382"></a><span class="src-doc"> * The tokens must be enclosed in square brackets: [dst_x] will be replaced by the width of the picture</span></div></li> <li><div class="src-line"><a name="a1383"></a><span class="src-doc"> *</span></div></li> <li><div class="src-line"><a name="a1384"></a><span class="src-doc"> * Default value is null</span></div></li> <li><div class="src-line"><a name="a1385"></a><span class="src-doc"> *</span></div></li> <li><div class="src-line"><a name="a1386"></a><span class="src-doc"> * </span><span class="src-doc-coretag">@access</span><span class="src-doc"> public</span></div></li> <li><div class="src-line"><a name="a1387"></a><span class="src-doc"> * </span><span class="src-doc-coretag">@var </span><span class="src-doc-type">string; </span></div></li> <li><div class="src-line"><a name="a1388"></a><span class="src-doc"> */</span></div></li> <li><div class="src-line"><a name="a1389"></a> <span class="src-key">var </span><a href="class.upload.html#var$image_text">$image_text</a><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a1390"></a> </div></li> <li><div class="src-line"><a name="a1391"></a> <span class="src-doc">/**</span></div></li> <li><div class="src-line"><a name="a1392"></a><span class="src-doc"> * Sets the text direction for the text label</span></div></li> <li><div class="src-line"><a name="a1393"></a><span class="src-doc"> *</span></div></li> <li><div class="src-line"><a name="a1394"></a><span class="src-doc"> * Value is either 'h' or 'v', as in horizontal and vertical</span></div></li> <li><div class="src-line"><a name="a1395"></a><span class="src-doc"> *</span></div></li> <li><div class="src-line"><a name="a1396"></a><span class="src-doc"> * Default value is h (horizontal)</span></div></li> <li><div class="src-line"><a name="a1397"></a><span class="src-doc"> *</span></div></li> <li><div class="src-line"><a name="a1398"></a><span class="src-doc"> * </span><span class="src-doc-coretag">@access</span><span class="src-doc"> public</span></div></li> <li><div class="src-line"><a name="a1399"></a><span class="src-doc"> * </span><span class="src-doc-coretag">@var </span><span class="src-doc-type">string; </span></div></li> <li><div class="src-line"><a name="a1400"></a><span class="src-doc"> */</span></div></li> <li><div class="src-line"><a name="a1401"></a> <span class="src-key">var </span><a href="class.upload.html#var$image_text_direction">$image_text_direction</a><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a1402"></a> </div></li> <li><div class="src-line"><a name="a1403"></a> <span class="src-doc">/**</span></div></li> <li><div class="src-line"><a name="a1404"></a><span class="src-doc"> * Sets the text color for the text label</span></div></li> <li><div class="src-line"><a name="a1405"></a><span class="src-doc"> *</span></div></li> <li><div class="src-line"><a name="a1406"></a><span class="src-doc"> * Value is an hexadecimal color, such as #FFFFFF</span></div></li> <li><div class="src-line"><a name="a1407"></a><span class="src-doc"> *</span></div></li> <li><div class="src-line"><a name="a1408"></a><span class="src-doc"> * Default value is #FFFFFF (white)</span></div></li> <li><div class="src-line"><a name="a1409"></a><span class="src-doc"> *</span></div></li> <li><div class="src-line"><a name="a1410"></a><span class="src-doc"> * </span><span class="src-doc-coretag">@access</span><span class="src-doc"> public</span></div></li> <li><div class="src-line"><a name="a1411"></a><span class="src-doc"> * </span><span class="src-doc-coretag">@var </span><span class="src-doc-type">string; </span></div></li> <li><div class="src-line"><a name="a1412"></a><span class="src-doc"> */</span></div></li> <li><div class="src-line"><a name="a1413"></a> <span class="src-key">var </span><a href="class.upload.html#var$image_text_color">$image_text_color</a><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a1414"></a> </div></li> <li><div class="src-line"><a name="a1415"></a> <span class="src-doc">/**</span></div></li> <li><div class="src-line"><a name="a1416"></a><span class="src-doc"> * Sets the text visibility in the text label</span></div></li> <li><div class="src-line"><a name="a1417"></a><span class="src-doc"> *</span></div></li> <li><div class="src-line"><a name="a1418"></a><span class="src-doc"> * Value is a percentage, as an integer between 0 and 100</span></div></li> <li><div class="src-line"><a name="a1419"></a><span class="src-doc"> *</span></div></li> <li><div class="src-line"><a name="a1420"></a><span class="src-doc"> * Default value is 100</span></div></li> <li><div class="src-line"><a name="a1421"></a><span class="src-doc"> *</span></div></li> <li><div class="src-line"><a name="a1422"></a><span class="src-doc"> * </span><span class="src-doc-coretag">@access</span><span class="src-doc"> public</span></div></li> <li><div class="src-line"><a name="a1423"></a><span class="src-doc"> * </span><span class="src-doc-coretag">@var </span><span class="src-doc-type">integer </span></div></li> <li><div class="src-line"><a name="a1424"></a><span class="src-doc"> */</span></div></li> <li><div class="src-line"><a name="a1425"></a> <span class="src-key">var </span><a href="class.upload.html#var$image_text_percent">$image_text_percent</a><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a1426"></a> </div></li> <li><div class="src-line"><a name="a1427"></a> <span class="src-doc">/**</span></div></li> <li><div class="src-line"><a name="a1428"></a><span class="src-doc"> * Sets the text background color for the text label</span></div></li> <li><div class="src-line"><a name="a1429"></a><span class="src-doc"> *</span></div></li> <li><div class="src-line"><a name="a1430"></a><span class="src-doc"> * Value is an hexadecimal color, such as #FFFFFF</span></div></li> <li><div class="src-line"><a name="a1431"></a><span class="src-doc"> *</span></div></li> <li><div class="src-line"><a name="a1432"></a><span class="src-doc"> * Default value is null (no background)</span></div></li> <li><div class="src-line"><a name="a1433"></a><span class="src-doc"> *</span></div></li> <li><div class="src-line"><a name="a1434"></a><span class="src-doc"> * </span><span class="src-doc-coretag">@access</span><span class="src-doc"> public</span></div></li> <li><div class="src-line"><a name="a1435"></a><span class="src-doc"> * </span><span class="src-doc-coretag">@var </span><span class="src-doc-type">string; </span></div></li> <li><div class="src-line"><a name="a1436"></a><span class="src-doc"> */</span></div></li> <li><div class="src-line"><a name="a1437"></a> <span class="src-key">var </span><a href="class.upload.html#var$image_text_background">$image_text_background</a><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a1438"></a> </div></li> <li><div class="src-line"><a name="a1439"></a> <span class="src-doc">/**</span></div></li> <li><div class="src-line"><a name="a1440"></a><span class="src-doc"> * Sets the text background visibility in the text label</span></div></li> <li><div class="src-line"><a name="a1441"></a><span class="src-doc"> *</span></div></li> <li><div class="src-line"><a name="a1442"></a><span class="src-doc"> * Value is a percentage, as an integer between 0 and 100</span></div></li> <li><div class="src-line"><a name="a1443"></a><span class="src-doc"> *</span></div></li> <li><div class="src-line"><a name="a1444"></a><span class="src-doc"> * Default value is 100</span></div></li> <li><div class="src-line"><a name="a1445"></a><span class="src-doc"> *</span></div></li> <li><div class="src-line"><a name="a1446"></a><span class="src-doc"> * </span><span class="src-doc-coretag">@access</span><span class="src-doc"> public</span></div></li> <li><div class="src-line"><a name="a1447"></a><span class="src-doc"> * </span><span class="src-doc-coretag">@var </span><span class="src-doc-type">integer </span></div></li> <li><div class="src-line"><a name="a1448"></a><span class="src-doc"> */</span></div></li> <li><div class="src-line"><a name="a1449"></a> <span class="src-key">var </span><a href="class.upload.html#var$image_text_background_percent">$image_text_background_percent</a><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a1450"></a> </div></li> <li><div class="src-line"><a name="a1451"></a> <span class="src-doc">/**</span></div></li> <li><div class="src-line"><a name="a1452"></a><span class="src-doc"> * Sets the text font in the text label</span></div></li> <li><div class="src-line"><a name="a1453"></a><span class="src-doc"> *</span></div></li> <li><div class="src-line"><a name="a1454"></a><span class="src-doc"> * Value is a an integer between 1 and 5 for GD built-in fonts. 1 is the smallest font, 5 the biggest</span></div></li> <li><div class="src-line"><a name="a1455"></a><span class="src-doc"> * Value can also be a string, which represents the path to a GDF font. The font will be loaded into GD, and used as a built-in font.</span></div></li> <li><div class="src-line"><a name="a1456"></a><span class="src-doc"> *</span></div></li> <li><div class="src-line"><a name="a1457"></a><span class="src-doc"> * Default value is 5</span></div></li> <li><div class="src-line"><a name="a1458"></a><span class="src-doc"> *</span></div></li> <li><div class="src-line"><a name="a1459"></a><span class="src-doc"> * </span><span class="src-doc-coretag">@access</span><span class="src-doc"> public</span></div></li> <li><div class="src-line"><a name="a1460"></a><span class="src-doc"> * </span><span class="src-doc-coretag">@var </span><span class="src-doc-type">mixed; </span></div></li> <li><div class="src-line"><a name="a1461"></a><span class="src-doc"> */</span></div></li> <li><div class="src-line"><a name="a1462"></a> <span class="src-key">var </span><a href="class.upload.html#var$image_text_font">$image_text_font</a><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a1463"></a> </div></li> <li><div class="src-line"><a name="a1464"></a> <span class="src-doc">/**</span></div></li> <li><div class="src-line"><a name="a1465"></a><span class="src-doc"> * Sets the text label position within the image</span></div></li> <li><div class="src-line"><a name="a1466"></a><span class="src-doc"> *</span></div></li> <li><div class="src-line"><a name="a1467"></a><span class="src-doc"> * Value is one or two out of 'TBLR' (top, bottom, left, right)</span></div></li> <li><div class="src-line"><a name="a1468"></a><span class="src-doc"> *</span></div></li> <li><div class="src-line"><a name="a1469"></a><span class="src-doc"> * The positions are as following:</span></div></li> <li><div class="src-line"><a name="a1470"></a><span class="src-doc"> * <pre></span></div></li> <li><div class="src-line"><a name="a1471"></a><span class="src-doc"> * TL T TR</span></div></li> <li><div class="src-line"><a name="a1472"></a><span class="src-doc"> * L R</span></div></li> <li><div class="src-line"><a name="a1473"></a><span class="src-doc"> * BL B BR</span></div></li> <li><div class="src-line"><a name="a1474"></a><span class="src-doc"> * </pre></span></div></li> <li><div class="src-line"><a name="a1475"></a><span class="src-doc"> *</span></div></li> <li><div class="src-line"><a name="a1476"></a><span class="src-doc"> * Default value is null (centered, horizontal and vertical)</span></div></li> <li><div class="src-line"><a name="a1477"></a><span class="src-doc"> *</span></div></li> <li><div class="src-line"><a name="a1478"></a><span class="src-doc"> * Note that is </span><span class="src-doc-inlinetag">{@link image_text_x}</span><span class="src-doc"> and </span><span class="src-doc-inlinetag">{@link image_text_y}</span><span class="src-doc"> are used, this setting has no effect</span></div></li> <li><div class="src-line"><a name="a1479"></a><span class="src-doc"> *</span></div></li> <li><div class="src-line"><a name="a1480"></a><span class="src-doc"> * </span><span class="src-doc-coretag">@access</span><span class="src-doc"> public</span></div></li> <li><div class="src-line"><a name="a1481"></a><span class="src-doc"> * </span><span class="src-doc-coretag">@var </span><span class="src-doc-type">string; </span></div></li> <li><div class="src-line"><a name="a1482"></a><span class="src-doc"> */</span></div></li> <li><div class="src-line"><a name="a1483"></a> <span class="src-key">var </span><a href="class.upload.html#var$image_text_position">$image_text_position</a><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a1484"></a> </div></li> <li><div class="src-line"><a name="a1485"></a> <span class="src-doc">/**</span></div></li> <li><div class="src-line"><a name="a1486"></a><span class="src-doc"> * Sets the text label absolute X position within the image</span></div></li> <li><div class="src-line"><a name="a1487"></a><span class="src-doc"> *</span></div></li> <li><div class="src-line"><a name="a1488"></a><span class="src-doc"> * Value is in pixels, representing the distance between the left of the image and the label</span></div></li> <li><div class="src-line"><a name="a1489"></a><span class="src-doc"> * If a negative value is used, it will represent the distance between the right of the image and the label</span></div></li> <li><div class="src-line"><a name="a1490"></a><span class="src-doc"> *</span></div></li> <li><div class="src-line"><a name="a1491"></a><span class="src-doc"> * Default value is null (so </span><span class="src-doc-inlinetag">{@link image_text_position}</span><span class="src-doc"> is used)</span></div></li> <li><div class="src-line"><a name="a1492"></a><span class="src-doc"> *</span></div></li> <li><div class="src-line"><a name="a1493"></a><span class="src-doc"> * </span><span class="src-doc-coretag">@access</span><span class="src-doc"> public</span></div></li> <li><div class="src-line"><a name="a1494"></a><span class="src-doc"> * </span><span class="src-doc-coretag">@var </span><span class="src-doc-type">integer </span></div></li> <li><div class="src-line"><a name="a1495"></a><span class="src-doc"> */</span></div></li> <li><div class="src-line"><a name="a1496"></a> <span class="src-key">var </span><a href="class.upload.html#var$image_text_x">$image_text_x</a><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a1497"></a> </div></li> <li><div class="src-line"><a name="a1498"></a> <span class="src-doc">/**</span></div></li> <li><div class="src-line"><a name="a1499"></a><span class="src-doc"> * Sets the text label absolute Y position within the image</span></div></li> <li><div class="src-line"><a name="a1500"></a><span class="src-doc"> *</span></div></li> <li><div class="src-line"><a name="a1501"></a><span class="src-doc"> * Value is in pixels, representing the distance between the top of the image and the label</span></div></li> <li><div class="src-line"><a name="a1502"></a><span class="src-doc"> * If a negative value is used, it will represent the distance between the bottom of the image and the label</span></div></li> <li><div class="src-line"><a name="a1503"></a><span class="src-doc"> *</span></div></li> <li><div class="src-line"><a name="a1504"></a><span class="src-doc"> * Default value is null (so </span><span class="src-doc-inlinetag">{@link image_text_position}</span><span class="src-doc"> is used)</span></div></li> <li><div class="src-line"><a name="a1505"></a><span class="src-doc"> *</span></div></li> <li><div class="src-line"><a name="a1506"></a><span class="src-doc"> * </span><span class="src-doc-coretag">@access</span><span class="src-doc"> public</span></div></li> <li><div class="src-line"><a name="a1507"></a><span class="src-doc"> * </span><span class="src-doc-coretag">@var </span><span class="src-doc-type">integer </span></div></li> <li><div class="src-line"><a name="a1508"></a><span class="src-doc"> */</span></div></li> <li><div class="src-line"><a name="a1509"></a> <span class="src-key">var </span><a href="class.upload.html#var$image_text_y">$image_text_y</a><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a1510"></a> </div></li> <li><div class="src-line"><a name="a1511"></a> <span class="src-doc">/**</span></div></li> <li><div class="src-line"><a name="a1512"></a><span class="src-doc"> * Sets the text label padding</span></div></li> <li><div class="src-line"><a name="a1513"></a><span class="src-doc"> *</span></div></li> <li><div class="src-line"><a name="a1514"></a><span class="src-doc"> * Value is in pixels, representing the distance between the text and the label background border</span></div></li> <li><div class="src-line"><a name="a1515"></a><span class="src-doc"> *</span></div></li> <li><div class="src-line"><a name="a1516"></a><span class="src-doc"> * Default value is 0</span></div></li> <li><div class="src-line"><a name="a1517"></a><span class="src-doc"> *</span></div></li> <li><div class="src-line"><a name="a1518"></a><span class="src-doc"> * This setting can be overriden by </span><span class="src-doc-inlinetag">{@link image_text_padding_x}</span><span class="src-doc"> and </span><span class="src-doc-inlinetag">{@link image_text_padding_y}</span></div></li> <li><div class="src-line"><a name="a1519"></a><span class="src-doc"> *</span></div></li> <li><div class="src-line"><a name="a1520"></a><span class="src-doc"> * </span><span class="src-doc-coretag">@access</span><span class="src-doc"> public</span></div></li> <li><div class="src-line"><a name="a1521"></a><span class="src-doc"> * </span><span class="src-doc-coretag">@var </span><span class="src-doc-type">integer </span></div></li> <li><div class="src-line"><a name="a1522"></a><span class="src-doc"> */</span></div></li> <li><div class="src-line"><a name="a1523"></a> <span class="src-key">var </span><a href="class.upload.html#var$image_text_padding">$image_text_padding</a><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a1524"></a> </div></li> <li><div class="src-line"><a name="a1525"></a> <span class="src-doc">/**</span></div></li> <li><div class="src-line"><a name="a1526"></a><span class="src-doc"> * Sets the text label horizontal padding</span></div></li> <li><div class="src-line"><a name="a1527"></a><span class="src-doc"> *</span></div></li> <li><div class="src-line"><a name="a1528"></a><span class="src-doc"> * Value is in pixels, representing the distance between the text and the left and right label background borders</span></div></li> <li><div class="src-line"><a name="a1529"></a><span class="src-doc"> *</span></div></li> <li><div class="src-line"><a name="a1530"></a><span class="src-doc"> * Default value is null</span></div></li> <li><div class="src-line"><a name="a1531"></a><span class="src-doc"> *</span></div></li> <li><div class="src-line"><a name="a1532"></a><span class="src-doc"> * If set, this setting overrides the horizontal part of </span><span class="src-doc-inlinetag">{@link image_text_padding}</span></div></li> <li><div class="src-line"><a name="a1533"></a><span class="src-doc"> *</span></div></li> <li><div class="src-line"><a name="a1534"></a><span class="src-doc"> * </span><span class="src-doc-coretag">@access</span><span class="src-doc"> public</span></div></li> <li><div class="src-line"><a name="a1535"></a><span class="src-doc"> * </span><span class="src-doc-coretag">@var </span><span class="src-doc-type">integer </span></div></li> <li><div class="src-line"><a name="a1536"></a><span class="src-doc"> */</span></div></li> <li><div class="src-line"><a name="a1537"></a> <span class="src-key">var </span><a href="class.upload.html#var$image_text_padding_x">$image_text_padding_x</a><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a1538"></a> </div></li> <li><div class="src-line"><a name="a1539"></a> <span class="src-doc">/**</span></div></li> <li><div class="src-line"><a name="a1540"></a><span class="src-doc"> * Sets the text label vertical padding</span></div></li> <li><div class="src-line"><a name="a1541"></a><span class="src-doc"> *</span></div></li> <li><div class="src-line"><a name="a1542"></a><span class="src-doc"> * Value is in pixels, representing the distance between the text and the top and bottom label background borders</span></div></li> <li><div class="src-line"><a name="a1543"></a><span class="src-doc"> *</span></div></li> <li><div class="src-line"><a name="a1544"></a><span class="src-doc"> * Default value is null</span></div></li> <li><div class="src-line"><a name="a1545"></a><span class="src-doc"> *</span></div></li> <li><div class="src-line"><a name="a1546"></a><span class="src-doc"> * If set, his setting overrides the vertical part of </span><span class="src-doc-inlinetag">{@link image_text_padding}</span></div></li> <li><div class="src-line"><a name="a1547"></a><span class="src-doc"> *</span></div></li> <li><div class="src-line"><a name="a1548"></a><span class="src-doc"> * </span><span class="src-doc-coretag">@access</span><span class="src-doc"> public</span></div></li> <li><div class="src-line"><a name="a1549"></a><span class="src-doc"> * </span><span class="src-doc-coretag">@var </span><span class="src-doc-type">integer </span></div></li> <li><div class="src-line"><a name="a1550"></a><span class="src-doc"> */</span></div></li> <li><div class="src-line"><a name="a1551"></a> <span class="src-key">var </span><a href="class.upload.html#var$image_text_padding_y">$image_text_padding_y</a><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a1552"></a> </div></li> <li><div class="src-line"><a name="a1553"></a> <span class="src-doc">/**</span></div></li> <li><div class="src-line"><a name="a1554"></a><span class="src-doc"> * Sets the text alignment</span></div></li> <li><div class="src-line"><a name="a1555"></a><span class="src-doc"> *</span></div></li> <li><div class="src-line"><a name="a1556"></a><span class="src-doc"> * Value is a string, which can be either 'L', 'C' or 'R'</span></div></li> <li><div class="src-line"><a name="a1557"></a><span class="src-doc"> *</span></div></li> <li><div class="src-line"><a name="a1558"></a><span class="src-doc"> * Default value is 'C'</span></div></li> <li><div class="src-line"><a name="a1559"></a><span class="src-doc"> *</span></div></li> <li><div class="src-line"><a name="a1560"></a><span class="src-doc"> * This setting is relevant only if the text has several lines.</span></div></li> <li><div class="src-line"><a name="a1561"></a><span class="src-doc"> *</span></div></li> <li><div class="src-line"><a name="a1562"></a><span class="src-doc"> * </span><span class="src-doc-coretag">@access</span><span class="src-doc"> public</span></div></li> <li><div class="src-line"><a name="a1563"></a><span class="src-doc"> * </span><span class="src-doc-coretag">@var </span><span class="src-doc-type">string; </span></div></li> <li><div class="src-line"><a name="a1564"></a><span class="src-doc"> */</span></div></li> <li><div class="src-line"><a name="a1565"></a> <span class="src-key">var </span><a href="class.upload.html#var$image_text_alignment">$image_text_alignment</a><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a1566"></a> </div></li> <li><div class="src-line"><a name="a1567"></a> <span class="src-doc">/**</span></div></li> <li><div class="src-line"><a name="a1568"></a><span class="src-doc"> * Sets the text line spacing</span></div></li> <li><div class="src-line"><a name="a1569"></a><span class="src-doc"> *</span></div></li> <li><div class="src-line"><a name="a1570"></a><span class="src-doc"> * Value is an integer, in pixels</span></div></li> <li><div class="src-line"><a name="a1571"></a><span class="src-doc"> *</span></div></li> <li><div class="src-line"><a name="a1572"></a><span class="src-doc"> * Default value is 0</span></div></li> <li><div class="src-line"><a name="a1573"></a><span class="src-doc"> *</span></div></li> <li><div class="src-line"><a name="a1574"></a><span class="src-doc"> * This setting is relevant only if the text has several lines.</span></div></li> <li><div class="src-line"><a name="a1575"></a><span class="src-doc"> *</span></div></li> <li><div class="src-line"><a name="a1576"></a><span class="src-doc"> * </span><span class="src-doc-coretag">@access</span><span class="src-doc"> public</span></div></li> <li><div class="src-line"><a name="a1577"></a><span class="src-doc"> * </span><span class="src-doc-coretag">@var </span><span class="src-doc-type">integer </span></div></li> <li><div class="src-line"><a name="a1578"></a><span class="src-doc"> */</span></div></li> <li><div class="src-line"><a name="a1579"></a> <span class="src-key">var </span><a href="class.upload.html#var$image_text_line_spacing">$image_text_line_spacing</a><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a1580"></a> </div></li> <li><div class="src-line"><a name="a1581"></a> <span class="src-doc">/**</span></div></li> <li><div class="src-line"><a name="a1582"></a><span class="src-doc"> * Sets the height of the reflection</span></div></li> <li><div class="src-line"><a name="a1583"></a><span class="src-doc"> *</span></div></li> <li><div class="src-line"><a name="a1584"></a><span class="src-doc"> * Value is an integer in pixels, or a string which format can be in pixels or percentage.</span></div></li> <li><div class="src-line"><a name="a1585"></a><span class="src-doc"> * For instance, values can be : 40, '40', '40px' or '40%'</span></div></li> <li><div class="src-line"><a name="a1586"></a><span class="src-doc"> *</span></div></li> <li><div class="src-line"><a name="a1587"></a><span class="src-doc"> * Default value is null, no reflection</span></div></li> <li><div class="src-line"><a name="a1588"></a><span class="src-doc"> *</span></div></li> <li><div class="src-line"><a name="a1589"></a><span class="src-doc"> * </span><span class="src-doc-coretag">@access</span><span class="src-doc"> public</span></div></li> <li><div class="src-line"><a name="a1590"></a><span class="src-doc"> * </span><span class="src-doc-coretag">@var </span><span class="src-doc-type">mixed; </span></div></li> <li><div class="src-line"><a name="a1591"></a><span class="src-doc"> */</span></div></li> <li><div class="src-line"><a name="a1592"></a> <span class="src-key">var </span><a href="class.upload.html#var$image_reflection_height">$image_reflection_height</a><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a1593"></a> </div></li> <li><div class="src-line"><a name="a1594"></a> <span class="src-doc">/**</span></div></li> <li><div class="src-line"><a name="a1595"></a><span class="src-doc"> * Sets the space between the source image and its relection</span></div></li> <li><div class="src-line"><a name="a1596"></a><span class="src-doc"> *</span></div></li> <li><div class="src-line"><a name="a1597"></a><span class="src-doc"> * Value is an integer in pixels, which can be negative</span></div></li> <li><div class="src-line"><a name="a1598"></a><span class="src-doc"> *</span></div></li> <li><div class="src-line"><a name="a1599"></a><span class="src-doc"> * Default value is 2</span></div></li> <li><div class="src-line"><a name="a1600"></a><span class="src-doc"> *</span></div></li> <li><div class="src-line"><a name="a1601"></a><span class="src-doc"> * This setting is relevant only if </span><span class="src-doc-inlinetag">{@link image_reflection_height}</span><span class="src-doc"> is set</span></div></li> <li><div class="src-line"><a name="a1602"></a><span class="src-doc"> *</span></div></li> <li><div class="src-line"><a name="a1603"></a><span class="src-doc"> * </span><span class="src-doc-coretag">@access</span><span class="src-doc"> public</span></div></li> <li><div class="src-line"><a name="a1604"></a><span class="src-doc"> * </span><span class="src-doc-coretag">@var </span><span class="src-doc-type">integer </span></div></li> <li><div class="src-line"><a name="a1605"></a><span class="src-doc"> */</span></div></li> <li><div class="src-line"><a name="a1606"></a> <span class="src-key">var </span><a href="class.upload.html#var$image_reflection_space">$image_reflection_space</a><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a1607"></a> </div></li> <li><div class="src-line"><a name="a1608"></a> <span class="src-doc">/**</span></div></li> <li><div class="src-line"><a name="a1609"></a><span class="src-doc"> * Sets the color of the reflection background (deprecated)</span></div></li> <li><div class="src-line"><a name="a1610"></a><span class="src-doc"> *</span></div></li> <li><div class="src-line"><a name="a1611"></a><span class="src-doc"> * Value is an hexadecimal color, such as #FFFFFF</span></div></li> <li><div class="src-line"><a name="a1612"></a><span class="src-doc"> *</span></div></li> <li><div class="src-line"><a name="a1613"></a><span class="src-doc"> * Default value is #FFFFFF</span></div></li> <li><div class="src-line"><a name="a1614"></a><span class="src-doc"> *</span></div></li> <li><div class="src-line"><a name="a1615"></a><span class="src-doc"> * This setting is relevant only if </span><span class="src-doc-inlinetag">{@link image_reflection_height}</span><span class="src-doc"> is set</span></div></li> <li><div class="src-line"><a name="a1616"></a><span class="src-doc"> *</span></div></li> <li><div class="src-line"><a name="a1617"></a><span class="src-doc"> * This setting is now deprecated in favor of </span><span class="src-doc-inlinetag">{@link image_default_color}</span></div></li> <li><div class="src-line"><a name="a1618"></a><span class="src-doc"> *</span></div></li> <li><div class="src-line"><a name="a1619"></a><span class="src-doc"> * </span><span class="src-doc-coretag">@access</span><span class="src-doc"> public</span></div></li> <li><div class="src-line"><a name="a1620"></a><span class="src-doc"> * </span><span class="src-doc-coretag">@var </span><span class="src-doc-type">string; </span></div></li> <li><div class="src-line"><a name="a1621"></a><span class="src-doc"> */</span></div></li> <li><div class="src-line"><a name="a1622"></a> <span class="src-key">var </span><a href="class.upload.html#var$image_reflection_color">$image_reflection_color</a><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a1623"></a> </div></li> <li><div class="src-line"><a name="a1624"></a> <span class="src-doc">/**</span></div></li> <li><div class="src-line"><a name="a1625"></a><span class="src-doc"> * Sets the initial opacity of the reflection</span></div></li> <li><div class="src-line"><a name="a1626"></a><span class="src-doc"> *</span></div></li> <li><div class="src-line"><a name="a1627"></a><span class="src-doc"> * Value is an integer between 0 (no opacity) and 100 (full opacity).</span></div></li> <li><div class="src-line"><a name="a1628"></a><span class="src-doc"> * The reflection will start from </span><span class="src-doc-inlinetag">{@link image_reflection_opacity}</span><span class="src-doc"> and end up at 0</span></div></li> <li><div class="src-line"><a name="a1629"></a><span class="src-doc"> *</span></div></li> <li><div class="src-line"><a name="a1630"></a><span class="src-doc"> * Default value is 60</span></div></li> <li><div class="src-line"><a name="a1631"></a><span class="src-doc"> *</span></div></li> <li><div class="src-line"><a name="a1632"></a><span class="src-doc"> * This setting is relevant only if </span><span class="src-doc-inlinetag">{@link image_reflection_height}</span><span class="src-doc"> is set</span></div></li> <li><div class="src-line"><a name="a1633"></a><span class="src-doc"> *</span></div></li> <li><div class="src-line"><a name="a1634"></a><span class="src-doc"> * </span><span class="src-doc-coretag">@access</span><span class="src-doc"> public</span></div></li> <li><div class="src-line"><a name="a1635"></a><span class="src-doc"> * </span><span class="src-doc-coretag">@var </span><span class="src-doc-type">integer </span></div></li> <li><div class="src-line"><a name="a1636"></a><span class="src-doc"> */</span></div></li> <li><div class="src-line"><a name="a1637"></a> <span class="src-key">var </span><a href="class.upload.html#var$image_reflection_opacity">$image_reflection_opacity</a><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a1638"></a> </div></li> <li><div class="src-line"><a name="a1639"></a> <span class="src-doc">/**</span></div></li> <li><div class="src-line"><a name="a1640"></a><span class="src-doc"> * Flips the image vertically or horizontally</span></div></li> <li><div class="src-line"><a name="a1641"></a><span class="src-doc"> *</span></div></li> <li><div class="src-line"><a name="a1642"></a><span class="src-doc"> * Value is either 'h' or 'v', as in horizontal and vertical</span></div></li> <li><div class="src-line"><a name="a1643"></a><span class="src-doc"> *</span></div></li> <li><div class="src-line"><a name="a1644"></a><span class="src-doc"> * Default value is null (no flip)</span></div></li> <li><div class="src-line"><a name="a1645"></a><span class="src-doc"> *</span></div></li> <li><div class="src-line"><a name="a1646"></a><span class="src-doc"> * </span><span class="src-doc-coretag">@access</span><span class="src-doc"> public</span></div></li> <li><div class="src-line"><a name="a1647"></a><span class="src-doc"> * </span><span class="src-doc-coretag">@var </span><span class="src-doc-type">string; </span></div></li> <li><div class="src-line"><a name="a1648"></a><span class="src-doc"> */</span></div></li> <li><div class="src-line"><a name="a1649"></a> <span class="src-key">var </span><a href="class.upload.html#var$image_flip">$image_flip</a><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a1650"></a> </div></li> <li><div class="src-line"><a name="a1651"></a> <span class="src-doc">/**</span></div></li> <li><div class="src-line"><a name="a1652"></a><span class="src-doc"> * Rotates the image by increments of 45 degrees</span></div></li> <li><div class="src-line"><a name="a1653"></a><span class="src-doc"> *</span></div></li> <li><div class="src-line"><a name="a1654"></a><span class="src-doc"> * Value is either 90, 180 or 270</span></div></li> <li><div class="src-line"><a name="a1655"></a><span class="src-doc"> *</span></div></li> <li><div class="src-line"><a name="a1656"></a><span class="src-doc"> * Default value is null (no rotation)</span></div></li> <li><div class="src-line"><a name="a1657"></a><span class="src-doc"> *</span></div></li> <li><div class="src-line"><a name="a1658"></a><span class="src-doc"> * </span><span class="src-doc-coretag">@access</span><span class="src-doc"> public</span></div></li> <li><div class="src-line"><a name="a1659"></a><span class="src-doc"> * </span><span class="src-doc-coretag">@var </span><span class="src-doc-type">string; </span></div></li> <li><div class="src-line"><a name="a1660"></a><span class="src-doc"> */</span></div></li> <li><div class="src-line"><a name="a1661"></a> <span class="src-key">var </span><a href="class.upload.html#var$image_rotate">$image_rotate</a><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a1662"></a> </div></li> <li><div class="src-line"><a name="a1663"></a> <span class="src-doc">/**</span></div></li> <li><div class="src-line"><a name="a1664"></a><span class="src-doc"> * Crops an image</span></div></li> <li><div class="src-line"><a name="a1665"></a><span class="src-doc"> *</span></div></li> <li><div class="src-line"><a name="a1666"></a><span class="src-doc"> * Values are four dimensions, or two, or one (CSS style)</span></div></li> <li><div class="src-line"><a name="a1667"></a><span class="src-doc"> * They represent the amount cropped top, right, bottom and left.</span></div></li> <li><div class="src-line"><a name="a1668"></a><span class="src-doc"> * These values can either be in an array, or a space separated string.</span></div></li> <li><div class="src-line"><a name="a1669"></a><span class="src-doc"> * Each value can be in pixels (with or without 'px'), or percentage (of the source image)</span></div></li> <li><div class="src-line"><a name="a1670"></a><span class="src-doc"> *</span></div></li> <li><div class="src-line"><a name="a1671"></a><span class="src-doc"> * For instance, are valid:</span></div></li> <li><div class="src-line"><a name="a1672"></a><span class="src-doc"> * <pre></span></div></li> <li><div class="src-line"><a name="a1673"></a><span class="src-doc"> * $foo->image_crop = 20 OR array(20);</span></div></li> <li><div class="src-line"><a name="a1674"></a><span class="src-doc"> * $foo->image_crop = '20px' OR array('20px');</span></div></li> <li><div class="src-line"><a name="a1675"></a><span class="src-doc"> * $foo->image_crop = '20 40' OR array('20', 40);</span></div></li> <li><div class="src-line"><a name="a1676"></a><span class="src-doc"> * $foo->image_crop = '-20 25%' OR array(-20, '25%');</span></div></li> <li><div class="src-line"><a name="a1677"></a><span class="src-doc"> * $foo->image_crop = '20px 25%' OR array('20px', '25%');</span></div></li> <li><div class="src-line"><a name="a1678"></a><span class="src-doc"> * $foo->image_crop = '20% 25%' OR array('20%', '25%');</span></div></li> <li><div class="src-line"><a name="a1679"></a><span class="src-doc"> * $foo->image_crop = '20% 25% 10% 30%' OR array('20%', '25%', '10%', '30%');</span></div></li> <li><div class="src-line"><a name="a1680"></a><span class="src-doc"> * $foo->image_crop = '20px 25px 2px 2px' OR array('20px', '25%px', '2px', '2px');</span></div></li> <li><div class="src-line"><a name="a1681"></a><span class="src-doc"> * $foo->image_crop = '20 25% 40px 10%' OR array(20, '25%', '40px', '10%');</span></div></li> <li><div class="src-line"><a name="a1682"></a><span class="src-doc"> * </pre></span></div></li> <li><div class="src-line"><a name="a1683"></a><span class="src-doc"> *</span></div></li> <li><div class="src-line"><a name="a1684"></a><span class="src-doc"> * If a value is negative, the image will be expanded, and the extra parts will be filled with black</span></div></li> <li><div class="src-line"><a name="a1685"></a><span class="src-doc"> *</span></div></li> <li><div class="src-line"><a name="a1686"></a><span class="src-doc"> * Default value is null (no cropping)</span></div></li> <li><div class="src-line"><a name="a1687"></a><span class="src-doc"> *</span></div></li> <li><div class="src-line"><a name="a1688"></a><span class="src-doc"> * </span><span class="src-doc-coretag">@access</span><span class="src-doc"> public</span></div></li> <li><div class="src-line"><a name="a1689"></a><span class="src-doc"> * </span><span class="src-doc-coretag">@var </span><span class="src-doc-type">string </span><span class="src-doc">OR array;</span></div></li> <li><div class="src-line"><a name="a1690"></a><span class="src-doc"> */</span></div></li> <li><div class="src-line"><a name="a1691"></a> <span class="src-key">var </span><a href="class.upload.html#var$image_crop">$image_crop</a><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a1692"></a> </div></li> <li><div class="src-line"><a name="a1693"></a> <span class="src-doc">/**</span></div></li> <li><div class="src-line"><a name="a1694"></a><span class="src-doc"> * Crops an image, before an eventual resizing</span></div></li> <li><div class="src-line"><a name="a1695"></a><span class="src-doc"> *</span></div></li> <li><div class="src-line"><a name="a1696"></a><span class="src-doc"> * See </span><span class="src-doc-inlinetag">{@link image_crop}</span><span class="src-doc"> for valid formats</span></div></li> <li><div class="src-line"><a name="a1697"></a><span class="src-doc"> *</span></div></li> <li><div class="src-line"><a name="a1698"></a><span class="src-doc"> * Default value is null (no cropping)</span></div></li> <li><div class="src-line"><a name="a1699"></a><span class="src-doc"> *</span></div></li> <li><div class="src-line"><a name="a1700"></a><span class="src-doc"> * </span><span class="src-doc-coretag">@access</span><span class="src-doc"> public</span></div></li> <li><div class="src-line"><a name="a1701"></a><span class="src-doc"> * </span><span class="src-doc-coretag">@var </span><span class="src-doc-type">string </span><span class="src-doc">OR array;</span></div></li> <li><div class="src-line"><a name="a1702"></a><span class="src-doc"> */</span></div></li> <li><div class="src-line"><a name="a1703"></a> <span class="src-key">var </span><a href="class.upload.html#var$image_precrop">$image_precrop</a><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a1704"></a> </div></li> <li><div class="src-line"><a name="a1705"></a> <span class="src-doc">/**</span></div></li> <li><div class="src-line"><a name="a1706"></a><span class="src-doc"> * Adds a bevel border on the image</span></div></li> <li><div class="src-line"><a name="a1707"></a><span class="src-doc"> *</span></div></li> <li><div class="src-line"><a name="a1708"></a><span class="src-doc"> * Value is a positive integer, representing the thickness of the bevel</span></div></li> <li><div class="src-line"><a name="a1709"></a><span class="src-doc"> *</span></div></li> <li><div class="src-line"><a name="a1710"></a><span class="src-doc"> * If the bevel colors are the same as the background, it makes a fade out effect</span></div></li> <li><div class="src-line"><a name="a1711"></a><span class="src-doc"> *</span></div></li> <li><div class="src-line"><a name="a1712"></a><span class="src-doc"> * Default value is null (no bevel)</span></div></li> <li><div class="src-line"><a name="a1713"></a><span class="src-doc"> *</span></div></li> <li><div class="src-line"><a name="a1714"></a><span class="src-doc"> * </span><span class="src-doc-coretag">@access</span><span class="src-doc"> public</span></div></li> <li><div class="src-line"><a name="a1715"></a><span class="src-doc"> * </span><span class="src-doc-coretag">@var </span><span class="src-doc-type">integer </span></div></li> <li><div class="src-line"><a name="a1716"></a><span class="src-doc"> */</span></div></li> <li><div class="src-line"><a name="a1717"></a> <span class="src-key">var </span><a href="class.upload.html#var$image_bevel">$image_bevel</a><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a1718"></a> </div></li> <li><div class="src-line"><a name="a1719"></a> <span class="src-doc">/**</span></div></li> <li><div class="src-line"><a name="a1720"></a><span class="src-doc"> * Top and left bevel color</span></div></li> <li><div class="src-line"><a name="a1721"></a><span class="src-doc"> *</span></div></li> <li><div class="src-line"><a name="a1722"></a><span class="src-doc"> * Value is a color, in hexadecimal format</span></div></li> <li><div class="src-line"><a name="a1723"></a><span class="src-doc"> * This setting is used only if </span><span class="src-doc-inlinetag">{@link image_bevel}</span><span class="src-doc"> is set</span></div></li> <li><div class="src-line"><a name="a1724"></a><span class="src-doc"> *</span></div></li> <li><div class="src-line"><a name="a1725"></a><span class="src-doc"> * Default value is #FFFFFF</span></div></li> <li><div class="src-line"><a name="a1726"></a><span class="src-doc"> *</span></div></li> <li><div class="src-line"><a name="a1727"></a><span class="src-doc"> * </span><span class="src-doc-coretag">@access</span><span class="src-doc"> public</span></div></li> <li><div class="src-line"><a name="a1728"></a><span class="src-doc"> * </span><span class="src-doc-coretag">@var </span><span class="src-doc-type">string; </span></div></li> <li><div class="src-line"><a name="a1729"></a><span class="src-doc"> */</span></div></li> <li><div class="src-line"><a name="a1730"></a> <span class="src-key">var </span><a href="class.upload.html#var$image_bevel_color1">$image_bevel_color1</a><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a1731"></a> </div></li> <li><div class="src-line"><a name="a1732"></a> <span class="src-doc">/**</span></div></li> <li><div class="src-line"><a name="a1733"></a><span class="src-doc"> * Right and bottom bevel color</span></div></li> <li><div class="src-line"><a name="a1734"></a><span class="src-doc"> *</span></div></li> <li><div class="src-line"><a name="a1735"></a><span class="src-doc"> * Value is a color, in hexadecimal format</span></div></li> <li><div class="src-line"><a name="a1736"></a><span class="src-doc"> * This setting is used only if </span><span class="src-doc-inlinetag">{@link image_bevel}</span><span class="src-doc"> is set</span></div></li> <li><div class="src-line"><a name="a1737"></a><span class="src-doc"> *</span></div></li> <li><div class="src-line"><a name="a1738"></a><span class="src-doc"> * Default value is #000000</span></div></li> <li><div class="src-line"><a name="a1739"></a><span class="src-doc"> *</span></div></li> <li><div class="src-line"><a name="a1740"></a><span class="src-doc"> * </span><span class="src-doc-coretag">@access</span><span class="src-doc"> public</span></div></li> <li><div class="src-line"><a name="a1741"></a><span class="src-doc"> * </span><span class="src-doc-coretag">@var </span><span class="src-doc-type">string; </span></div></li> <li><div class="src-line"><a name="a1742"></a><span class="src-doc"> */</span></div></li> <li><div class="src-line"><a name="a1743"></a> <span class="src-key">var </span><a href="class.upload.html#var$image_bevel_color2">$image_bevel_color2</a><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a1744"></a> </div></li> <li><div class="src-line"><a name="a1745"></a> <span class="src-doc">/**</span></div></li> <li><div class="src-line"><a name="a1746"></a><span class="src-doc"> * Adds a single-color border on the outer of the image</span></div></li> <li><div class="src-line"><a name="a1747"></a><span class="src-doc"> *</span></div></li> <li><div class="src-line"><a name="a1748"></a><span class="src-doc"> * Values are four dimensions, or two, or one (CSS style)</span></div></li> <li><div class="src-line"><a name="a1749"></a><span class="src-doc"> * They represent the border thickness top, right, bottom and left.</span></div></li> <li><div class="src-line"><a name="a1750"></a><span class="src-doc"> * These values can either be in an array, or a space separated string.</span></div></li> <li><div class="src-line"><a name="a1751"></a><span class="src-doc"> * Each value can be in pixels (with or without 'px'), or percentage (of the source image)</span></div></li> <li><div class="src-line"><a name="a1752"></a><span class="src-doc"> *</span></div></li> <li><div class="src-line"><a name="a1753"></a><span class="src-doc"> * See </span><span class="src-doc-inlinetag">{@link image_crop}</span><span class="src-doc"> for valid formats</span></div></li> <li><div class="src-line"><a name="a1754"></a><span class="src-doc"> *</span></div></li> <li><div class="src-line"><a name="a1755"></a><span class="src-doc"> * If a value is negative, the image will be cropped.</span></div></li> <li><div class="src-line"><a name="a1756"></a><span class="src-doc"> * Note that the dimensions of the picture will be increased by the borders' thickness</span></div></li> <li><div class="src-line"><a name="a1757"></a><span class="src-doc"> *</span></div></li> <li><div class="src-line"><a name="a1758"></a><span class="src-doc"> * Default value is null (no border)</span></div></li> <li><div class="src-line"><a name="a1759"></a><span class="src-doc"> *</span></div></li> <li><div class="src-line"><a name="a1760"></a><span class="src-doc"> * </span><span class="src-doc-coretag">@access</span><span class="src-doc"> public</span></div></li> <li><div class="src-line"><a name="a1761"></a><span class="src-doc"> * </span><span class="src-doc-coretag">@var </span><span class="src-doc-type">integer </span></div></li> <li><div class="src-line"><a name="a1762"></a><span class="src-doc"> */</span></div></li> <li><div class="src-line"><a name="a1763"></a> <span class="src-key">var </span><a href="class.upload.html#var$image_border">$image_border</a><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a1764"></a> </div></li> <li><div class="src-line"><a name="a1765"></a> <span class="src-doc">/**</span></div></li> <li><div class="src-line"><a name="a1766"></a><span class="src-doc"> * Border color</span></div></li> <li><div class="src-line"><a name="a1767"></a><span class="src-doc"> *</span></div></li> <li><div class="src-line"><a name="a1768"></a><span class="src-doc"> * Value is a color, in hexadecimal format.</span></div></li> <li><div class="src-line"><a name="a1769"></a><span class="src-doc"> * This setting is used only if </span><span class="src-doc-inlinetag">{@link image_border}</span><span class="src-doc"> is set</span></div></li> <li><div class="src-line"><a name="a1770"></a><span class="src-doc"> *</span></div></li> <li><div class="src-line"><a name="a1771"></a><span class="src-doc"> * Default value is #FFFFFF</span></div></li> <li><div class="src-line"><a name="a1772"></a><span class="src-doc"> *</span></div></li> <li><div class="src-line"><a name="a1773"></a><span class="src-doc"> * </span><span class="src-doc-coretag">@access</span><span class="src-doc"> public</span></div></li> <li><div class="src-line"><a name="a1774"></a><span class="src-doc"> * </span><span class="src-doc-coretag">@var </span><span class="src-doc-type">string; </span></div></li> <li><div class="src-line"><a name="a1775"></a><span class="src-doc"> */</span></div></li> <li><div class="src-line"><a name="a1776"></a> <span class="src-key">var </span><a href="class.upload.html#var$image_border_color">$image_border_color</a><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a1777"></a> </div></li> <li><div class="src-line"><a name="a1778"></a> <span class="src-doc">/**</span></div></li> <li><div class="src-line"><a name="a1779"></a><span class="src-doc"> * Adds a multi-color frame on the outer of the image</span></div></li> <li><div class="src-line"><a name="a1780"></a><span class="src-doc"> *</span></div></li> <li><div class="src-line"><a name="a1781"></a><span class="src-doc"> * Value is an integer. Two values are possible for now:</span></div></li> <li><div class="src-line"><a name="a1782"></a><span class="src-doc"> * 1 for flat border, meaning that the frame is mirrored horizontally and vertically</span></div></li> <li><div class="src-line"><a name="a1783"></a><span class="src-doc"> * 2 for crossed border, meaning that the frame will be inversed, as in a bevel effect</span></div></li> <li><div class="src-line"><a name="a1784"></a><span class="src-doc"> *</span></div></li> <li><div class="src-line"><a name="a1785"></a><span class="src-doc"> * The frame will be composed of colored lines set in </span><span class="src-doc-inlinetag">{@link image_frame_colors}</span></div></li> <li><div class="src-line"><a name="a1786"></a><span class="src-doc"> *</span></div></li> <li><div class="src-line"><a name="a1787"></a><span class="src-doc"> * Note that the dimensions of the picture will be increased by the borders' thickness</span></div></li> <li><div class="src-line"><a name="a1788"></a><span class="src-doc"> *</span></div></li> <li><div class="src-line"><a name="a1789"></a><span class="src-doc"> * Default value is null (no frame)</span></div></li> <li><div class="src-line"><a name="a1790"></a><span class="src-doc"> *</span></div></li> <li><div class="src-line"><a name="a1791"></a><span class="src-doc"> * </span><span class="src-doc-coretag">@access</span><span class="src-doc"> public</span></div></li> <li><div class="src-line"><a name="a1792"></a><span class="src-doc"> * </span><span class="src-doc-coretag">@var </span><span class="src-doc-type">integer </span></div></li> <li><div class="src-line"><a name="a1793"></a><span class="src-doc"> */</span></div></li> <li><div class="src-line"><a name="a1794"></a> <span class="src-key">var </span><a href="class.upload.html#var$image_frame">$image_frame</a><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a1795"></a> </div></li> <li><div class="src-line"><a name="a1796"></a> <span class="src-doc">/**</span></div></li> <li><div class="src-line"><a name="a1797"></a><span class="src-doc"> * Sets the colors used to draw a frame</span></div></li> <li><div class="src-line"><a name="a1798"></a><span class="src-doc"> *</span></div></li> <li><div class="src-line"><a name="a1799"></a><span class="src-doc"> * Values is a list of n colors in hexadecimal format.</span></div></li> <li><div class="src-line"><a name="a1800"></a><span class="src-doc"> * These values can either be in an array, or a space separated string.</span></div></li> <li><div class="src-line"><a name="a1801"></a><span class="src-doc"> *</span></div></li> <li><div class="src-line"><a name="a1802"></a><span class="src-doc"> * The colors are listed in the following order: from the outset of the image to its center</span></div></li> <li><div class="src-line"><a name="a1803"></a><span class="src-doc"> *</span></div></li> <li><div class="src-line"><a name="a1804"></a><span class="src-doc"> * For instance, are valid:</span></div></li> <li><div class="src-line"><a name="a1805"></a><span class="src-doc"> * <pre></span></div></li> <li><div class="src-line"><a name="a1806"></a><span class="src-doc"> * $foo->image_frame_colors = '#FFFFFF #999999 #666666 #000000';</span></div></li> <li><div class="src-line"><a name="a1807"></a><span class="src-doc"> * $foo->image_frame_colors = array('#FFFFFF', '#999999', '#666666', '#000000');</span></div></li> <li><div class="src-line"><a name="a1808"></a><span class="src-doc"> * </pre></span></div></li> <li><div class="src-line"><a name="a1809"></a><span class="src-doc"> *</span></div></li> <li><div class="src-line"><a name="a1810"></a><span class="src-doc"> * This setting is used only if </span><span class="src-doc-inlinetag">{@link image_frame}</span><span class="src-doc"> is set</span></div></li> <li><div class="src-line"><a name="a1811"></a><span class="src-doc"> *</span></div></li> <li><div class="src-line"><a name="a1812"></a><span class="src-doc"> * Default value is '#FFFFFF #999999 #666666 #000000'</span></div></li> <li><div class="src-line"><a name="a1813"></a><span class="src-doc"> *</span></div></li> <li><div class="src-line"><a name="a1814"></a><span class="src-doc"> * </span><span class="src-doc-coretag">@access</span><span class="src-doc"> public</span></div></li> <li><div class="src-line"><a name="a1815"></a><span class="src-doc"> * </span><span class="src-doc-coretag">@var </span><span class="src-doc-type">string </span><span class="src-doc">OR array;</span></div></li> <li><div class="src-line"><a name="a1816"></a><span class="src-doc"> */</span></div></li> <li><div class="src-line"><a name="a1817"></a> <span class="src-key">var </span><a href="class.upload.html#var$image_frame_colors">$image_frame_colors</a><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a1818"></a> </div></li> <li><div class="src-line"><a name="a1819"></a> <span class="src-doc">/**</span></div></li> <li><div class="src-line"><a name="a1820"></a><span class="src-doc"> * Adds a watermark on the image</span></div></li> <li><div class="src-line"><a name="a1821"></a><span class="src-doc"> *</span></div></li> <li><div class="src-line"><a name="a1822"></a><span class="src-doc"> * Value is a local image filename, relative or absolute. GIF, JPG, BMP and PNG are supported, as well as PNG alpha.</span></div></li> <li><div class="src-line"><a name="a1823"></a><span class="src-doc"> *</span></div></li> <li><div class="src-line"><a name="a1824"></a><span class="src-doc"> * If set, this setting allow the use of all other settings starting with image_watermark_</span></div></li> <li><div class="src-line"><a name="a1825"></a><span class="src-doc"> *</span></div></li> <li><div class="src-line"><a name="a1826"></a><span class="src-doc"> * Default value is null</span></div></li> <li><div class="src-line"><a name="a1827"></a><span class="src-doc"> *</span></div></li> <li><div class="src-line"><a name="a1828"></a><span class="src-doc"> * </span><span class="src-doc-coretag">@access</span><span class="src-doc"> public</span></div></li> <li><div class="src-line"><a name="a1829"></a><span class="src-doc"> * </span><span class="src-doc-coretag">@var </span><span class="src-doc-type">string; </span></div></li> <li><div class="src-line"><a name="a1830"></a><span class="src-doc"> */</span></div></li> <li><div class="src-line"><a name="a1831"></a> <span class="src-key">var </span><a href="class.upload.html#var$image_watermark">$image_watermark</a><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a1832"></a> </div></li> <li><div class="src-line"><a name="a1833"></a> <span class="src-doc">/**</span></div></li> <li><div class="src-line"><a name="a1834"></a><span class="src-doc"> * Sets the watermarkposition within the image</span></div></li> <li><div class="src-line"><a name="a1835"></a><span class="src-doc"> *</span></div></li> <li><div class="src-line"><a name="a1836"></a><span class="src-doc"> * Value is one or two out of 'TBLR' (top, bottom, left, right)</span></div></li> <li><div class="src-line"><a name="a1837"></a><span class="src-doc"> *</span></div></li> <li><div class="src-line"><a name="a1838"></a><span class="src-doc"> * The positions are as following: TL T TR</span></div></li> <li><div class="src-line"><a name="a1839"></a><span class="src-doc"> * L R</span></div></li> <li><div class="src-line"><a name="a1840"></a><span class="src-doc"> * BL B BR</span></div></li> <li><div class="src-line"><a name="a1841"></a><span class="src-doc"> *</span></div></li> <li><div class="src-line"><a name="a1842"></a><span class="src-doc"> * Default value is null (centered, horizontal and vertical)</span></div></li> <li><div class="src-line"><a name="a1843"></a><span class="src-doc"> *</span></div></li> <li><div class="src-line"><a name="a1844"></a><span class="src-doc"> * Note that is </span><span class="src-doc-inlinetag">{@link image_watermark_x}</span><span class="src-doc"> and </span><span class="src-doc-inlinetag">{@link image_watermark_y}</span><span class="src-doc"> are used, this setting has no effect</span></div></li> <li><div class="src-line"><a name="a1845"></a><span class="src-doc"> *</span></div></li> <li><div class="src-line"><a name="a1846"></a><span class="src-doc"> * </span><span class="src-doc-coretag">@access</span><span class="src-doc"> public</span></div></li> <li><div class="src-line"><a name="a1847"></a><span class="src-doc"> * </span><span class="src-doc-coretag">@var </span><span class="src-doc-type">string; </span></div></li> <li><div class="src-line"><a name="a1848"></a><span class="src-doc"> */</span></div></li> <li><div class="src-line"><a name="a1849"></a> <span class="src-key">var </span><a href="class.upload.html#var$image_watermark_position">$image_watermark_position</a><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a1850"></a> </div></li> <li><div class="src-line"><a name="a1851"></a> <span class="src-doc">/**</span></div></li> <li><div class="src-line"><a name="a1852"></a><span class="src-doc"> * Sets the watermark absolute X position within the image</span></div></li> <li><div class="src-line"><a name="a1853"></a><span class="src-doc"> *</span></div></li> <li><div class="src-line"><a name="a1854"></a><span class="src-doc"> * Value is in pixels, representing the distance between the top of the image and the watermark</span></div></li> <li><div class="src-line"><a name="a1855"></a><span class="src-doc"> * If a negative value is used, it will represent the distance between the bottom of the image and the watermark</span></div></li> <li><div class="src-line"><a name="a1856"></a><span class="src-doc"> *</span></div></li> <li><div class="src-line"><a name="a1857"></a><span class="src-doc"> * Default value is null (so </span><span class="src-doc-inlinetag">{@link image_watermark_position}</span><span class="src-doc"> is used)</span></div></li> <li><div class="src-line"><a name="a1858"></a><span class="src-doc"> *</span></div></li> <li><div class="src-line"><a name="a1859"></a><span class="src-doc"> * </span><span class="src-doc-coretag">@access</span><span class="src-doc"> public</span></div></li> <li><div class="src-line"><a name="a1860"></a><span class="src-doc"> * </span><span class="src-doc-coretag">@var </span><span class="src-doc-type">integer </span></div></li> <li><div class="src-line"><a name="a1861"></a><span class="src-doc"> */</span></div></li> <li><div class="src-line"><a name="a1862"></a> <span class="src-key">var </span><a href="class.upload.html#var$image_watermark_x">$image_watermark_x</a><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a1863"></a> </div></li> <li><div class="src-line"><a name="a1864"></a> <span class="src-doc">/**</span></div></li> <li><div class="src-line"><a name="a1865"></a><span class="src-doc"> * Sets the twatermark absolute Y position within the image</span></div></li> <li><div class="src-line"><a name="a1866"></a><span class="src-doc"> *</span></div></li> <li><div class="src-line"><a name="a1867"></a><span class="src-doc"> * Value is in pixels, representing the distance between the left of the image and the watermark</span></div></li> <li><div class="src-line"><a name="a1868"></a><span class="src-doc"> * If a negative value is used, it will represent the distance between the right of the image and the watermark</span></div></li> <li><div class="src-line"><a name="a1869"></a><span class="src-doc"> *</span></div></li> <li><div class="src-line"><a name="a1870"></a><span class="src-doc"> * Default value is null (so </span><span class="src-doc-inlinetag">{@link image_watermark_position}</span><span class="src-doc"> is used)</span></div></li> <li><div class="src-line"><a name="a1871"></a><span class="src-doc"> *</span></div></li> <li><div class="src-line"><a name="a1872"></a><span class="src-doc"> * </span><span class="src-doc-coretag">@access</span><span class="src-doc"> public</span></div></li> <li><div class="src-line"><a name="a1873"></a><span class="src-doc"> * </span><span class="src-doc-coretag">@var </span><span class="src-doc-type">integer </span></div></li> <li><div class="src-line"><a name="a1874"></a><span class="src-doc"> */</span></div></li> <li><div class="src-line"><a name="a1875"></a> <span class="src-key">var </span><a href="class.upload.html#var$image_watermark_y">$image_watermark_y</a><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a1876"></a> </div></li> <li><div class="src-line"><a name="a1877"></a> <span class="src-doc">/**</span></div></li> <li><div class="src-line"><a name="a1878"></a><span class="src-doc"> * Allowed MIME types</span></div></li> <li><div class="src-line"><a name="a1879"></a><span class="src-doc"> *</span></div></li> <li><div class="src-line"><a name="a1880"></a><span class="src-doc"> * Default is a selection of safe mime-types, but you might want to change it</span></div></li> <li><div class="src-line"><a name="a1881"></a><span class="src-doc"> *</span></div></li> <li><div class="src-line"><a name="a1882"></a><span class="src-doc"> * Simple wildcards are allowed, such as image/* or application/*</span></div></li> <li><div class="src-line"><a name="a1883"></a><span class="src-doc"> *</span></div></li> <li><div class="src-line"><a name="a1884"></a><span class="src-doc"> * </span><span class="src-doc-coretag">@access</span><span class="src-doc"> public</span></div></li> <li><div class="src-line"><a name="a1885"></a><span class="src-doc"> * </span><span class="src-doc-coretag">@var </span><span class="src-doc-type">array </span></div></li> <li><div class="src-line"><a name="a1886"></a><span class="src-doc"> */</span></div></li> <li><div class="src-line"><a name="a1887"></a> <span class="src-key">var </span><a href="class.upload.html#var$allowed">$allowed</a><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a1888"></a> </div></li> <li><div class="src-line"><a name="a1889"></a> <span class="src-doc">/**</span></div></li> <li><div class="src-line"><a name="a1890"></a><span class="src-doc"> * Forbidden MIME types</span></div></li> <li><div class="src-line"><a name="a1891"></a><span class="src-doc"> *</span></div></li> <li><div class="src-line"><a name="a1892"></a><span class="src-doc"> * Default is a selection of safe mime-types, but you might want to change it</span></div></li> <li><div class="src-line"><a name="a1893"></a><span class="src-doc"> * To only check for forbidden MIME types, and allow everything else, set </span><span class="src-doc-inlinetag">{@link allowed}</span><span class="src-doc"> to array('* / *') without the spaces</span></div></li> <li><div class="src-line"><a name="a1894"></a><span class="src-doc"> *</span></div></li> <li><div class="src-line"><a name="a1895"></a><span class="src-doc"> * Simple wildcards are allowed, such as image/* or application/*</span></div></li> <li><div class="src-line"><a name="a1896"></a><span class="src-doc"> *</span></div></li> <li><div class="src-line"><a name="a1897"></a><span class="src-doc"> * </span><span class="src-doc-coretag">@access</span><span class="src-doc"> public</span></div></li> <li><div class="src-line"><a name="a1898"></a><span class="src-doc"> * </span><span class="src-doc-coretag">@var </span><span class="src-doc-type">array </span></div></li> <li><div class="src-line"><a name="a1899"></a><span class="src-doc"> */</span></div></li> <li><div class="src-line"><a name="a1900"></a> <span class="src-key">var </span><a href="class.upload.html#var$forbidden">$forbidden</a><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a1901"></a> </div></li> <li><div class="src-line"><a name="a1902"></a> <span class="src-doc">/**</span></div></li> <li><div class="src-line"><a name="a1903"></a><span class="src-doc"> * Array of translated error messages</span></div></li> <li><div class="src-line"><a name="a1904"></a><span class="src-doc"> *</span></div></li> <li><div class="src-line"><a name="a1905"></a><span class="src-doc"> * By default, the language is english (en_GB)</span></div></li> <li><div class="src-line"><a name="a1906"></a><span class="src-doc"> * Translations can be in separate files, in a lang/ subdirectory</span></div></li> <li><div class="src-line"><a name="a1907"></a><span class="src-doc"> *</span></div></li> <li><div class="src-line"><a name="a1908"></a><span class="src-doc"> * </span><span class="src-doc-coretag">@access</span><span class="src-doc"> public</span></div></li> <li><div class="src-line"><a name="a1909"></a><span class="src-doc"> * </span><span class="src-doc-coretag">@var </span><span class="src-doc-type">array </span></div></li> <li><div class="src-line"><a name="a1910"></a><span class="src-doc"> */</span></div></li> <li><div class="src-line"><a name="a1911"></a> <span class="src-key">var </span><a href="class.upload.html#var$translation">$translation</a><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a1912"></a> </div></li> <li><div class="src-line"><a name="a1913"></a> <span class="src-doc">/**</span></div></li> <li><div class="src-line"><a name="a1914"></a><span class="src-doc"> * Language selected for the translations</span></div></li> <li><div class="src-line"><a name="a1915"></a><span class="src-doc"> *</span></div></li> <li><div class="src-line"><a name="a1916"></a><span class="src-doc"> * By default, the language is english ("en_GB")</span></div></li> <li><div class="src-line"><a name="a1917"></a><span class="src-doc"> *</span></div></li> <li><div class="src-line"><a name="a1918"></a><span class="src-doc"> * </span><span class="src-doc-coretag">@access</span><span class="src-doc"> public</span></div></li> <li><div class="src-line"><a name="a1919"></a><span class="src-doc"> * </span><span class="src-doc-coretag">@var </span><span class="src-doc-type">array </span></div></li> <li><div class="src-line"><a name="a1920"></a><span class="src-doc"> */</span></div></li> <li><div class="src-line"><a name="a1921"></a> <span class="src-key">var </span><a href="class.upload.html#var$language">$language</a><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a1922"></a> </div></li> <li><div class="src-line"><a name="a1923"></a> <span class="src-doc">/**</span></div></li> <li><div class="src-line"><a name="a1924"></a><span class="src-doc"> * Init or re-init all the processing variables to their default values</span></div></li> <li><div class="src-line"><a name="a1925"></a><span class="src-doc"> *</span></div></li> <li><div class="src-line"><a name="a1926"></a><span class="src-doc"> * This function is called in the constructor, and after each call of </span><span class="src-doc-inlinetag">{@link process}</span></div></li> <li><div class="src-line"><a name="a1927"></a><span class="src-doc"> *</span></div></li> <li><div class="src-line"><a name="a1928"></a><span class="src-doc"> * </span><span class="src-doc-coretag">@access</span><span class="src-doc"> private</span></div></li> <li><div class="src-line"><a name="a1929"></a><span class="src-doc"> */</span></div></li> <li><div class="src-line"><a name="a1930"></a> <span class="src-key">function </span><span class="src-id">init</span><span class="src-sym">(</span><span class="src-sym">) </span><span class="src-sym">{</span></div></li> <li><div class="src-line"><a name="a1931"></a> </div></li> <li><div class="src-line"><a name="a1932"></a> <span class="src-comm">// overiddable variables</span></div></li> <li><div class="src-line"><a name="a1933"></a> <span class="src-var">$this</span><span class="src-sym">-></span><a href="class.upload.html#var$file_new_name_body">file_new_name_body</a> = <span class="src-str">''</span><span class="src-sym">; </span><span class="src-comm">// replace the name body</span></div></li> <li><div class="src-line"><a name="a1934"></a> <span class="src-var">$this</span><span class="src-sym">-></span><a href="class.upload.html#var$file_name_body_add">file_name_body_add</a> = <span class="src-str">''</span><span class="src-sym">; </span><span class="src-comm">// append to the name body</span></div></li> <li><div class="src-line"><a name="a1935"></a> <span class="src-var">$this</span><span class="src-sym">-></span><a href="class.upload.html#var$file_name_body_pre">file_name_body_pre</a> = <span class="src-str">''</span><span class="src-sym">; </span><span class="src-comm">// prepend to the name body</span></div></li> <li><div class="src-line"><a name="a1936"></a> <span class="src-var">$this</span><span class="src-sym">-></span><a href="class.upload.html#var$file_new_name_ext">file_new_name_ext</a> = <span class="src-str">''</span><span class="src-sym">; </span><span class="src-comm">// replace the file extension</span></div></li> <li><div class="src-line"><a name="a1937"></a> <span class="src-var">$this</span><span class="src-sym">-></span><a href="class.upload.html#var$file_safe_name">file_safe_name</a> = <span class="src-id">true</span><span class="src-sym">; </span><span class="src-comm">// format safely the filename</span></div></li> <li><div class="src-line"><a name="a1938"></a> <span class="src-var">$this</span><span class="src-sym">-></span><a href="class.upload.html#var$file_overwrite">file_overwrite</a> = <span class="src-id">false</span><span class="src-sym">; </span><span class="src-comm">// allows overwritting if the file already exists</span></div></li> <li><div class="src-line"><a name="a1939"></a> <span class="src-var">$this</span><span class="src-sym">-></span><a href="class.upload.html#var$file_auto_rename">file_auto_rename</a> = <span class="src-id">true</span><span class="src-sym">; </span><span class="src-comm">// auto-rename if the file already exists</span></div></li> <li><div class="src-line"><a name="a1940"></a> <span class="src-var">$this</span><span class="src-sym">-></span><a href="class.upload.html#var$dir_auto_create">dir_auto_create</a> = <span class="src-id">true</span><span class="src-sym">; </span><span class="src-comm">// auto-creates directory if missing</span></div></li> <li><div class="src-line"><a name="a1941"></a> <span class="src-var">$this</span><span class="src-sym">-></span><a href="class.upload.html#var$dir_auto_chmod">dir_auto_chmod</a> = <span class="src-id">true</span><span class="src-sym">; </span><span class="src-comm">// auto-chmod directory if not writeable</span></div></li> <li><div class="src-line"><a name="a1942"></a> <span class="src-var">$this</span><span class="src-sym">-></span><a href="class.upload.html#var$dir_chmod">dir_chmod</a> = <span class="src-num">0777</span><span class="src-sym">; </span><span class="src-comm">// default chmod to use</span></div></li> <li><div class="src-line"><a name="a1943"></a> </div></li> <li><div class="src-line"><a name="a1944"></a> <span class="src-var">$this</span><span class="src-sym">-></span><a href="class.upload.html#var$mime_check">mime_check</a> = <span class="src-id">true</span><span class="src-sym">; </span><span class="src-comm">// checks the mime type against the allowed list</span></div></li> <li><div class="src-line"><a name="a1945"></a> <span class="src-var">$this</span><span class="src-sym">-></span><a href="class.upload.html#var$mime_fileinfo">mime_fileinfo</a> = <span class="src-id">true</span><span class="src-sym">; </span><span class="src-comm">// MIME detection with Fileinfo PECL extension</span></div></li> <li><div class="src-line"><a name="a1946"></a> <span class="src-var">$this</span><span class="src-sym">-></span><a href="class.upload.html#var$mime_file">mime_file</a> = <span class="src-id">true</span><span class="src-sym">; </span><span class="src-comm">// MIME detection with UNIX file() command</span></div></li> <li><div class="src-line"><a name="a1947"></a> <span class="src-var">$this</span><span class="src-sym">-></span><a href="class.upload.html#var$mime_magic">mime_magic</a> = <span class="src-id">true</span><span class="src-sym">; </span><span class="src-comm">// MIME detection with mime_magic (mime_content_type())</span></div></li> <li><div class="src-line"><a name="a1948"></a> <span class="src-var">$this</span><span class="src-sym">-></span><a href="class.upload.html#var$mime_getimagesize">mime_getimagesize</a> = <span class="src-id">true</span><span class="src-sym">; </span><span class="src-comm">// MIME detection with getimagesize()</span></div></li> <li><div class="src-line"><a name="a1949"></a> <span class="src-var">$this</span><span class="src-sym">-></span><a href="class.upload.html#var$no_script">no_script</a> = <span class="src-id">true</span><span class="src-sym">; </span><span class="src-comm">// turns scripts into test files</span></div></li> <li><div class="src-line"><a name="a1950"></a> </div></li> <li><div class="src-line"><a name="a1951"></a> <span class="src-var">$val </span>= <a href="http://www.php.net/trim">trim</a><span class="src-sym">(</span><a href="http://www.php.net/ini_get">ini_get</a><span class="src-sym">(</span><span class="src-str">'upload_max_filesize'</span><span class="src-sym">))</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a1952"></a> <span class="src-var">$last </span>= <a href="http://www.php.net/strtolower">strtolower</a><span class="src-sym">(</span><span class="src-var">$val</span><span class="src-sym">{</span><a href="http://www.php.net/strlen">strlen</a><span class="src-sym">(</span><span class="src-var">$val</span><span class="src-sym">)</span>-<span class="src-num">1</span><span class="src-sym">}</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a1953"></a> <span class="src-key">switch</span><span class="src-sym">(</span><span class="src-var">$last</span><span class="src-sym">) </span><span class="src-sym">{</span></div></li> <li><div class="src-line"><a name="a1954"></a> <span class="src-key">case </span><span class="src-str">'g'</span>:</div></li> <li><div class="src-line"><a name="a1955"></a> <span class="src-var">$val </span>*= <span class="src-num">1024</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a1956"></a> <span class="src-key">case </span><span class="src-str">'m'</span>:</div></li> <li><div class="src-line"><a name="a1957"></a> <span class="src-var">$val </span>*= <span class="src-num">1024</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a1958"></a> <span class="src-key">case </span><span class="src-str">'k'</span>:</div></li> <li><div class="src-line"><a name="a1959"></a> <span class="src-var">$val </span>*= <span class="src-num">1024</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a1960"></a> <span class="src-sym">}</span></div></li> <li><div class="src-line"><a name="a1961"></a> <span class="src-var">$this</span><span class="src-sym">-></span><a href="class.upload.html#var$file_max_size">file_max_size</a> = <span class="src-var">$val</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a1962"></a> </div></li> <li><div class="src-line"><a name="a1963"></a> <span class="src-var">$this</span><span class="src-sym">-></span><a href="class.upload.html#var$image_resize">image_resize</a> = <span class="src-id">false</span><span class="src-sym">; </span><span class="src-comm">// resize the image</span></div></li> <li><div class="src-line"><a name="a1964"></a> <span class="src-var">$this</span><span class="src-sym">-></span><a href="class.upload.html#var$image_convert">image_convert</a> = <span class="src-str">''</span><span class="src-sym">; </span><span class="src-comm">// convert. values :''; 'png'; 'jpeg'; 'gif'; 'bmp'</span></div></li> <li><div class="src-line"><a name="a1965"></a> </div></li> <li><div class="src-line"><a name="a1966"></a> <span class="src-var">$this</span><span class="src-sym">-></span><a href="class.upload.html#var$image_x">image_x</a> = <span class="src-num">150</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a1967"></a> <span class="src-var">$this</span><span class="src-sym">-></span><a href="class.upload.html#var$image_y">image_y</a> = <span class="src-num">150</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a1968"></a> <span class="src-var">$this</span><span class="src-sym">-></span><a href="class.upload.html#var$image_ratio">image_ratio</a> = <span class="src-id">false</span><span class="src-sym">; </span><span class="src-comm">// keeps aspect ratio with x and y dimensions</span></div></li> <li><div class="src-line"><a name="a1969"></a> <span class="src-var">$this</span><span class="src-sym">-></span><a href="class.upload.html#var$image_ratio_crop">image_ratio_crop</a> = <span class="src-id">false</span><span class="src-sym">; </span><span class="src-comm">// keeps aspect ratio with x and y dimensions, filling the space</span></div></li> <li><div class="src-line"><a name="a1970"></a> <span class="src-var">$this</span><span class="src-sym">-></span><a href="class.upload.html#var$image_ratio_fill">image_ratio_fill</a> = <span class="src-id">false</span><span class="src-sym">; </span><span class="src-comm">// keeps aspect ratio with x and y dimensions, fitting the image in the space, and coloring the rest</span></div></li> <li><div class="src-line"><a name="a1971"></a> <span class="src-var">$this</span><span class="src-sym">-></span><a href="class.upload.html#var$image_ratio_pixels">image_ratio_pixels</a> = <span class="src-id">false</span><span class="src-sym">; </span><span class="src-comm">// keeps aspect ratio, calculating x and y so that the image is approx the set number of pixels</span></div></li> <li><div class="src-line"><a name="a1972"></a> <span class="src-var">$this</span><span class="src-sym">-></span><a href="class.upload.html#var$image_ratio_no_zoom_in">image_ratio_no_zoom_in</a> = <span class="src-id">false</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a1973"></a> <span class="src-var">$this</span><span class="src-sym">-></span><a href="class.upload.html#var$image_ratio_no_zoom_out">image_ratio_no_zoom_out</a> = <span class="src-id">false</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a1974"></a> <span class="src-var">$this</span><span class="src-sym">-></span><a href="class.upload.html#var$image_ratio_x">image_ratio_x</a> = <span class="src-id">false</span><span class="src-sym">; </span><span class="src-comm">// calculate the $image_x if true</span></div></li> <li><div class="src-line"><a name="a1975"></a> <span class="src-var">$this</span><span class="src-sym">-></span><a href="class.upload.html#var$image_ratio_y">image_ratio_y</a> = <span class="src-id">false</span><span class="src-sym">; </span><span class="src-comm">// calculate the $image_y if true</span></div></li> <li><div class="src-line"><a name="a1976"></a> <span class="src-var">$this</span><span class="src-sym">-></span><a href="class.upload.html#var$jpeg_quality">jpeg_quality</a> = <span class="src-num">85</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a1977"></a> <span class="src-var">$this</span><span class="src-sym">-></span><a href="class.upload.html#var$jpeg_size">jpeg_size</a> = <span class="src-id">null</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a1978"></a> <span class="src-var">$this</span><span class="src-sym">-></span><a href="class.upload.html#var$preserve_transparency">preserve_transparency</a> = <span class="src-id">false</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a1979"></a> <span class="src-var">$this</span><span class="src-sym">-></span><a href="class.upload.html#var$image_is_transparent">image_is_transparent</a> = <span class="src-id">false</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a1980"></a> <span class="src-var">$this</span><span class="src-sym">-></span><a href="class.upload.html#var$image_transparent_color">image_transparent_color</a> = <span class="src-id">null</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a1981"></a> <span class="src-var">$this</span><span class="src-sym">-></span><a href="class.upload.html#var$image_background_color">image_background_color</a> = <span class="src-id">null</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a1982"></a> <span class="src-var">$this</span><span class="src-sym">-></span><a href="class.upload.html#var$image_default_color">image_default_color</a> = <span class="src-str">'#ffffff'</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a1983"></a> <span class="src-var">$this</span><span class="src-sym">-></span><a href="class.upload.html#var$image_is_palette">image_is_palette</a> = <span class="src-id">false</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a1984"></a> </div></li> <li><div class="src-line"><a name="a1985"></a> <span class="src-var">$this</span><span class="src-sym">-></span><a href="class.upload.html#var$image_max_width">image_max_width</a> = <span class="src-id">null</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a1986"></a> <span class="src-var">$this</span><span class="src-sym">-></span><a href="class.upload.html#var$image_max_height">image_max_height</a> = <span class="src-id">null</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a1987"></a> <span class="src-var">$this</span><span class="src-sym">-></span><a href="class.upload.html#var$image_max_pixels">image_max_pixels</a> = <span class="src-id">null</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a1988"></a> <span class="src-var">$this</span><span class="src-sym">-></span><a href="class.upload.html#var$image_max_ratio">image_max_ratio</a> = <span class="src-id">null</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a1989"></a> <span class="src-var">$this</span><span class="src-sym">-></span><a href="class.upload.html#var$image_min_width">image_min_width</a> = <span class="src-id">null</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a1990"></a> <span class="src-var">$this</span><span class="src-sym">-></span><a href="class.upload.html#var$image_min_height">image_min_height</a> = <span class="src-id">null</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a1991"></a> <span class="src-var">$this</span><span class="src-sym">-></span><a href="class.upload.html#var$image_min_pixels">image_min_pixels</a> = <span class="src-id">null</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a1992"></a> <span class="src-var">$this</span><span class="src-sym">-></span><a href="class.upload.html#var$image_min_ratio">image_min_ratio</a> = <span class="src-id">null</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a1993"></a> </div></li> <li><div class="src-line"><a name="a1994"></a> <span class="src-var">$this</span><span class="src-sym">-></span><a href="class.upload.html#var$image_brightness">image_brightness</a> = <span class="src-id">null</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a1995"></a> <span class="src-var">$this</span><span class="src-sym">-></span><a href="class.upload.html#var$image_contrast">image_contrast</a> = <span class="src-id">null</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a1996"></a> <span class="src-var">$this</span><span class="src-sym">-></span><a href="class.upload.html#var$image_threshold">image_threshold</a> = <span class="src-id">null</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a1997"></a> <span class="src-var">$this</span><span class="src-sym">-></span><a href="class.upload.html#var$image_tint_color">image_tint_color</a> = <span class="src-id">null</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a1998"></a> <span class="src-var">$this</span><span class="src-sym">-></span><a href="class.upload.html#var$image_overlay_color">image_overlay_color</a> = <span class="src-id">null</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a1999"></a> <span class="src-var">$this</span><span class="src-sym">-></span><a href="class.upload.html#var$image_overlay_percent">image_overlay_percent</a> = <span class="src-id">null</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a2000"></a> <span class="src-var">$this</span><span class="src-sym">-></span><a href="class.upload.html#var$image_negative">image_negative</a> = <span class="src-id">false</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a2001"></a> <span class="src-var">$this</span><span class="src-sym">-></span><a href="class.upload.html#var$image_greyscale">image_greyscale</a> = <span class="src-id">false</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a2002"></a> </div></li> <li><div class="src-line"><a name="a2003"></a> <span class="src-var">$this</span><span class="src-sym">-></span><a href="class.upload.html#var$image_text">image_text</a> = <span class="src-id">null</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a2004"></a> <span class="src-var">$this</span><span class="src-sym">-></span><a href="class.upload.html#var$image_text_direction">image_text_direction</a> = <span class="src-id">null</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a2005"></a> <span class="src-var">$this</span><span class="src-sym">-></span><a href="class.upload.html#var$image_text_color">image_text_color</a> = <span class="src-str">'#FFFFFF'</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a2006"></a> <span class="src-var">$this</span><span class="src-sym">-></span><a href="class.upload.html#var$image_text_percent">image_text_percent</a> = <span class="src-num">100</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a2007"></a> <span class="src-var">$this</span><span class="src-sym">-></span><a href="class.upload.html#var$image_text_background">image_text_background</a> = <span class="src-id">null</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a2008"></a> <span class="src-var">$this</span><span class="src-sym">-></span><a href="class.upload.html#var$image_text_background_percent">image_text_background_percent</a> = <span class="src-num">100</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a2009"></a> <span class="src-var">$this</span><span class="src-sym">-></span><a href="class.upload.html#var$image_text_font">image_text_font</a> = <span class="src-num">5</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a2010"></a> <span class="src-var">$this</span><span class="src-sym">-></span><a href="class.upload.html#var$image_text_x">image_text_x</a> = <span class="src-id">null</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a2011"></a> <span class="src-var">$this</span><span class="src-sym">-></span><a href="class.upload.html#var$image_text_y">image_text_y</a> = <span class="src-id">null</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a2012"></a> <span class="src-var">$this</span><span class="src-sym">-></span><a href="class.upload.html#var$image_text_position">image_text_position</a> = <span class="src-id">null</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a2013"></a> <span class="src-var">$this</span><span class="src-sym">-></span><a href="class.upload.html#var$image_text_padding">image_text_padding</a> = <span class="src-num">0</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a2014"></a> <span class="src-var">$this</span><span class="src-sym">-></span><a href="class.upload.html#var$image_text_padding_x">image_text_padding_x</a> = <span class="src-id">null</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a2015"></a> <span class="src-var">$this</span><span class="src-sym">-></span><a href="class.upload.html#var$image_text_padding_y">image_text_padding_y</a> = <span class="src-id">null</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a2016"></a> <span class="src-var">$this</span><span class="src-sym">-></span><a href="class.upload.html#var$image_text_alignment">image_text_alignment</a> = <span class="src-str">'C'</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a2017"></a> <span class="src-var">$this</span><span class="src-sym">-></span><a href="class.upload.html#var$image_text_line_spacing">image_text_line_spacing</a> = <span class="src-num">0</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a2018"></a> </div></li> <li><div class="src-line"><a name="a2019"></a> <span class="src-var">$this</span><span class="src-sym">-></span><a href="class.upload.html#var$image_reflection_height">image_reflection_height</a> = <span class="src-id">null</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a2020"></a> <span class="src-var">$this</span><span class="src-sym">-></span><a href="class.upload.html#var$image_reflection_space">image_reflection_space</a> = <span class="src-num">2</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a2021"></a> <span class="src-var">$this</span><span class="src-sym">-></span><a href="class.upload.html#var$image_reflection_color">image_reflection_color</a> = <span class="src-str">'#ffffff'</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a2022"></a> <span class="src-var">$this</span><span class="src-sym">-></span><a href="class.upload.html#var$image_reflection_opacity">image_reflection_opacity</a> = <span class="src-num">60</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a2023"></a> </div></li> <li><div class="src-line"><a name="a2024"></a> <span class="src-var">$this</span><span class="src-sym">-></span><a href="class.upload.html#var$image_watermark">image_watermark</a> = <span class="src-id">null</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a2025"></a> <span class="src-var">$this</span><span class="src-sym">-></span><a href="class.upload.html#var$image_watermark_x">image_watermark_x</a> = <span class="src-id">null</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a2026"></a> <span class="src-var">$this</span><span class="src-sym">-></span><a href="class.upload.html#var$image_watermark_y">image_watermark_y</a> = <span class="src-id">null</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a2027"></a> <span class="src-var">$this</span><span class="src-sym">-></span><a href="class.upload.html#var$image_watermark_position">image_watermark_position</a> = <span class="src-id">null</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a2028"></a> </div></li> <li><div class="src-line"><a name="a2029"></a> <span class="src-var">$this</span><span class="src-sym">-></span><a href="class.upload.html#var$image_flip">image_flip</a> = <span class="src-id">null</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a2030"></a> <span class="src-var">$this</span><span class="src-sym">-></span><a href="class.upload.html#var$image_rotate">image_rotate</a> = <span class="src-id">null</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a2031"></a> <span class="src-var">$this</span><span class="src-sym">-></span><a href="class.upload.html#var$image_crop">image_crop</a> = <span class="src-id">null</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a2032"></a> <span class="src-var">$this</span><span class="src-sym">-></span><a href="class.upload.html#var$image_precrop">image_precrop</a> = <span class="src-id">null</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a2033"></a> </div></li> <li><div class="src-line"><a name="a2034"></a> <span class="src-var">$this</span><span class="src-sym">-></span><a href="class.upload.html#var$image_bevel">image_bevel</a> = <span class="src-id">null</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a2035"></a> <span class="src-var">$this</span><span class="src-sym">-></span><a href="class.upload.html#var$image_bevel_color1">image_bevel_color1</a> = <span class="src-str">'#FFFFFF'</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a2036"></a> <span class="src-var">$this</span><span class="src-sym">-></span><a href="class.upload.html#var$image_bevel_color2">image_bevel_color2</a> = <span class="src-str">'#000000'</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a2037"></a> <span class="src-var">$this</span><span class="src-sym">-></span><a href="class.upload.html#var$image_border">image_border</a> = <span class="src-id">null</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a2038"></a> <span class="src-var">$this</span><span class="src-sym">-></span><a href="class.upload.html#var$image_border_color">image_border_color</a> = <span class="src-str">'#FFFFFF'</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a2039"></a> <span class="src-var">$this</span><span class="src-sym">-></span><a href="class.upload.html#var$image_frame">image_frame</a> = <span class="src-id">null</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a2040"></a> <span class="src-var">$this</span><span class="src-sym">-></span><a href="class.upload.html#var$image_frame_colors">image_frame_colors</a> = <span class="src-str">'#FFFFFF #999999 #666666 #000000'</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a2041"></a> </div></li> <li><div class="src-line"><a name="a2042"></a> <span class="src-var">$this</span><span class="src-sym">-></span><a href="class.upload.html#var$forbidden">forbidden</a> = <span class="src-key">array</span><span class="src-sym">(</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a2043"></a> <span class="src-var">$this</span><span class="src-sym">-></span><a href="class.upload.html#var$allowed">allowed</a> = <span class="src-key">array</span><span class="src-sym">(</span><span class="src-str">"application/arj"</span><span class="src-sym">,</span></div></li> <li><div class="src-line"><a name="a2044"></a> <span class="src-str">"application/excel"</span><span class="src-sym">,</span></div></li> <li><div class="src-line"><a name="a2045"></a> <span class="src-str">"application/gnutar"</span><span class="src-sym">,</span></div></li> <li><div class="src-line"><a name="a2046"></a> <span class="src-str">"application/mspowerpoint"</span><span class="src-sym">,</span></div></li> <li><div class="src-line"><a name="a2047"></a> <span class="src-str">"application/msword"</span><span class="src-sym">,</span></div></li> <li><div class="src-line"><a name="a2048"></a> <span class="src-str">"application/octet-stream"</span><span class="src-sym">,</span></div></li> <li><div class="src-line"><a name="a2049"></a> <span class="src-str">"application/onenote"</span><span class="src-sym">,</span></div></li> <li><div class="src-line"><a name="a2050"></a> <span class="src-str">"application/pdf"</span><span class="src-sym">,</span></div></li> <li><div class="src-line"><a name="a2051"></a> <span class="src-str">"application/plain"</span><span class="src-sym">,</span></div></li> <li><div class="src-line"><a name="a2052"></a> <span class="src-str">"application/postscript"</span><span class="src-sym">,</span></div></li> <li><div class="src-line"><a name="a2053"></a> <span class="src-str">"application/powerpoint"</span><span class="src-sym">,</span></div></li> <li><div class="src-line"><a name="a2054"></a> <span class="src-str">"application/rar"</span><span class="src-sym">,</span></div></li> <li><div class="src-line"><a name="a2055"></a> <span class="src-str">"application/rtf"</span><span class="src-sym">,</span></div></li> <li><div class="src-line"><a name="a2056"></a> <span class="src-str">"application/vnd.ms-excel"</span><span class="src-sym">,</span></div></li> <li><div class="src-line"><a name="a2057"></a> <span class="src-str">"application/vnd.ms-excel.addin.macroEnabled.12"</span><span class="src-sym">,</span></div></li> <li><div class="src-line"><a name="a2058"></a> <span class="src-str">"application/vnd.ms-excel.sheet.binary.macroEnabled.12"</span><span class="src-sym">,</span></div></li> <li><div class="src-line"><a name="a2059"></a> <span class="src-str">"application/vnd.ms-excel.sheet.macroEnabled.12"</span><span class="src-sym">,</span></div></li> <li><div class="src-line"><a name="a2060"></a> <span class="src-str">"application/vnd.ms-excel.template.macroEnabled.12"</span><span class="src-sym">,</span></div></li> <li><div class="src-line"><a name="a2061"></a> <span class="src-str">"application/vnd.ms-office"</span><span class="src-sym">,</span></div></li> <li><div class="src-line"><a name="a2062"></a> <span class="src-str">"application/vnd.ms-officetheme"</span><span class="src-sym">,</span></div></li> <li><div class="src-line"><a name="a2063"></a> <span class="src-str">"application/vnd.ms-powerpoint"</span><span class="src-sym">,</span></div></li> <li><div class="src-line"><a name="a2064"></a> <span class="src-str">"application/vnd.ms-powerpoint.addin.macroEnabled.12"</span><span class="src-sym">,</span></div></li> <li><div class="src-line"><a name="a2065"></a> <span class="src-str">"application/vnd.ms-powerpoint.presentation.macroEnabled.12"</span><span class="src-sym">,</span></div></li> <li><div class="src-line"><a name="a2066"></a> <span class="src-str">"application/vnd.ms-powerpoint.slide.macroEnabled.12"</span><span class="src-sym">,</span></div></li> <li><div class="src-line"><a name="a2067"></a> <span class="src-str">"application/vnd.ms-powerpoint.slideshow.macroEnabled.12"</span><span class="src-sym">,</span></div></li> <li><div class="src-line"><a name="a2068"></a> <span class="src-str">"application/vnd.ms-powerpoint.template.macroEnabled.12"</span><span class="src-sym">,</span></div></li> <li><div class="src-line"><a name="a2069"></a> <span class="src-str">"application/vnd.ms-word"</span><span class="src-sym">,</span></div></li> <li><div class="src-line"><a name="a2070"></a> <span class="src-str">"application/vnd.ms-word.document.macroEnabled.12"</span><span class="src-sym">,</span></div></li> <li><div class="src-line"><a name="a2071"></a> <span class="src-str">"application/vnd.ms-word.template.macroEnabled.12"</span><span class="src-sym">,</span></div></li> <li><div class="src-line"><a name="a2072"></a> <span class="src-str">"application/vnd.oasis.opendocument.chart"</span><span class="src-sym">,</span></div></li> <li><div class="src-line"><a name="a2073"></a> <span class="src-str">"application/vnd.oasis.opendocument.database"</span><span class="src-sym">,</span></div></li> <li><div class="src-line"><a name="a2074"></a> <span class="src-str">"application/vnd.oasis.opendocument.formula"</span><span class="src-sym">,</span></div></li> <li><div class="src-line"><a name="a2075"></a> <span class="src-str">"application/vnd.oasis.opendocument.graphics"</span><span class="src-sym">,</span></div></li> <li><div class="src-line"><a name="a2076"></a> <span class="src-str">"application/vnd.oasis.opendocument.graphics-template"</span><span class="src-sym">,</span></div></li> <li><div class="src-line"><a name="a2077"></a> <span class="src-str">"application/vnd.oasis.opendocument.image"</span><span class="src-sym">,</span></div></li> <li><div class="src-line"><a name="a2078"></a> <span class="src-str">"application/vnd.oasis.opendocument.presentation"</span><span class="src-sym">,</span></div></li> <li><div class="src-line"><a name="a2079"></a> <span class="src-str">"application/vnd.oasis.opendocument.presentation-template"</span><span class="src-sym">,</span></div></li> <li><div class="src-line"><a name="a2080"></a> <span class="src-str">"application/vnd.oasis.opendocument.spreadsheet"</span><span class="src-sym">,</span></div></li> <li><div class="src-line"><a name="a2081"></a> <span class="src-str">"application/vnd.oasis.opendocument.spreadsheet-template"</span><span class="src-sym">,</span></div></li> <li><div class="src-line"><a name="a2082"></a> <span class="src-str">"application/vnd.oasis.opendocument.text"</span><span class="src-sym">,</span></div></li> <li><div class="src-line"><a name="a2083"></a> <span class="src-str">"application/vnd.oasis.opendocument.text-master"</span><span class="src-sym">,</span></div></li> <li><div class="src-line"><a name="a2084"></a> <span class="src-str">"application/vnd.oasis.opendocument.text-template"</span><span class="src-sym">,</span></div></li> <li><div class="src-line"><a name="a2085"></a> <span class="src-str">"application/vnd.oasis.opendocument.text-web"</span><span class="src-sym">,</span></div></li> <li><div class="src-line"><a name="a2086"></a> <span class="src-str">"application/vnd.openofficeorg.extension"</span><span class="src-sym">,</span></div></li> <li><div class="src-line"><a name="a2087"></a> <span class="src-str">"application/vnd.openxmlformats-officedocument.presentationml.presentation"</span><span class="src-sym">,</span></div></li> <li><div class="src-line"><a name="a2088"></a> <span class="src-str">"application/vnd.openxmlformats-officedocument.presentationml.slide"</span><span class="src-sym">,</span></div></li> <li><div class="src-line"><a name="a2089"></a> <span class="src-str">"application/vnd.openxmlformats-officedocument.presentationml.slideshow"</span><span class="src-sym">,</span></div></li> <li><div class="src-line"><a name="a2090"></a> <span class="src-str">"application/vnd.openxmlformats-officedocument.presentationml.template"</span><span class="src-sym">,</span></div></li> <li><div class="src-line"><a name="a2091"></a> <span class="src-str">"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"</span><span class="src-sym">,</span></div></li> <li><div class="src-line"><a name="a2092"></a> <span class="src-str">"application/vnd.openxmlformats-officedocument.spreadsheetml.template"</span><span class="src-sym">,</span></div></li> <li><div class="src-line"><a name="a2093"></a> <span class="src-str">"application/vnd.openxmlformats-officedocument.wordprocessingml.document"</span><span class="src-sym">,</span></div></li> <li><div class="src-line"><a name="a2094"></a> <span class="src-str">"application/vnd.openxmlformats-officedocument.wordprocessingml.document"</span><span class="src-sym">,</span></div></li> <li><div class="src-line"><a name="a2095"></a> <span class="src-str">"application/vnd.openxmlformats-officedocument.wordprocessingml.template"</span><span class="src-sym">,</span></div></li> <li><div class="src-line"><a name="a2096"></a> <span class="src-str">"application/vocaltec-media-file"</span><span class="src-sym">,</span></div></li> <li><div class="src-line"><a name="a2097"></a> <span class="src-str">"application/wordperfect"</span><span class="src-sym">,</span></div></li> <li><div class="src-line"><a name="a2098"></a> <span class="src-str">"application/x-bittorrent"</span><span class="src-sym">,</span></div></li> <li><div class="src-line"><a name="a2099"></a> <span class="src-str">"application/x-bzip"</span><span class="src-sym">,</span></div></li> <li><div class="src-line"><a name="a2100"></a> <span class="src-str">"application/x-bzip2"</span><span class="src-sym">,</span></div></li> <li><div class="src-line"><a name="a2101"></a> <span class="src-str">"application/x-compressed"</span><span class="src-sym">,</span></div></li> <li><div class="src-line"><a name="a2102"></a> <span class="src-str">"application/x-excel"</span><span class="src-sym">,</span></div></li> <li><div class="src-line"><a name="a2103"></a> <span class="src-str">"application/x-gzip"</span><span class="src-sym">,</span></div></li> <li><div class="src-line"><a name="a2104"></a> <span class="src-str">"application/x-latex"</span><span class="src-sym">,</span></div></li> <li><div class="src-line"><a name="a2105"></a> <span class="src-str">"application/x-midi"</span><span class="src-sym">,</span></div></li> <li><div class="src-line"><a name="a2106"></a> <span class="src-str">"application/xml"</span><span class="src-sym">,</span></div></li> <li><div class="src-line"><a name="a2107"></a> <span class="src-str">"application/x-msexcel"</span><span class="src-sym">,</span></div></li> <li><div class="src-line"><a name="a2108"></a> <span class="src-str">"application/x-rar-compressed"</span><span class="src-sym">,</span></div></li> <li><div class="src-line"><a name="a2109"></a> <span class="src-str">"application/x-rtf"</span><span class="src-sym">,</span></div></li> <li><div class="src-line"><a name="a2110"></a> <span class="src-str">"application/x-shockwave-flash"</span><span class="src-sym">,</span></div></li> <li><div class="src-line"><a name="a2111"></a> <span class="src-str">"application/x-sit"</span><span class="src-sym">,</span></div></li> <li><div class="src-line"><a name="a2112"></a> <span class="src-str">"application/x-stuffit"</span><span class="src-sym">,</span></div></li> <li><div class="src-line"><a name="a2113"></a> <span class="src-str">"application/x-troff-msvideo"</span><span class="src-sym">,</span></div></li> <li><div class="src-line"><a name="a2114"></a> <span class="src-str">"application/x-zip"</span><span class="src-sym">,</span></div></li> <li><div class="src-line"><a name="a2115"></a> <span class="src-str">"application/x-zip-compressed"</span><span class="src-sym">,</span></div></li> <li><div class="src-line"><a name="a2116"></a> <span class="src-str">"application/zip"</span><span class="src-sym">,</span></div></li> <li><div class="src-line"><a name="a2117"></a> <span class="src-str">"audio/*"</span><span class="src-sym">,</span></div></li> <li><div class="src-line"><a name="a2118"></a> <span class="src-str">"image/*"</span><span class="src-sym">,</span></div></li> <li><div class="src-line"><a name="a2119"></a> <span class="src-str">"multipart/x-gzip"</span><span class="src-sym">,</span></div></li> <li><div class="src-line"><a name="a2120"></a> <span class="src-str">"multipart/x-zip"</span><span class="src-sym">,</span></div></li> <li><div class="src-line"><a name="a2121"></a> <span class="src-str">"text/plain"</span><span class="src-sym">,</span></div></li> <li><div class="src-line"><a name="a2122"></a> <span class="src-str">"text/richtext"</span><span class="src-sym">,</span></div></li> <li><div class="src-line"><a name="a2123"></a> <span class="src-str">"text/xml"</span><span class="src-sym">,</span></div></li> <li><div class="src-line"><a name="a2124"></a> <span class="src-str">"video/*"</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a2125"></a> </div></li> <li><div class="src-line"><a name="a2126"></a> <span class="src-sym">}</span></div></li> <li><div class="src-line"><a name="a2127"></a> </div></li> <li><div class="src-line"><a name="a2128"></a> <span class="src-doc">/**</span></div></li> <li><div class="src-line"><a name="a2129"></a><span class="src-doc"> * Constructor. Checks if the file has been uploaded</span></div></li> <li><div class="src-line"><a name="a2130"></a><span class="src-doc"> *</span></div></li> <li><div class="src-line"><a name="a2131"></a><span class="src-doc"> * The constructor takes $_FILES['form_field'] array as argument</span></div></li> <li><div class="src-line"><a name="a2132"></a><span class="src-doc"> * where form_field is the form field name</span></div></li> <li><div class="src-line"><a name="a2133"></a><span class="src-doc"> *</span></div></li> <li><div class="src-line"><a name="a2134"></a><span class="src-doc"> * The constructor will check if the file has been uploaded in its temporary location, and</span></div></li> <li><div class="src-line"><a name="a2135"></a><span class="src-doc"> * accordingly will set </span><span class="src-doc-inlinetag">{@link uploaded}</span><span class="src-doc"> (and </span><span class="src-doc-inlinetag">{@link error}</span><span class="src-doc"> is an error occurred)</span></div></li> <li><div class="src-line"><a name="a2136"></a><span class="src-doc"> *</span></div></li> <li><div class="src-line"><a name="a2137"></a><span class="src-doc"> * If the file has been uploaded, the constructor will populate all the variables holding the upload</span></div></li> <li><div class="src-line"><a name="a2138"></a><span class="src-doc"> * information (none of the processing class variables are used here).</span></div></li> <li><div class="src-line"><a name="a2139"></a><span class="src-doc"> * You can have access to information about the file (name, size, MIME type...).</span></div></li> <li><div class="src-line"><a name="a2140"></a><span class="src-doc"> *</span></div></li> <li><div class="src-line"><a name="a2141"></a><span class="src-doc"> *</span></div></li> <li><div class="src-line"><a name="a2142"></a><span class="src-doc"> * Alternatively, you can set the first argument to be a local filename (string)</span></div></li> <li><div class="src-line"><a name="a2143"></a><span class="src-doc"> * This allows processing of a local file, as if the file was uploaded</span></div></li> <li><div class="src-line"><a name="a2144"></a><span class="src-doc"> *</span></div></li> <li><div class="src-line"><a name="a2145"></a><span class="src-doc"> * The optional second argument allows you to set the language for the error messages</span></div></li> <li><div class="src-line"><a name="a2146"></a><span class="src-doc"> *</span></div></li> <li><div class="src-line"><a name="a2147"></a><span class="src-doc"> * </span><span class="src-doc-coretag">@access</span><span class="src-doc"> private</span></div></li> <li><div class="src-line"><a name="a2148"></a><span class="src-doc"> * </span><span class="src-doc-coretag">@param </span><span class="src-doc"> </span><span class="src-doc-type">array </span><span class="src-doc"> </span><span class="src-doc-var">$file </span><span class="src-doc">$_FILES['form_field']</span></div></li> <li><div class="src-line"><a name="a2149"></a><span class="src-doc"> * or string $file Local filename</span></div></li> <li><div class="src-line"><a name="a2150"></a><span class="src-doc"> * </span><span class="src-doc-coretag">@param </span><span class="src-doc"> </span><span class="src-doc-type">string </span><span class="src-doc-var">$lang </span><span class="src-doc">Optional language code</span></div></li> <li><div class="src-line"><a name="a2151"></a><span class="src-doc"> */</span></div></li> <li><div class="src-line"><a name="a2152"></a> <span class="src-key">function </span><span class="src-id">upload</span><span class="src-sym">(</span><span class="src-var">$file</span><span class="src-sym">, </span><span class="src-var">$lang </span>= <span class="src-str">'en_GB'</span><span class="src-sym">) </span><span class="src-sym">{</span></div></li> <li><div class="src-line"><a name="a2153"></a> </div></li> <li><div class="src-line"><a name="a2154"></a> <span class="src-var">$this</span><span class="src-sym">-></span><a href="class.upload.html#var$version">version</a> = <span class="src-str">'0.29'</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a2155"></a> </div></li> <li><div class="src-line"><a name="a2156"></a> <span class="src-var">$this</span><span class="src-sym">-></span><a href="class.upload.html#var$file_src_name">file_src_name</a> = <span class="src-str">''</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a2157"></a> <span class="src-var">$this</span><span class="src-sym">-></span><a href="class.upload.html#var$file_src_name_body">file_src_name_body</a> = <span class="src-str">''</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a2158"></a> <span class="src-var">$this</span><span class="src-sym">-></span><a href="class.upload.html#var$file_src_name_ext">file_src_name_ext</a> = <span class="src-str">''</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a2159"></a> <span class="src-var">$this</span><span class="src-sym">-></span><a href="class.upload.html#var$file_src_mime">file_src_mime</a> = <span class="src-str">''</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a2160"></a> <span class="src-var">$this</span><span class="src-sym">-></span><a href="class.upload.html#var$file_src_size">file_src_size</a> = <span class="src-str">''</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a2161"></a> <span class="src-var">$this</span><span class="src-sym">-></span><a href="class.upload.html#var$file_src_error">file_src_error</a> = <span class="src-str">''</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a2162"></a> <span class="src-var">$this</span><span class="src-sym">-></span><span class="src-var">file_src_pathname </span>= <span class="src-str">''</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a2163"></a> <span class="src-var">$this</span><span class="src-sym">-></span><span class="src-var">file_src_temp </span>= <span class="src-str">''</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a2164"></a> </div></li> <li><div class="src-line"><a name="a2165"></a> <span class="src-var">$this</span><span class="src-sym">-></span><span class="src-var">file_dst_path </span>= <span class="src-str">''</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a2166"></a> <span class="src-var">$this</span><span class="src-sym">-></span><a href="class.upload.html#var$file_dst_name">file_dst_name</a> = <span class="src-str">''</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a2167"></a> <span class="src-var">$this</span><span class="src-sym">-></span><a href="class.upload.html#var$file_dst_name_body">file_dst_name_body</a> = <span class="src-str">''</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a2168"></a> <span class="src-var">$this</span><span class="src-sym">-></span><a href="class.upload.html#var$file_dst_name_ext">file_dst_name_ext</a> = <span class="src-str">''</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a2169"></a> <span class="src-var">$this</span><span class="src-sym">-></span><span class="src-var">file_dst_pathname </span>= <span class="src-str">''</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a2170"></a> </div></li> <li><div class="src-line"><a name="a2171"></a> <span class="src-var">$this</span><span class="src-sym">-></span><span class="src-var">image_src_x </span>= <span class="src-id">null</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a2172"></a> <span class="src-var">$this</span><span class="src-sym">-></span><span class="src-var">image_src_y </span>= <span class="src-id">null</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a2173"></a> <span class="src-var">$this</span><span class="src-sym">-></span><span class="src-var">image_src_bits </span>= <span class="src-id">null</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a2174"></a> <span class="src-var">$this</span><span class="src-sym">-></span><span class="src-var">image_src_type </span>= <span class="src-id">null</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a2175"></a> <span class="src-var">$this</span><span class="src-sym">-></span><span class="src-var">image_src_pixels </span>= <span class="src-id">null</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a2176"></a> <span class="src-var">$this</span><span class="src-sym">-></span><span class="src-var">image_dst_x </span>= <span class="src-num">0</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a2177"></a> <span class="src-var">$this</span><span class="src-sym">-></span><span class="src-var">image_dst_y </span>= <span class="src-num">0</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a2178"></a> </div></li> <li><div class="src-line"><a name="a2179"></a> <span class="src-var">$this</span><span class="src-sym">-></span><a href="class.upload.html#var$uploaded">uploaded</a> = <span class="src-id">true</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a2180"></a> <span class="src-var">$this</span><span class="src-sym">-></span><a href="class.upload.html#var$no_upload_check">no_upload_check</a> = <span class="src-id">false</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a2181"></a> <span class="src-var">$this</span><span class="src-sym">-></span><a href="class.upload.html#var$processed">processed</a> = <span class="src-id">true</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a2182"></a> <span class="src-var">$this</span><span class="src-sym">-></span><a href="class.upload.html#var$error">error</a> = <span class="src-str">''</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a2183"></a> <span class="src-var">$this</span><span class="src-sym">-></span><a href="class.upload.html#var$log">log</a> = <span class="src-str">''</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a2184"></a> <span class="src-var">$this</span><span class="src-sym">-></span><a href="class.upload.html#var$allowed">allowed</a> = <span class="src-key">array</span><span class="src-sym">(</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a2185"></a> <span class="src-var">$this</span><span class="src-sym">-></span><a href="class.upload.html#var$forbidden">forbidden</a> = <span class="src-key">array</span><span class="src-sym">(</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a2186"></a> <span class="src-var">$this</span><span class="src-sym">-></span><span class="src-var">file_is_image </span>= <span class="src-id">false</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a2187"></a> <span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id">init</span><span class="src-sym">(</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a2188"></a> <span class="src-var">$info </span>= <span class="src-id">null</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a2189"></a> <span class="src-var">$mime_from_browser </span>= <span class="src-id">null</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a2190"></a> </div></li> <li><div class="src-line"><a name="a2191"></a> <span class="src-comm">// sets default language</span></div></li> <li><div class="src-line"><a name="a2192"></a> <span class="src-var">$this</span><span class="src-sym">-></span><a href="class.upload.html#var$translation">translation</a> = <span class="src-key">array</span><span class="src-sym">(</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a2193"></a> <span class="src-var">$this</span><span class="src-sym">-></span><a href="class.upload.html#var$translation">translation</a><span class="src-sym">[</span><span class="src-str">'file_error'</span><span class="src-sym">] </span>= <span class="src-str">'File error. Please try again.'</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a2194"></a> <span class="src-var">$this</span><span class="src-sym">-></span><a href="class.upload.html#var$translation">translation</a><span class="src-sym">[</span><span class="src-str">'local_file_missing'</span><span class="src-sym">] </span>= <span class="src-str">'Local file doesn\'t exist.'</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a2195"></a> <span class="src-var">$this</span><span class="src-sym">-></span><a href="class.upload.html#var$translation">translation</a><span class="src-sym">[</span><span class="src-str">'local_file_not_readable'</span><span class="src-sym">] </span>= <span class="src-str">'Local file is not readable.'</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a2196"></a> <span class="src-var">$this</span><span class="src-sym">-></span><a href="class.upload.html#var$translation">translation</a><span class="src-sym">[</span><span class="src-str">'uploaded_too_big_ini'</span><span class="src-sym">] </span>= <span class="src-str">'File upload error (the uploaded file exceeds the upload_max_filesize directive in php.ini).'</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a2197"></a> <span class="src-var">$this</span><span class="src-sym">-></span><a href="class.upload.html#var$translation">translation</a><span class="src-sym">[</span><span class="src-str">'uploaded_too_big_html'</span><span class="src-sym">] </span>= <span class="src-str">'File upload error (the uploaded file exceeds the MAX_FILE_SIZE directive that was specified in the html form).'</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a2198"></a> <span class="src-var">$this</span><span class="src-sym">-></span><a href="class.upload.html#var$translation">translation</a><span class="src-sym">[</span><span class="src-str">'uploaded_partial'</span><span class="src-sym">] </span>= <span class="src-str">'File upload error (the uploaded file was only partially uploaded).'</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a2199"></a> <span class="src-var">$this</span><span class="src-sym">-></span><a href="class.upload.html#var$translation">translation</a><span class="src-sym">[</span><span class="src-str">'uploaded_missing'</span><span class="src-sym">] </span>= <span class="src-str">'File upload error (no file was uploaded).'</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a2200"></a> <span class="src-var">$this</span><span class="src-sym">-></span><a href="class.upload.html#var$translation">translation</a><span class="src-sym">[</span><span class="src-str">'uploaded_no_tmp_dir'</span><span class="src-sym">] </span>= <span class="src-str">'File upload error (missing a temporary folder).'</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a2201"></a> <span class="src-var">$this</span><span class="src-sym">-></span><a href="class.upload.html#var$translation">translation</a><span class="src-sym">[</span><span class="src-str">'uploaded_cant_write'</span><span class="src-sym">] </span>= <span class="src-str">'File upload error (failed to write file to disk).'</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a2202"></a> <span class="src-var">$this</span><span class="src-sym">-></span><a href="class.upload.html#var$translation">translation</a><span class="src-sym">[</span><span class="src-str">'uploaded_err_extension'</span><span class="src-sym">] </span>= <span class="src-str">'File upload error (file upload stopped by extension).'</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a2203"></a> <span class="src-var">$this</span><span class="src-sym">-></span><a href="class.upload.html#var$translation">translation</a><span class="src-sym">[</span><span class="src-str">'uploaded_unknown'</span><span class="src-sym">] </span>= <span class="src-str">'File upload error (unknown error code).'</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a2204"></a> <span class="src-var">$this</span><span class="src-sym">-></span><a href="class.upload.html#var$translation">translation</a><span class="src-sym">[</span><span class="src-str">'try_again'</span><span class="src-sym">] </span>= <span class="src-str">'File upload error. Please try again.'</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a2205"></a> <span class="src-var">$this</span><span class="src-sym">-></span><a href="class.upload.html#var$translation">translation</a><span class="src-sym">[</span><span class="src-str">'file_too_big'</span><span class="src-sym">] </span>= <span class="src-str">'File too big.'</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a2206"></a> <span class="src-var">$this</span><span class="src-sym">-></span><a href="class.upload.html#var$translation">translation</a><span class="src-sym">[</span><span class="src-str">'no_mime'</span><span class="src-sym">] </span>= <span class="src-str">'MIME type can\'t be detected.'</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a2207"></a> <span class="src-var">$this</span><span class="src-sym">-></span><a href="class.upload.html#var$translation">translation</a><span class="src-sym">[</span><span class="src-str">'incorrect_file'</span><span class="src-sym">] </span>= <span class="src-str">'Incorrect type of file.'</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a2208"></a> <span class="src-var">$this</span><span class="src-sym">-></span><a href="class.upload.html#var$translation">translation</a><span class="src-sym">[</span><span class="src-str">'image_too_wide'</span><span class="src-sym">] </span>= <span class="src-str">'Image too wide.'</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a2209"></a> <span class="src-var">$this</span><span class="src-sym">-></span><a href="class.upload.html#var$translation">translation</a><span class="src-sym">[</span><span class="src-str">'image_too_narrow'</span><span class="src-sym">] </span>= <span class="src-str">'Image too narrow.'</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a2210"></a> <span class="src-var">$this</span><span class="src-sym">-></span><a href="class.upload.html#var$translation">translation</a><span class="src-sym">[</span><span class="src-str">'image_too_high'</span><span class="src-sym">] </span>= <span class="src-str">'Image too high.'</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a2211"></a> <span class="src-var">$this</span><span class="src-sym">-></span><a href="class.upload.html#var$translation">translation</a><span class="src-sym">[</span><span class="src-str">'image_too_short'</span><span class="src-sym">] </span>= <span class="src-str">'Image too short.'</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a2212"></a> <span class="src-var">$this</span><span class="src-sym">-></span><a href="class.upload.html#var$translation">translation</a><span class="src-sym">[</span><span class="src-str">'ratio_too_high'</span><span class="src-sym">] </span>= <span class="src-str">'Image ratio too high (image too wide).'</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a2213"></a> <span class="src-var">$this</span><span class="src-sym">-></span><a href="class.upload.html#var$translation">translation</a><span class="src-sym">[</span><span class="src-str">'ratio_too_low'</span><span class="src-sym">] </span>= <span class="src-str">'Image ratio too low (image too high).'</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a2214"></a> <span class="src-var">$this</span><span class="src-sym">-></span><a href="class.upload.html#var$translation">translation</a><span class="src-sym">[</span><span class="src-str">'too_many_pixels'</span><span class="src-sym">] </span>= <span class="src-str">'Image has too many pixels.'</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a2215"></a> <span class="src-var">$this</span><span class="src-sym">-></span><a href="class.upload.html#var$translation">translation</a><span class="src-sym">[</span><span class="src-str">'not_enough_pixels'</span><span class="src-sym">] </span>= <span class="src-str">'Image has not enough pixels.'</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a2216"></a> <span class="src-var">$this</span><span class="src-sym">-></span><a href="class.upload.html#var$translation">translation</a><span class="src-sym">[</span><span class="src-str">'file_not_uploaded'</span><span class="src-sym">] </span>= <span class="src-str">'File not uploaded. Can\'t carry on a process.'</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a2217"></a> <span class="src-var">$this</span><span class="src-sym">-></span><a href="class.upload.html#var$translation">translation</a><span class="src-sym">[</span><span class="src-str">'already_exists'</span><span class="src-sym">] </span>= <span class="src-str">'%s already exists. Please change the file name.'</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a2218"></a> <span class="src-var">$this</span><span class="src-sym">-></span><a href="class.upload.html#var$translation">translation</a><span class="src-sym">[</span><span class="src-str">'temp_file_missing'</span><span class="src-sym">] </span>= <span class="src-str">'No correct temp source file. Can\'t carry on a process.'</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a2219"></a> <span class="src-var">$this</span><span class="src-sym">-></span><a href="class.upload.html#var$translation">translation</a><span class="src-sym">[</span><span class="src-str">'source_missing'</span><span class="src-sym">] </span>= <span class="src-str">'No correct uploaded source file. Can\'t carry on a process.'</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a2220"></a> <span class="src-var">$this</span><span class="src-sym">-></span><a href="class.upload.html#var$translation">translation</a><span class="src-sym">[</span><span class="src-str">'destination_dir'</span><span class="src-sym">] </span>= <span class="src-str">'Destination directory can\'t be created. Can\'t carry on a process.'</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a2221"></a> <span class="src-var">$this</span><span class="src-sym">-></span><a href="class.upload.html#var$translation">translation</a><span class="src-sym">[</span><span class="src-str">'destination_dir_missing'</span><span class="src-sym">] </span>= <span class="src-str">'Destination directory doesn\'t exist. Can\'t carry on a process.'</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a2222"></a> <span class="src-var">$this</span><span class="src-sym">-></span><a href="class.upload.html#var$translation">translation</a><span class="src-sym">[</span><span class="src-str">'destination_path_not_dir'</span><span class="src-sym">] </span>= <span class="src-str">'Destination path is not a directory. Can\'t carry on a process.'</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a2223"></a> <span class="src-var">$this</span><span class="src-sym">-></span><a href="class.upload.html#var$translation">translation</a><span class="src-sym">[</span><span class="src-str">'destination_dir_write'</span><span class="src-sym">] </span>= <span class="src-str">'Destination directory can\'t be made writeable. Can\'t carry on a process.'</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a2224"></a> <span class="src-var">$this</span><span class="src-sym">-></span><a href="class.upload.html#var$translation">translation</a><span class="src-sym">[</span><span class="src-str">'destination_path_write'</span><span class="src-sym">] </span>= <span class="src-str">'Destination path is not a writeable. Can\'t carry on a process.'</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a2225"></a> <span class="src-var">$this</span><span class="src-sym">-></span><a href="class.upload.html#var$translation">translation</a><span class="src-sym">[</span><span class="src-str">'temp_file'</span><span class="src-sym">] </span>= <span class="src-str">'Can\'t create the temporary file. Can\'t carry on a process.'</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a2226"></a> <span class="src-var">$this</span><span class="src-sym">-></span><a href="class.upload.html#var$translation">translation</a><span class="src-sym">[</span><span class="src-str">'source_not_readable'</span><span class="src-sym">] </span>= <span class="src-str">'Source file is not readable. Can\'t carry on a process.'</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a2227"></a> <span class="src-var">$this</span><span class="src-sym">-></span><a href="class.upload.html#var$translation">translation</a><span class="src-sym">[</span><span class="src-str">'no_create_support'</span><span class="src-sym">] </span>= <span class="src-str">'No create from %s support.'</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a2228"></a> <span class="src-var">$this</span><span class="src-sym">-></span><a href="class.upload.html#var$translation">translation</a><span class="src-sym">[</span><span class="src-str">'create_error'</span><span class="src-sym">] </span>= <span class="src-str">'Error in creating %s image from source.'</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a2229"></a> <span class="src-var">$this</span><span class="src-sym">-></span><a href="class.upload.html#var$translation">translation</a><span class="src-sym">[</span><span class="src-str">'source_invalid'</span><span class="src-sym">] </span>= <span class="src-str">'Can\'t read image source. Not an image?.'</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a2230"></a> <span class="src-var">$this</span><span class="src-sym">-></span><a href="class.upload.html#var$translation">translation</a><span class="src-sym">[</span><span class="src-str">'gd_missing'</span><span class="src-sym">] </span>= <span class="src-str">'GD doesn\'t seem to be present.'</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a2231"></a> <span class="src-var">$this</span><span class="src-sym">-></span><a href="class.upload.html#var$translation">translation</a><span class="src-sym">[</span><span class="src-str">'watermark_no_create_support'</span><span class="src-sym">] </span>= <span class="src-str">'No create from %s support, can\'t read watermark.'</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a2232"></a> <span class="src-var">$this</span><span class="src-sym">-></span><a href="class.upload.html#var$translation">translation</a><span class="src-sym">[</span><span class="src-str">'watermark_create_error'</span><span class="src-sym">] </span>= <span class="src-str">'No %s read support, can\'t create watermark.'</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a2233"></a> <span class="src-var">$this</span><span class="src-sym">-></span><a href="class.upload.html#var$translation">translation</a><span class="src-sym">[</span><span class="src-str">'watermark_invalid'</span><span class="src-sym">] </span>= <span class="src-str">'Unknown image format, can\'t read watermark.'</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a2234"></a> <span class="src-var">$this</span><span class="src-sym">-></span><a href="class.upload.html#var$translation">translation</a><span class="src-sym">[</span><span class="src-str">'file_create'</span><span class="src-sym">] </span>= <span class="src-str">'No %s create support.'</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a2235"></a> <span class="src-var">$this</span><span class="src-sym">-></span><a href="class.upload.html#var$translation">translation</a><span class="src-sym">[</span><span class="src-str">'no_conversion_type'</span><span class="src-sym">] </span>= <span class="src-str">'No conversion type defined.'</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a2236"></a> <span class="src-var">$this</span><span class="src-sym">-></span><a href="class.upload.html#var$translation">translation</a><span class="src-sym">[</span><span class="src-str">'copy_failed'</span><span class="src-sym">] </span>= <span class="src-str">'Error copying file on the server. copy() failed.'</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a2237"></a> <span class="src-var">$this</span><span class="src-sym">-></span><a href="class.upload.html#var$translation">translation</a><span class="src-sym">[</span><span class="src-str">'reading_failed'</span><span class="src-sym">] </span>= <span class="src-str">'Error reading the file.'</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a2238"></a> </div></li> <li><div class="src-line"><a name="a2239"></a> <span class="src-comm">// determines the language</span></div></li> <li><div class="src-line"><a name="a2240"></a> <span class="src-var">$this</span><span class="src-sym">-></span><span class="src-var">lang </span>= <span class="src-var">$lang</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a2241"></a> <span class="src-key">if </span><span class="src-sym">(</span><span class="src-var">$this</span><span class="src-sym">-></span><span class="src-var">lang </span>!= <span class="src-str">'en_GB' </span>&& <a href="http://www.php.net/file_exists">file_exists</a><span class="src-sym">(</span><a href="http://www.php.net/dirname">dirname</a><span class="src-sym">(</span>__FILE__<span class="src-sym">)</span>.<span class="src-str">'/lang'</span><span class="src-sym">) </span>&& <a href="http://www.php.net/file_exists">file_exists</a><span class="src-sym">(</span><a href="http://www.php.net/dirname">dirname</a><span class="src-sym">(</span>__FILE__<span class="src-sym">)</span>.<span class="src-str">'/lang/class.upload.' </span>. <span class="src-var">$lang </span>. <span class="src-str">'.php'</span><span class="src-sym">)) </span><span class="src-sym">{</span></div></li> <li><div class="src-line"><a name="a2242"></a> <span class="src-var">$translation </span>= <span class="src-id">null</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a2243"></a> <span class="src-inc">include</span><span class="src-sym">(</span><a href="http://www.php.net/dirname">dirname</a><span class="src-sym">(</span>__FILE__<span class="src-sym">)</span>.<span class="src-str">'/lang/class.upload.' </span>. <span class="src-var">$lang </span>. <span class="src-str">'.php'</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a2244"></a> <span class="src-key">if </span><span class="src-sym">(</span><a href="http://www.php.net/is_array">is_array</a><span class="src-sym">(</span><span class="src-var">$translation</span><span class="src-sym">)) </span><span class="src-sym">{</span></div></li> <li><div class="src-line"><a name="a2245"></a> <span class="src-var">$this</span><span class="src-sym">-></span><a href="class.upload.html#var$translation">translation</a> = <a href="http://www.php.net/array_merge">array_merge</a><span class="src-sym">(</span><span class="src-var">$this</span><span class="src-sym">-></span><a href="class.upload.html#var$translation">translation</a><span class="src-sym">, </span><span class="src-var">$translation</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a2246"></a> <span class="src-sym">} </span><span class="src-key">else </span><span class="src-sym">{</span></div></li> <li><div class="src-line"><a name="a2247"></a> <span class="src-var">$this</span><span class="src-sym">-></span><span class="src-var">lang </span>= <span class="src-str">'en_GB'</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a2248"></a> <span class="src-sym">}</span></div></li> <li><div class="src-line"><a name="a2249"></a> <span class="src-sym">}</span></div></li> <li><div class="src-line"><a name="a2250"></a> </div></li> <li><div class="src-line"><a name="a2251"></a> </div></li> <li><div class="src-line"><a name="a2252"></a> <span class="src-comm">// determines the supported MIME types, and matching image format</span></div></li> <li><div class="src-line"><a name="a2253"></a> <span class="src-var">$this</span><span class="src-sym">-></span><span class="src-var">image_supported </span>= <span class="src-key">array</span><span class="src-sym">(</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a2254"></a> <span class="src-key">if </span><span class="src-sym">(</span><span class="src-var">$this</span><span class="src-sym">-></span><a href="class.upload.html#methodgdversion">gdversion</a><span class="src-sym">(</span><span class="src-sym">)) </span><span class="src-sym">{</span></div></li> <li><div class="src-line"><a name="a2255"></a> <span class="src-key">if </span><span class="src-sym">(</span><a href="http://www.php.net/imagetypes">imagetypes</a><span class="src-sym">(</span><span class="src-sym">) </span><span class="src-sym">& </span><span class="src-id">IMG_GIF</span><span class="src-sym">) </span><span class="src-sym">{</span></div></li> <li><div class="src-line"><a name="a2256"></a> <span class="src-var">$this</span><span class="src-sym">-></span><span class="src-var">image_supported</span><span class="src-sym">[</span><span class="src-str">'image/gif'</span><span class="src-sym">] </span>= <span class="src-str">'gif'</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a2257"></a> <span class="src-sym">}</span></div></li> <li><div class="src-line"><a name="a2258"></a> <span class="src-key">if </span><span class="src-sym">(</span><a href="http://www.php.net/imagetypes">imagetypes</a><span class="src-sym">(</span><span class="src-sym">) </span><span class="src-sym">& </span><span class="src-id">IMG_JPG</span><span class="src-sym">) </span><span class="src-sym">{</span></div></li> <li><div class="src-line"><a name="a2259"></a> <span class="src-var">$this</span><span class="src-sym">-></span><span class="src-var">image_supported</span><span class="src-sym">[</span><span class="src-str">'image/jpg'</span><span class="src-sym">] </span>= <span class="src-str">'jpg'</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a2260"></a> <span class="src-var">$this</span><span class="src-sym">-></span><span class="src-var">image_supported</span><span class="src-sym">[</span><span class="src-str">'image/jpeg'</span><span class="src-sym">] </span>= <span class="src-str">'jpg'</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a2261"></a> <span class="src-var">$this</span><span class="src-sym">-></span><span class="src-var">image_supported</span><span class="src-sym">[</span><span class="src-str">'image/pjpeg'</span><span class="src-sym">] </span>= <span class="src-str">'jpg'</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a2262"></a> <span class="src-sym">}</span></div></li> <li><div class="src-line"><a name="a2263"></a> <span class="src-key">if </span><span class="src-sym">(</span><a href="http://www.php.net/imagetypes">imagetypes</a><span class="src-sym">(</span><span class="src-sym">) </span><span class="src-sym">& </span><span class="src-id">IMG_PNG</span><span class="src-sym">) </span><span class="src-sym">{</span></div></li> <li><div class="src-line"><a name="a2264"></a> <span class="src-var">$this</span><span class="src-sym">-></span><span class="src-var">image_supported</span><span class="src-sym">[</span><span class="src-str">'image/png'</span><span class="src-sym">] </span>= <span class="src-str">'png'</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a2265"></a> <span class="src-var">$this</span><span class="src-sym">-></span><span class="src-var">image_supported</span><span class="src-sym">[</span><span class="src-str">'image/x-png'</span><span class="src-sym">] </span>= <span class="src-str">'png'</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a2266"></a> <span class="src-sym">}</span></div></li> <li><div class="src-line"><a name="a2267"></a> <span class="src-key">if </span><span class="src-sym">(</span><a href="http://www.php.net/imagetypes">imagetypes</a><span class="src-sym">(</span><span class="src-sym">) </span><span class="src-sym">& </span><span class="src-id">IMG_WBMP</span><span class="src-sym">) </span><span class="src-sym">{</span></div></li> <li><div class="src-line"><a name="a2268"></a> <span class="src-var">$this</span><span class="src-sym">-></span><span class="src-var">image_supported</span><span class="src-sym">[</span><span class="src-str">'image/bmp'</span><span class="src-sym">] </span>= <span class="src-str">'bmp'</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a2269"></a> <span class="src-var">$this</span><span class="src-sym">-></span><span class="src-var">image_supported</span><span class="src-sym">[</span><span class="src-str">'image/x-ms-bmp'</span><span class="src-sym">] </span>= <span class="src-str">'bmp'</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a2270"></a> <span class="src-var">$this</span><span class="src-sym">-></span><span class="src-var">image_supported</span><span class="src-sym">[</span><span class="src-str">'image/x-windows-bmp'</span><span class="src-sym">] </span>= <span class="src-str">'bmp'</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a2271"></a> <span class="src-sym">}</span></div></li> <li><div class="src-line"><a name="a2272"></a> <span class="src-sym">}</span></div></li> <li><div class="src-line"><a name="a2273"></a> </div></li> <li><div class="src-line"><a name="a2274"></a> <span class="src-comm">// display some system information</span></div></li> <li><div class="src-line"><a name="a2275"></a> <span class="src-key">if </span><span class="src-sym">(</span><span class="src-key">empty</span><span class="src-sym">(</span><span class="src-var">$this</span><span class="src-sym">-></span><a href="class.upload.html#var$log">log</a><span class="src-sym">)) </span><span class="src-sym">{</span></div></li> <li><div class="src-line"><a name="a2276"></a> <span class="src-var">$this</span><span class="src-sym">-></span><a href="class.upload.html#var$log">log</a> .= <span class="src-str">'<b>system information</b><br />'</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a2277"></a> <span class="src-var">$inis </span>= <a href="http://www.php.net/ini_get_all">ini_get_all</a><span class="src-sym">(</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a2278"></a> <span class="src-var">$open_basedir </span>= <span class="src-sym">(</span><a href="http://www.php.net/array_key_exists">array_key_exists</a><span class="src-sym">(</span><span class="src-str">'open_basedir'</span><span class="src-sym">, </span><span class="src-var">$inis</span><span class="src-sym">) </span>&& <a href="http://www.php.net/array_key_exists">array_key_exists</a><span class="src-sym">(</span><span class="src-str">'local_value'</span><span class="src-sym">, </span><span class="src-var">$inis</span><span class="src-sym">[</span><span class="src-str">'open_basedir'</span><span class="src-sym">]</span><span class="src-sym">) </span>&& <span class="src-sym">!</span><span class="src-key">empty</span><span class="src-sym">(</span><span class="src-var">$inis</span><span class="src-sym">[</span><span class="src-str">'open_basedir'</span><span class="src-sym">]</span><span class="src-sym">[</span><span class="src-str">'local_value'</span><span class="src-sym">]</span><span class="src-sym">)) </span>? <span class="src-var">$inis</span><span class="src-sym">[</span><span class="src-str">'open_basedir'</span><span class="src-sym">]</span><span class="src-sym">[</span><span class="src-str">'local_value'</span><span class="src-sym">] </span>: <span class="src-id">false</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a2279"></a> <span class="src-var">$gd </span>= <span class="src-var">$this</span><span class="src-sym">-></span><a href="class.upload.html#methodgdversion">gdversion</a><span class="src-sym">(</span><span class="src-sym">) </span>? <span class="src-var">$this</span><span class="src-sym">-></span><a href="class.upload.html#methodgdversion">gdversion</a><span class="src-sym">(</span><span class="src-id">true</span><span class="src-sym">) </span>: <span class="src-str">'GD not present'</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a2280"></a> <span class="src-var">$supported </span>= <a href="http://www.php.net/trim">trim</a><span class="src-sym">((</span><a href="http://www.php.net/in_array">in_array</a><span class="src-sym">(</span><span class="src-str">'png'</span><span class="src-sym">, </span><span class="src-var">$this</span><span class="src-sym">-></span><span class="src-var">image_supported</span><span class="src-sym">) </span>? <span class="src-str">'png' </span>: <span class="src-str">''</span><span class="src-sym">) </span>. <span class="src-str">' ' </span>. <span class="src-sym">(</span><a href="http://www.php.net/in_array">in_array</a><span class="src-sym">(</span><span class="src-str">'jpg'</span><span class="src-sym">, </span><span class="src-var">$this</span><span class="src-sym">-></span><span class="src-var">image_supported</span><span class="src-sym">) </span>? <span class="src-str">'jpg' </span>: <span class="src-str">''</span><span class="src-sym">) </span>. <span class="src-str">' ' </span>. <span class="src-sym">(</span><a href="http://www.php.net/in_array">in_array</a><span class="src-sym">(</span><span class="src-str">'gif'</span><span class="src-sym">, </span><span class="src-var">$this</span><span class="src-sym">-></span><span class="src-var">image_supported</span><span class="src-sym">) </span>? <span class="src-str">'gif' </span>: <span class="src-str">''</span><span class="src-sym">) </span>. <span class="src-str">' ' </span>. <span class="src-sym">(</span><a href="http://www.php.net/in_array">in_array</a><span class="src-sym">(</span><span class="src-str">'bmp'</span><span class="src-sym">, </span><span class="src-var">$this</span><span class="src-sym">-></span><span class="src-var">image_supported</span><span class="src-sym">) </span>? <span class="src-str">'bmp' </span>: <span class="src-str">''</span><span class="src-sym">))</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a2281"></a> <span class="src-var">$this</span><span class="src-sym">-></span><a href="class.upload.html#var$log">log</a> .= <span class="src-str">'-&nbsp;class version : ' </span>. <span class="src-var">$this</span><span class="src-sym">-></span><a href="class.upload.html#var$version">version</a> . <span class="src-str">'<br />'</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a2282"></a> <span class="src-var">$this</span><span class="src-sym">-></span><a href="class.upload.html#var$log">log</a> .= <span class="src-str">'-&nbsp;operating system : ' </span>. <span class="src-id">PHP_OS </span>. <span class="src-str">'<br />'</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a2283"></a> <span class="src-var">$this</span><span class="src-sym">-></span><a href="class.upload.html#var$log">log</a> .= <span class="src-str">'-&nbsp;PHP version : ' </span>. <span class="src-id">PHP_VERSION </span>. <span class="src-str">'<br />'</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a2284"></a> <span class="src-var">$this</span><span class="src-sym">-></span><a href="class.upload.html#var$log">log</a> .= <span class="src-str">'-&nbsp;GD version : ' </span>. <span class="src-var">$gd </span>. <span class="src-str">'<br />'</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a2285"></a> <span class="src-var">$this</span><span class="src-sym">-></span><a href="class.upload.html#var$log">log</a> .= <span class="src-str">'-&nbsp;supported image types : ' </span>. <span class="src-sym">(</span><span class="src-sym">!</span><span class="src-key">empty</span><span class="src-sym">(</span><span class="src-var">$supported</span><span class="src-sym">) </span>? <span class="src-var">$supported </span>: <span class="src-str">'none'</span><span class="src-sym">) </span>. <span class="src-str">'<br />'</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a2286"></a> <span class="src-var">$this</span><span class="src-sym">-></span><a href="class.upload.html#var$log">log</a> .= <span class="src-str">'-&nbsp;open_basedir : ' </span>. <span class="src-sym">(</span><span class="src-sym">!</span><span class="src-key">empty</span><span class="src-sym">(</span><span class="src-var">$open_basedir</span><span class="src-sym">) </span>? <span class="src-var">$open_basedir </span>: <span class="src-str">'no restriction'</span><span class="src-sym">) </span>. <span class="src-str">'<br />'</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a2287"></a> <span class="src-var">$this</span><span class="src-sym">-></span><a href="class.upload.html#var$log">log</a> .= <span class="src-str">'-&nbsp;language : ' </span>. <span class="src-var">$this</span><span class="src-sym">-></span><span class="src-var">lang </span>. <span class="src-str">'<br />'</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a2288"></a> <span class="src-sym">}</span></div></li> <li><div class="src-line"><a name="a2289"></a> </div></li> <li><div class="src-line"><a name="a2290"></a> <span class="src-key">if </span><span class="src-sym">(</span><span class="src-sym">!</span><span class="src-var">$file</span><span class="src-sym">) </span><span class="src-sym">{</span></div></li> <li><div class="src-line"><a name="a2291"></a> <span class="src-var">$this</span><span class="src-sym">-></span><a href="class.upload.html#var$uploaded">uploaded</a> = <span class="src-id">false</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a2292"></a> <span class="src-var">$this</span><span class="src-sym">-></span><a href="class.upload.html#var$error">error</a> = <span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id">translate</span><span class="src-sym">(</span><span class="src-str">'file_error'</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a2293"></a> <span class="src-sym">}</span></div></li> <li><div class="src-line"><a name="a2294"></a> </div></li> <li><div class="src-line"><a name="a2295"></a> <span class="src-comm">// check if we sent a local filename rather than a $_FILE element</span></div></li> <li><div class="src-line"><a name="a2296"></a> <span class="src-key">if </span><span class="src-sym">(</span><span class="src-sym">!</span><a href="http://www.php.net/is_array">is_array</a><span class="src-sym">(</span><span class="src-var">$file</span><span class="src-sym">)) </span><span class="src-sym">{</span></div></li> <li><div class="src-line"><a name="a2297"></a> <span class="src-key">if </span><span class="src-sym">(</span><span class="src-key">empty</span><span class="src-sym">(</span><span class="src-var">$file</span><span class="src-sym">)) </span><span class="src-sym">{</span></div></li> <li><div class="src-line"><a name="a2298"></a> <span class="src-var">$this</span><span class="src-sym">-></span><a href="class.upload.html#var$uploaded">uploaded</a> = <span class="src-id">false</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a2299"></a> <span class="src-var">$this</span><span class="src-sym">-></span><a href="class.upload.html#var$error">error</a> = <span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id">translate</span><span class="src-sym">(</span><span class="src-str">'file_error'</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a2300"></a> <span class="src-sym">} </span><span class="src-key">else </span><span class="src-sym">{</span></div></li> <li><div class="src-line"><a name="a2301"></a> <span class="src-var">$this</span><span class="src-sym">-></span><a href="class.upload.html#var$no_upload_check">no_upload_check</a> = <span class="src-id">TRUE</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a2302"></a> <span class="src-comm">// this is a local filename, i.e.not uploaded</span></div></li> <li><div class="src-line"><a name="a2303"></a> <span class="src-var">$this</span><span class="src-sym">-></span><a href="class.upload.html#var$log">log</a> .= <span class="src-str">'<b>' </span>. <span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id">translate</span><span class="src-sym">(</span><span class="src-str">"source is a local file"</span><span class="src-sym">) </span>. <span class="src-str">' ' </span>. <span class="src-var">$file </span>. <span class="src-str">'</b><br />'</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a2304"></a> </div></li> <li><div class="src-line"><a name="a2305"></a> <span class="src-key">if </span><span class="src-sym">(</span><span class="src-var">$this</span><span class="src-sym">-></span><a href="class.upload.html#var$uploaded">uploaded</a> && <span class="src-sym">!</span><a href="http://www.php.net/file_exists">file_exists</a><span class="src-sym">(</span><span class="src-var">$file</span><span class="src-sym">)) </span><span class="src-sym">{</span></div></li> <li><div class="src-line"><a name="a2306"></a> <span class="src-var">$this</span><span class="src-sym">-></span><a href="class.upload.html#var$uploaded">uploaded</a> = <span class="src-id">false</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a2307"></a> <span class="src-var">$this</span><span class="src-sym">-></span><a href="class.upload.html#var$error">error</a> = <span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id">translate</span><span class="src-sym">(</span><span class="src-str">'local_file_missing'</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a2308"></a> <span class="src-sym">}</span></div></li> <li><div class="src-line"><a name="a2309"></a> </div></li> <li><div class="src-line"><a name="a2310"></a> <span class="src-key">if </span><span class="src-sym">(</span><span class="src-var">$this</span><span class="src-sym">-></span><a href="class.upload.html#var$uploaded">uploaded</a> && <span class="src-sym">!</span><a href="http://www.php.net/is_readable">is_readable</a><span class="src-sym">(</span><span class="src-var">$file</span><span class="src-sym">)) </span><span class="src-sym">{</span></div></li> <li><div class="src-line"><a name="a2311"></a> <span class="src-var">$this</span><span class="src-sym">-></span><a href="class.upload.html#var$uploaded">uploaded</a> = <span class="src-id">false</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a2312"></a> <span class="src-var">$this</span><span class="src-sym">-></span><a href="class.upload.html#var$error">error</a> = <span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id">translate</span><span class="src-sym">(</span><span class="src-str">'local_file_not_readable'</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a2313"></a> <span class="src-sym">}</span></div></li> <li><div class="src-line"><a name="a2314"></a> </div></li> <li><div class="src-line"><a name="a2315"></a> <span class="src-key">if </span><span class="src-sym">(</span><span class="src-var">$this</span><span class="src-sym">-></span><a href="class.upload.html#var$uploaded">uploaded</a><span class="src-sym">) </span><span class="src-sym">{</span></div></li> <li><div class="src-line"><a name="a2316"></a> <span class="src-var">$this</span><span class="src-sym">-></span><span class="src-var">file_src_pathname </span>= <span class="src-var">$file</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a2317"></a> <span class="src-var">$this</span><span class="src-sym">-></span><a href="class.upload.html#var$file_src_name">file_src_name</a> = <a href="http://www.php.net/basename">basename</a><span class="src-sym">(</span><span class="src-var">$file</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a2318"></a> <span class="src-var">$this</span><span class="src-sym">-></span><a href="class.upload.html#var$log">log</a> .= <span class="src-str">'- local file name OK<br />'</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a2319"></a> <a href="http://www.php.net/preg_match">preg_match</a><span class="src-sym">(</span><span class="src-str">'/\.([^\.]*$)/'</span><span class="src-sym">, </span><span class="src-var">$this</span><span class="src-sym">-></span><a href="class.upload.html#var$file_src_name">file_src_name</a><span class="src-sym">, </span><span class="src-var">$extension</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a2320"></a> <span class="src-key">if </span><span class="src-sym">(</span><a href="http://www.php.net/is_array">is_array</a><span class="src-sym">(</span><span class="src-var">$extension</span><span class="src-sym">) </span>&& <a href="http://www.php.net/sizeof">sizeof</a><span class="src-sym">(</span><span class="src-var">$extension</span><span class="src-sym">) </span>> <span class="src-num">0</span><span class="src-sym">) </span><span class="src-sym">{</span></div></li> <li><div class="src-line"><a name="a2321"></a> <span class="src-var">$this</span><span class="src-sym">-></span><a href="class.upload.html#var$file_src_name_ext">file_src_name_ext</a> = <a href="http://www.php.net/strtolower">strtolower</a><span class="src-sym">(</span><span class="src-var">$extension</span><span class="src-sym">[</span><span class="src-num">1</span><span class="src-sym">]</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a2322"></a> <span class="src-var">$this</span><span class="src-sym">-></span><a href="class.upload.html#var$file_src_name_body">file_src_name_body</a> = <a href="http://www.php.net/substr">substr</a><span class="src-sym">(</span><span class="src-var">$this</span><span class="src-sym">-></span><a href="class.upload.html#var$file_src_name">file_src_name</a><span class="src-sym">, </span><span class="src-num">0</span><span class="src-sym">, </span><span class="src-sym">((</span><a href="http://www.php.net/strlen">strlen</a><span class="src-sym">(</span><span class="src-var">$this</span><span class="src-sym">-></span><a href="class.upload.html#var$file_src_name">file_src_name</a><span class="src-sym">) </span>- <a href="http://www.php.net/strlen">strlen</a><span class="src-sym">(</span><span class="src-var">$this</span><span class="src-sym">-></span><a href="class.upload.html#var$file_src_name_ext">file_src_name_ext</a><span class="src-sym">)))</span>-<span class="src-num">1</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a2323"></a> <span class="src-sym">} </span><span class="src-key">else </span><span class="src-sym">{</span></div></li> <li><div class="src-line"><a name="a2324"></a> <span class="src-var">$this</span><span class="src-sym">-></span><a href="class.upload.html#var$file_src_name_ext">file_src_name_ext</a> = <span class="src-str">''</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a2325"></a> <span class="src-var">$this</span><span class="src-sym">-></span><a href="class.upload.html#var$file_src_name_body">file_src_name_body</a> = <span class="src-var">$this</span><span class="src-sym">-></span><a href="class.upload.html#var$file_src_name">file_src_name</a><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a2326"></a> <span class="src-sym">}</span></div></li> <li><div class="src-line"><a name="a2327"></a> <span class="src-var">$this</span><span class="src-sym">-></span><a href="class.upload.html#var$file_src_size">file_src_size</a> = <span class="src-sym">(</span><a href="http://www.php.net/file_exists">file_exists</a><span class="src-sym">(</span><span class="src-var">$file</span><span class="src-sym">) </span>? <a href="http://www.php.net/filesize">filesize</a><span class="src-sym">(</span><span class="src-var">$file</span><span class="src-sym">) </span>: <span class="src-num">0</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a2328"></a> <span class="src-sym">}</span></div></li> <li><div class="src-line"><a name="a2329"></a> <span class="src-var">$this</span><span class="src-sym">-></span><a href="class.upload.html#var$file_src_error">file_src_error</a> = <span class="src-num">0</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a2330"></a> <span class="src-sym">}</span></div></li> <li><div class="src-line"><a name="a2331"></a> <span class="src-sym">} </span><span class="src-key">else </span><span class="src-sym">{</span></div></li> <li><div class="src-line"><a name="a2332"></a> <span class="src-comm">// this is an element from $_FILE, i.e. an uploaded file</span></div></li> <li><div class="src-line"><a name="a2333"></a> <span class="src-var">$this</span><span class="src-sym">-></span><a href="class.upload.html#var$log">log</a> .= <span class="src-str">'<b>source is an uploaded file</b><br />'</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a2334"></a> <span class="src-key">if </span><span class="src-sym">(</span><span class="src-var">$this</span><span class="src-sym">-></span><a href="class.upload.html#var$uploaded">uploaded</a><span class="src-sym">) </span><span class="src-sym">{</span></div></li> <li><div class="src-line"><a name="a2335"></a> <span class="src-var">$this</span><span class="src-sym">-></span><a href="class.upload.html#var$file_src_error">file_src_error</a> = <a href="http://www.php.net/trim">trim</a><span class="src-sym">(</span><span class="src-var">$file</span><span class="src-sym">[</span><span class="src-str">'error'</span><span class="src-sym">]</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a2336"></a> <span class="src-key">switch</span><span class="src-sym">(</span><span class="src-var">$this</span><span class="src-sym">-></span><a href="class.upload.html#var$file_src_error">file_src_error</a><span class="src-sym">) </span><span class="src-sym">{</span></div></li> <li><div class="src-line"><a name="a2337"></a> <span class="src-key">case </span><span class="src-id">UPLOAD_ERR_OK</span>:</div></li> <li><div class="src-line"><a name="a2338"></a> <span class="src-comm">// all is OK</span></div></li> <li><div class="src-line"><a name="a2339"></a> <span class="src-var">$this</span><span class="src-sym">-></span><a href="class.upload.html#var$log">log</a> .= <span class="src-str">'- upload OK<br />'</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a2340"></a> <span class="src-key">break</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a2341"></a> <span class="src-key">case </span><span class="src-id">UPLOAD_ERR_INI_SIZE</span>:</div></li> <li><div class="src-line"><a name="a2342"></a> <span class="src-var">$this</span><span class="src-sym">-></span><a href="class.upload.html#var$uploaded">uploaded</a> = <span class="src-id">false</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a2343"></a> <span class="src-var">$this</span><span class="src-sym">-></span><a href="class.upload.html#var$error">error</a> = <span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id">translate</span><span class="src-sym">(</span><span class="src-str">'uploaded_too_big_ini'</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a2344"></a> <span class="src-key">break</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a2345"></a> <span class="src-key">case </span><span class="src-id">UPLOAD_ERR_FORM_SIZE</span>:</div></li> <li><div class="src-line"><a name="a2346"></a> <span class="src-var">$this</span><span class="src-sym">-></span><a href="class.upload.html#var$uploaded">uploaded</a> = <span class="src-id">false</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a2347"></a> <span class="src-var">$this</span><span class="src-sym">-></span><a href="class.upload.html#var$error">error</a> = <span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id">translate</span><span class="src-sym">(</span><span class="src-str">'uploaded_too_big_html'</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a2348"></a> <span class="src-key">break</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a2349"></a> <span class="src-key">case </span><span class="src-id">UPLOAD_ERR_PARTIAL</span>:</div></li> <li><div class="src-line"><a name="a2350"></a> <span class="src-var">$this</span><span class="src-sym">-></span><a href="class.upload.html#var$uploaded">uploaded</a> = <span class="src-id">false</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a2351"></a> <span class="src-var">$this</span><span class="src-sym">-></span><a href="class.upload.html#var$error">error</a> = <span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id">translate</span><span class="src-sym">(</span><span class="src-str">'uploaded_partial'</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a2352"></a> <span class="src-key">break</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a2353"></a> <span class="src-key">case </span><span class="src-id">UPLOAD_ERR_NO_FILE</span>:</div></li> <li><div class="src-line"><a name="a2354"></a> <span class="src-var">$this</span><span class="src-sym">-></span><a href="class.upload.html#var$uploaded">uploaded</a> = <span class="src-id">false</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a2355"></a> <span class="src-var">$this</span><span class="src-sym">-></span><a href="class.upload.html#var$error">error</a> = <span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id">translate</span><span class="src-sym">(</span><span class="src-str">'uploaded_missing'</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a2356"></a> <span class="src-key">break</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a2357"></a> <span class="src-key">case </span><span class="src-sym">@</span><span class="src-id">UPLOAD_ERR_NO_TMP_DIR</span>:</div></li> <li><div class="src-line"><a name="a2358"></a> <span class="src-var">$this</span><span class="src-sym">-></span><a href="class.upload.html#var$uploaded">uploaded</a> = <span class="src-id">false</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a2359"></a> <span class="src-var">$this</span><span class="src-sym">-></span><a href="class.upload.html#var$error">error</a> = <span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id">translate</span><span class="src-sym">(</span><span class="src-str">'uploaded_no_tmp_dir'</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a2360"></a> <span class="src-key">break</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a2361"></a> <span class="src-key">case </span><span class="src-sym">@</span><span class="src-id">UPLOAD_ERR_CANT_WRITE</span>:</div></li> <li><div class="src-line"><a name="a2362"></a> <span class="src-var">$this</span><span class="src-sym">-></span><a href="class.upload.html#var$uploaded">uploaded</a> = <span class="src-id">false</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a2363"></a> <span class="src-var">$this</span><span class="src-sym">-></span><a href="class.upload.html#var$error">error</a> = <span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id">translate</span><span class="src-sym">(</span><span class="src-str">'uploaded_cant_write'</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a2364"></a> <span class="src-key">break</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a2365"></a> <span class="src-key">case </span><span class="src-sym">@</span><span class="src-id">UPLOAD_ERR_EXTENSION</span>:</div></li> <li><div class="src-line"><a name="a2366"></a> <span class="src-var">$this</span><span class="src-sym">-></span><a href="class.upload.html#var$uploaded">uploaded</a> = <span class="src-id">false</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a2367"></a> <span class="src-var">$this</span><span class="src-sym">-></span><a href="class.upload.html#var$error">error</a> = <span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id">translate</span><span class="src-sym">(</span><span class="src-str">'uploaded_err_extension'</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a2368"></a> <span class="src-key">break</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a2369"></a> <span class="src-key">default</span>:</div></li> <li><div class="src-line"><a name="a2370"></a> <span class="src-var">$this</span><span class="src-sym">-></span><a href="class.upload.html#var$uploaded">uploaded</a> = <span class="src-id">false</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a2371"></a> <span class="src-var">$this</span><span class="src-sym">-></span><a href="class.upload.html#var$error">error</a> = <span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id">translate</span><span class="src-sym">(</span><span class="src-str">'uploaded_unknown'</span><span class="src-sym">) </span>. <span class="src-str">' ('</span>.<span class="src-var">$this</span><span class="src-sym">-></span><a href="class.upload.html#var$file_src_error">file_src_error</a>.<span class="src-str">')'</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a2372"></a> <span class="src-sym">}</span></div></li> <li><div class="src-line"><a name="a2373"></a> <span class="src-sym">}</span></div></li> <li><div class="src-line"><a name="a2374"></a> </div></li> <li><div class="src-line"><a name="a2375"></a> <span class="src-key">if </span><span class="src-sym">(</span><span class="src-var">$this</span><span class="src-sym">-></span><a href="class.upload.html#var$uploaded">uploaded</a><span class="src-sym">) </span><span class="src-sym">{</span></div></li> <li><div class="src-line"><a name="a2376"></a> <span class="src-var">$this</span><span class="src-sym">-></span><span class="src-var">file_src_pathname </span>= <span class="src-var">$file</span><span class="src-sym">[</span><span class="src-str">'tmp_name'</span><span class="src-sym">]</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a2377"></a> <span class="src-var">$this</span><span class="src-sym">-></span><a href="class.upload.html#var$file_src_name">file_src_name</a> = <span class="src-var">$file</span><span class="src-sym">[</span><span class="src-str">'name'</span><span class="src-sym">]</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a2378"></a> <span class="src-key">if </span><span class="src-sym">(</span><span class="src-var">$this</span><span class="src-sym">-></span><a href="class.upload.html#var$file_src_name">file_src_name</a> == <span class="src-str">''</span><span class="src-sym">) </span><span class="src-sym">{</span></div></li> <li><div class="src-line"><a name="a2379"></a> <span class="src-var">$this</span><span class="src-sym">-></span><a href="class.upload.html#var$uploaded">uploaded</a> = <span class="src-id">false</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a2380"></a> <span class="src-var">$this</span><span class="src-sym">-></span><a href="class.upload.html#var$error">error</a> = <span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id">translate</span><span class="src-sym">(</span><span class="src-str">'try_again'</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a2381"></a> <span class="src-sym">}</span></div></li> <li><div class="src-line"><a name="a2382"></a> <span class="src-sym">}</span></div></li> <li><div class="src-line"><a name="a2383"></a> </div></li> <li><div class="src-line"><a name="a2384"></a> <span class="src-key">if </span><span class="src-sym">(</span><span class="src-var">$this</span><span class="src-sym">-></span><a href="class.upload.html#var$uploaded">uploaded</a><span class="src-sym">) </span><span class="src-sym">{</span></div></li> <li><div class="src-line"><a name="a2385"></a> <span class="src-var">$this</span><span class="src-sym">-></span><a href="class.upload.html#var$log">log</a> .= <span class="src-str">'- file name OK<br />'</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a2386"></a> <a href="http://www.php.net/preg_match">preg_match</a><span class="src-sym">(</span><span class="src-str">'/\.([^\.]*$)/'</span><span class="src-sym">, </span><span class="src-var">$this</span><span class="src-sym">-></span><a href="class.upload.html#var$file_src_name">file_src_name</a><span class="src-sym">, </span><span class="src-var">$extension</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a2387"></a> <span class="src-key">if </span><span class="src-sym">(</span><a href="http://www.php.net/is_array">is_array</a><span class="src-sym">(</span><span class="src-var">$extension</span><span class="src-sym">) </span>&& <a href="http://www.php.net/sizeof">sizeof</a><span class="src-sym">(</span><span class="src-var">$extension</span><span class="src-sym">) </span>> <span class="src-num">0</span><span class="src-sym">) </span><span class="src-sym">{</span></div></li> <li><div class="src-line"><a name="a2388"></a> <span class="src-var">$this</span><span class="src-sym">-></span><a href="class.upload.html#var$file_src_name_ext">file_src_name_ext</a> = <a href="http://www.php.net/strtolower">strtolower</a><span class="src-sym">(</span><span class="src-var">$extension</span><span class="src-sym">[</span><span class="src-num">1</span><span class="src-sym">]</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a2389"></a> <span class="src-var">$this</span><span class="src-sym">-></span><a href="class.upload.html#var$file_src_name_body">file_src_name_body</a> = <a href="http://www.php.net/substr">substr</a><span class="src-sym">(</span><span class="src-var">$this</span><span class="src-sym">-></span><a href="class.upload.html#var$file_src_name">file_src_name</a><span class="src-sym">, </span><span class="src-num">0</span><span class="src-sym">, </span><span class="src-sym">((</span><a href="http://www.php.net/strlen">strlen</a><span class="src-sym">(</span><span class="src-var">$this</span><span class="src-sym">-></span><a href="class.upload.html#var$file_src_name">file_src_name</a><span class="src-sym">) </span>- <a href="http://www.php.net/strlen">strlen</a><span class="src-sym">(</span><span class="src-var">$this</span><span class="src-sym">-></span><a href="class.upload.html#var$file_src_name_ext">file_src_name_ext</a><span class="src-sym">)))</span>-<span class="src-num">1</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a2390"></a> <span class="src-sym">} </span><span class="src-key">else </span><span class="src-sym">{</span></div></li> <li><div class="src-line"><a name="a2391"></a> <span class="src-var">$this</span><span class="src-sym">-></span><a href="class.upload.html#var$file_src_name_ext">file_src_name_ext</a> = <span class="src-str">''</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a2392"></a> <span class="src-var">$this</span><span class="src-sym">-></span><a href="class.upload.html#var$file_src_name_body">file_src_name_body</a> = <span class="src-var">$this</span><span class="src-sym">-></span><a href="class.upload.html#var$file_src_name">file_src_name</a><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a2393"></a> <span class="src-sym">}</span></div></li> <li><div class="src-line"><a name="a2394"></a> <span class="src-var">$this</span><span class="src-sym">-></span><a href="class.upload.html#var$file_src_size">file_src_size</a> = <span class="src-var">$file</span><span class="src-sym">[</span><span class="src-str">'size'</span><span class="src-sym">]</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a2395"></a> <span class="src-var">$mime_from_browser </span>= <span class="src-var">$file</span><span class="src-sym">[</span><span class="src-str">'type'</span><span class="src-sym">]</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a2396"></a> <span class="src-sym">}</span></div></li> <li><div class="src-line"><a name="a2397"></a> <span class="src-sym">}</span></div></li> <li><div class="src-line"><a name="a2398"></a> </div></li> <li><div class="src-line"><a name="a2399"></a> <span class="src-key">if </span><span class="src-sym">(</span><span class="src-var">$this</span><span class="src-sym">-></span><a href="class.upload.html#var$uploaded">uploaded</a><span class="src-sym">) </span><span class="src-sym">{</span></div></li> <li><div class="src-line"><a name="a2400"></a> <span class="src-var">$this</span><span class="src-sym">-></span><a href="class.upload.html#var$log">log</a> .= <span class="src-str">'<b>determining MIME type</b><br />'</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a2401"></a> <span class="src-var">$this</span><span class="src-sym">-></span><a href="class.upload.html#var$file_src_mime">file_src_mime</a> = <span class="src-id">null</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a2402"></a> </div></li> <li><div class="src-line"><a name="a2403"></a> <span class="src-comm">// checks MIME type with Fileinfo PECL extension</span></div></li> <li><div class="src-line"><a name="a2404"></a> <span class="src-key">if </span><span class="src-sym">(</span><span class="src-sym">!</span><span class="src-var">$this</span><span class="src-sym">-></span><a href="class.upload.html#var$file_src_mime">file_src_mime</a> || <span class="src-sym">!</span><a href="http://www.php.net/is_string">is_string</a><span class="src-sym">(</span><span class="src-var">$this</span><span class="src-sym">-></span><a href="class.upload.html#var$file_src_mime">file_src_mime</a><span class="src-sym">) </span>|| <span class="src-key">empty</span><span class="src-sym">(</span><span class="src-var">$this</span><span class="src-sym">-></span><a href="class.upload.html#var$file_src_mime">file_src_mime</a><span class="src-sym">) </span>|| <a href="http://www.php.net/strpos">strpos</a><span class="src-sym">(</span><span class="src-var">$this</span><span class="src-sym">-></span><a href="class.upload.html#var$file_src_mime">file_src_mime</a><span class="src-sym">, </span><span class="src-str">'/'</span><span class="src-sym">) </span>=== <span class="src-id">FALSE</span><span class="src-sym">) </span><span class="src-sym">{</span></div></li> <li><div class="src-line"><a name="a2405"></a> <span class="src-key">if </span><span class="src-sym">(</span><span class="src-var">$this</span><span class="src-sym">-></span><a href="class.upload.html#var$mime_fileinfo">mime_fileinfo</a><span class="src-sym">) </span><span class="src-sym">{</span></div></li> <li><div class="src-line"><a name="a2406"></a> <span class="src-var">$this</span><span class="src-sym">-></span><a href="class.upload.html#var$log">log</a> .= <span class="src-str">'- Checking MIME type with Fileinfo PECL extension<br />'</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a2407"></a> <span class="src-key">if </span><span class="src-sym">(</span><a href="http://www.php.net/function_exists">function_exists</a><span class="src-sym">(</span><span class="src-str">'finfo_open'</span><span class="src-sym">)) </span><span class="src-sym">{</span></div></li> <li><div class="src-line"><a name="a2408"></a> <span class="src-key">if </span><span class="src-sym">(</span><span class="src-var">$this</span><span class="src-sym">-></span><a href="class.upload.html#var$mime_fileinfo">mime_fileinfo</a> !== <span class="src-str">''</span><span class="src-sym">) </span><span class="src-sym">{</span></div></li> <li><div class="src-line"><a name="a2409"></a> <span class="src-key">if </span><span class="src-sym">(</span><span class="src-var">$this</span><span class="src-sym">-></span><a href="class.upload.html#var$mime_fileinfo">mime_fileinfo</a> === <span class="src-id">true</span><span class="src-sym">) </span><span class="src-sym">{</span></div></li> <li><div class="src-line"><a name="a2410"></a> <span class="src-key">if </span><span class="src-sym">(</span><a href="http://www.php.net/getenv">getenv</a><span class="src-sym">(</span><span class="src-str">'MAGIC'</span><span class="src-sym">) </span>=== <span class="src-id">FALSE</span><span class="src-sym">) </span><span class="src-sym">{</span></div></li> <li><div class="src-line"><a name="a2411"></a> <span class="src-key">if </span><span class="src-sym">(</span><a href="http://www.php.net/substr">substr</a><span class="src-sym">(</span><span class="src-id">PHP_OS</span><span class="src-sym">, </span><span class="src-num">0</span><span class="src-sym">, </span><span class="src-num">3</span><span class="src-sym">) </span>== <span class="src-str">'WIN'</span><span class="src-sym">) </span><span class="src-sym">{</span></div></li> <li><div class="src-line"><a name="a2412"></a> <span class="src-var">$path </span>= <a href="http://www.php.net/realpath">realpath</a><span class="src-sym">(</span><a href="http://www.php.net/ini_get">ini_get</a><span class="src-sym">(</span><span class="src-str">'extension_dir'</span><span class="src-sym">) </span>. <span class="src-str">'/../'</span><span class="src-sym">) </span>. <span class="src-str">'extras/magic'</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a2413"></a> <span class="src-sym">} </span><span class="src-key">else </span><span class="src-sym">{</span></div></li> <li><div class="src-line"><a name="a2414"></a> <span class="src-var">$path </span>= <span class="src-str">'/usr/share/file/magic'</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a2415"></a> <span class="src-sym">}</span></div></li> <li><div class="src-line"><a name="a2416"></a> <span class="src-var">$this</span><span class="src-sym">-></span><a href="class.upload.html#var$log">log</a> .= <span class="src-str">'&nbsp;&nbsp;&nbsp;&nbsp;MAGIC path defaults to ' </span>. <span class="src-var">$path </span>. <span class="src-str">'<br />'</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a2417"></a> <span class="src-sym">} </span><span class="src-key">else </span><span class="src-sym">{</span></div></li> <li><div class="src-line"><a name="a2418"></a> <span class="src-var">$path </span>= <a href="http://www.php.net/getenv">getenv</a><span class="src-sym">(</span><span class="src-str">'MAGIC'</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a2419"></a> <span class="src-var">$this</span><span class="src-sym">-></span><a href="class.upload.html#var$log">log</a> .= <span class="src-str">'&nbsp;&nbsp;&nbsp;&nbsp;MAGIC path is set to ' </span>. <span class="src-var">$path </span>. <span class="src-str">' from MAGIC variable<br />'</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a2420"></a> <span class="src-sym">}</span></div></li> <li><div class="src-line"><a name="a2421"></a> <span class="src-sym">} </span><span class="src-key">else </span><span class="src-sym">{</span></div></li> <li><div class="src-line"><a name="a2422"></a> <span class="src-var">$path </span>= <span class="src-var">$this</span><span class="src-sym">-></span><a href="class.upload.html#var$mime_fileinfo">mime_fileinfo</a><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a2423"></a> <span class="src-var">$this</span><span class="src-sym">-></span><a href="class.upload.html#var$log">log</a> .= <span class="src-str">'&nbsp;&nbsp;&nbsp;&nbsp;MAGIC path is set to ' </span>. <span class="src-var">$path </span>. <span class="src-str">'<br />'</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a2424"></a> <span class="src-sym">}</span></div></li> <li><div class="src-line"><a name="a2425"></a> <span class="src-var">$f </span>= <span class="src-sym">@</span><a href="http://www.php.net/finfo_open">finfo_open</a><span class="src-sym">(</span><span class="src-id">FILEINFO_MIME</span><span class="src-sym">, </span><span class="src-var">$path</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a2426"></a> <span class="src-sym">} </span><span class="src-key">else </span><span class="src-sym">{</span></div></li> <li><div class="src-line"><a name="a2427"></a> <span class="src-var">$this</span><span class="src-sym">-></span><a href="class.upload.html#var$log">log</a> .= <span class="src-str">'&nbsp;&nbsp;&nbsp;&nbsp;MAGIC path will not be used<br />'</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a2428"></a> <span class="src-var">$f </span>= <span class="src-sym">@</span><a href="http://www.php.net/finfo_open">finfo_open</a><span class="src-sym">(</span><span class="src-id">FILEINFO_MIME</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a2429"></a> <span class="src-sym">}</span></div></li> <li><div class="src-line"><a name="a2430"></a> <span class="src-key">if </span><span class="src-sym">(</span><a href="http://www.php.net/is_resource">is_resource</a><span class="src-sym">(</span><span class="src-var">$f</span><span class="src-sym">)) </span><span class="src-sym">{</span></div></li> <li><div class="src-line"><a name="a2431"></a> <span class="src-var">$mime </span>= <a href="http://www.php.net/finfo_file">finfo_file</a><span class="src-sym">(</span><span class="src-var">$f</span><span class="src-sym">, </span><a href="http://www.php.net/realpath">realpath</a><span class="src-sym">(</span><span class="src-var">$this</span><span class="src-sym">-></span><span class="src-var">file_src_pathname</span><span class="src-sym">))</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a2432"></a> <a href="http://www.php.net/finfo_close">finfo_close</a><span class="src-sym">(</span><span class="src-var">$f</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a2433"></a> <span class="src-var">$this</span><span class="src-sym">-></span><a href="class.upload.html#var$file_src_mime">file_src_mime</a> = <span class="src-var">$mime</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a2434"></a> <span class="src-var">$this</span><span class="src-sym">-></span><a href="class.upload.html#var$log">log</a> .= <span class="src-str">'&nbsp;&nbsp;&nbsp;&nbsp;MIME type detected as ' </span>. <span class="src-var">$this</span><span class="src-sym">-></span><a href="class.upload.html#var$file_src_mime">file_src_mime</a> . <span class="src-str">' by Fileinfo PECL extension<br />'</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a2435"></a> <span class="src-key">if </span><span class="src-sym">(</span><a href="http://www.php.net/preg_match">preg_match</a><span class="src-sym">(</span><span class="src-str">"/^([\.-\w]+)\/([\.-\w]+)(.*)$/i"</span><span class="src-sym">, </span><span class="src-var">$this</span><span class="src-sym">-></span><a href="class.upload.html#var$file_src_mime">file_src_mime</a><span class="src-sym">)) </span><span class="src-sym">{</span></div></li> <li><div class="src-line"><a name="a2436"></a> <span class="src-var">$this</span><span class="src-sym">-></span><a href="class.upload.html#var$file_src_mime">file_src_mime</a> = <a href="http://www.php.net/preg_replace">preg_replace</a><span class="src-sym">(</span><span class="src-str">"/^([\.-\w]+)\/([\.-\w]+)(.*)$/i"</span><span class="src-sym">, </span><span class="src-str">'$1/$2'</span><span class="src-sym">, </span><span class="src-var">$this</span><span class="src-sym">-></span><a href="class.upload.html#var$file_src_mime">file_src_mime</a><span class="src-sym">)</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a2437"></a> <span class="src-var">$this</span><span class="src-sym">-></span><a href="class.upload.html#var$log">log</a> .= <span class="src-str">'-&nbsp;MIME validated as ' </span>. <span class="src-var">$this</span><span class="src-sym">-></span><a href="class.upload.html#var$file_src_mime">file_src_mime</a> . <span class="src-str">'<br />'</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a2438"></a> <span class="src-sym">} </span><span class="src-key">else </span><span class="src-sym">{</span></div></li> <li><div class="src-line"><a name="a2439"></a> <span class="src-var">$this</span><span class="src-sym">-></span><a href="class.upload.html#var$file_src_mime">file_src_mime</a> = <span class="src-id">null</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a2440"></a> <span class="src-sym">}</span></div></li> <li><div class="src-line"><a name="a2441"></a> <span class="src-sym">} </span><span class="src-key">else </span><span class="src-sym">{</span></div></li> <li><div class="src-line"><a name="a2442"></a> <span class="src-var">$this</span><span class="src-sym">-></span><a href="class.upload.html#var$log">log</a> .= <span class="src-str">'&nbsp;&nbsp;&nbsp;&nbsp;Fileinfo PECL extension failed (finfo_open)<br />'</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a2443"></a> <span class="src-sym">}</span></div></li> <li><div class="src-line"><a name="a2444"></a> <span class="src-sym">} </span><span class="src-key">elseif </span><span class="src-sym">(</span><a href="http://www.php.net/class_exists">class_exists</a><span class="src-sym">(</span><span class="src-str">'finfo'</span><span class="src-sym">)) </span><span class="src-sym">{</span></div></li> <li><div class="src-line"><a name="a2445"></a> <span class="src-var">$f </span>= <span class="src-key">new </span><span class="src-id">finfo</span><span class="src-sym">( </span><span class="src-id">FILEINFO_MIME </span><span class="src-sym">)</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a2446"></a> <span class="src-key">if </span><span class="src-sym">(</span><span class="src-var">$f</span><span class="src-sym">) </span><span class="src-sym">{</span></div></li> <li><div class="src-line"><a name="a2447"></a> <span class="src-var">$this</span><span class="src-sym">-></span><a href="class.upload.html#var$file_src_mime">file_src_mime</a> = <span class="src-var">$f</span><span class="src-sym">-></span><span class="src-id">file</span><span class="src-sym">(</span><a href="http://www.php.net/realpath">realpath</a><span class="src-sym">(</span><span class="src-var">$this</span><span class="src-sym">-></span><span class="src-var">file_src_pathname</span><span class="src-sym">))</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a2448"></a> <span class="src-var">$this</span><span class="src-sym">-></span><a href="class.upload.html#var$log">log</a> .= <span class="src-str">'- MIME type detected as ' </span>. <span class="src-var">$this</span><span class="src-sym">-></span><a href="class.upload.html#var$file_src_mime">file_src_mime</a> . <span class="src-str">' by Fileinfo PECL extension<br />'</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a2449"></a> <span class="src-key">if </span><span class="src-sym">(</span><a href="http://www.php.net/preg_match">preg_match</a><span class="src-sym">(</span><span class="src-str">"/^([\.-\w]+)\/([\.-\w]+)(.*)$/i"</span><span class="src-sym">, </span><span class="src-var">$this</span><span class="src-sym">-></span><a href="class.upload.html#var$file_src_mime">file_src_mime</a><span class="src-sym">)) </span><span class="src-sym">{</span></div></li> <li><div class="src-line"><a name="a2450"></a> <span class="src-var">$this</span><span class="src-sym">-></span><a href="class.upload.html#var$file_src_mime">file_src_mime</a> = <a href="http://www.php.net/preg_replace">preg_replace</a><span class="src-sym">(</span><span class="src-str">"/^([\.-\w]+)\/([\.-\w]+)(.*)$/i"</span><span class="src-sym">, </span><span class="src-str">'$1/$2'</span><span class="src-sym">, </span><span class="src-var">$this</span><span class="src-sym">-></span><a href="class.upload.html#var$file_src_mime">file_src_mime</a><span class="src-sym">)</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a2451"></a> <span class="src-var">$this</span><span class="src-sym">-></span><a href="class.upload.html#var$log">log</a> .= <span class="src-str">'-&nbsp;MIME validated as ' </span>. <span class="src-var">$this</span><span class="src-sym">-></span><a href="class.upload.html#var$file_src_mime">file_src_mime</a> . <span class="src-str">'<br />'</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a2452"></a> <span class="src-sym">} </span><span class="src-key">else </span><span class="src-sym">{</span></div></li> <li><div class="src-line"><a name="a2453"></a> <span class="src-var">$this</span><span class="src-sym">-></span><a href="class.upload.html#var$file_src_mime">file_src_mime</a> = <span class="src-id">null</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a2454"></a> <span class="src-sym">}</span></div></li> <li><div class="src-line"><a name="a2455"></a> <span class="src-sym">} </span><span class="src-key">else </span><span class="src-sym">{</span></div></li> <li><div class="src-line"><a name="a2456"></a> <span class="src-var">$this</span><span class="src-sym">-></span><a href="class.upload.html#var$log">log</a> .= <span class="src-str">'&nbsp;&nbsp;&nbsp;&nbsp;Fileinfo PECL extension failed (finfo)<br />'</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a2457"></a> <span class="src-sym">}</span></div></li> <li><div class="src-line"><a name="a2458"></a> <span class="src-sym">} </span><span class="src-key">else </span><span class="src-sym">{</span></div></li> <li><div class="src-line"><a name="a2459"></a> <span class="src-var">$this</span><span class="src-sym">-></span><a href="class.upload.html#var$log">log</a> .= <span class="src-str">'&nbsp;&nbsp;&nbsp;&nbsp;Fileinfo PECL extension not available<br />'</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a2460"></a> <span class="src-sym">}</span></div></li> <li><div class="src-line"><a name="a2461"></a> <span class="src-sym">} </span><span class="src-key">else </span><span class="src-sym">{</span></div></li> <li><div class="src-line"><a name="a2462"></a> <span class="src-var">$this</span><span class="src-sym">-></span><a href="class.upload.html#var$log">log</a> .= <span class="src-str">'- Fileinfo PECL extension deactivated<br />'</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a2463"></a> <span class="src-sym">}</span></div></li> <li><div class="src-line"><a name="a2464"></a> <span class="src-sym">}</span></div></li> <li><div class="src-line"><a name="a2465"></a> </div></li> <li><div class="src-line"><a name="a2466"></a> <span class="src-comm">// checks MIME type with shell if unix access is authorized</span></div></li> <li><div class="src-line"><a name="a2467"></a> <span class="src-key">if </span><span class="src-sym">(</span><span class="src-sym">!</span><span class="src-var">$this</span><span class="src-sym">-></span><a href="class.upload.html#var$file_src_mime">file_src_mime</a> || <span class="src-sym">!</span><a href="http://www.php.net/is_string">is_string</a><span class="src-sym">(</span><span class="src-var">$this</span><span class="src-sym">-></span><a href="class.upload.html#var$file_src_mime">file_src_mime</a><span class="src-sym">) </span>|| <span class="src-key">empty</span><span class="src-sym">(</span><span class="src-var">$this</span><span class="src-sym">-></span><a href="class.upload.html#var$file_src_mime">file_src_mime</a><span class="src-sym">) </span>|| <a href="http://www.php.net/strpos">strpos</a><span class="src-sym">(</span><span class="src-var">$this</span><span class="src-sym">-></span><a href="class.upload.html#var$file_src_mime">file_src_mime</a><span class="src-sym">, </span><span class="src-str">'/'</span><span class="src-sym">) </span>=== <span class="src-id">FALSE</span><span class="src-sym">) </span><span class="src-sym">{</span></div></li> <li><div class="src-line"><a name="a2468"></a> <span class="src-key">if </span><span class="src-sym">(</span><span class="src-var">$this</span><span class="src-sym">-></span><a href="class.upload.html#var$mime_file">mime_file</a><span class="src-sym">) </span><span class="src-sym">{</span></div></li> <li><div class="src-line"><a name="a2469"></a> <span class="src-var">$this</span><span class="src-sym">-></span><a href="class.upload.html#var$log">log</a> .= <span class="src-str">'- Checking MIME type with UNIX file() command<br />'</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a2470"></a> <span class="src-key">if </span><span class="src-sym">(</span><a href="http://www.php.net/substr">substr</a><span class="src-sym">(</span><span class="src-id">PHP_OS</span><span class="src-sym">, </span><span class="src-num">0</span><span class="src-sym">, </span><span class="src-num">3</span><span class="src-sym">) </span>!= <span class="src-str">'WIN'</span><span class="src-sym">) </span><span class="src-sym">{</span></div></li> <li><div class="src-line"><a name="a2471"></a> <span class="src-key">if </span><span class="src-sym">(</span><a href="http://www.php.net/strlen">strlen</a><span class="src-sym">(</span><span class="src-var">$mime </span>= <span class="src-sym">@</span><a href="http://www.php.net/exec">exec</a><span class="src-sym">(</span><span class="src-str">"file -bi "</span>.<a href="http://www.php.net/escapeshellarg">escapeshellarg</a><span class="src-sym">(</span><span class="src-var">$this</span><span class="src-sym">-></span><span class="src-var">file_src_pathname</span><span class="src-sym">))) </span>!= <span class="src-num">0</span><span class="src-sym">) </span><span class="src-sym">{</span></div></li> <li><div class="src-line"><a name="a2472"></a> <span class="src-var">$this</span><span class="src-sym">-></span><a href="class.upload.html#var$file_src_mime">file_src_mime</a> = <a href="http://www.php.net/trim">trim</a><span class="src-sym">(</span><span class="src-var">$mime</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a2473"></a> <span class="src-var">$this</span><span class="src-sym">-></span><a href="class.upload.html#var$log">log</a> .= <span class="src-str">'&nbsp;&nbsp;&nbsp;&nbsp;MIME type detected as ' </span>. <span class="src-var">$this</span><span class="src-sym">-></span><a href="class.upload.html#var$file_src_mime">file_src_mime</a> . <span class="src-str">' by UNIX file() command<br />'</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a2474"></a> <span class="src-key">if </span><span class="src-sym">(</span><a href="http://www.php.net/preg_match">preg_match</a><span class="src-sym">(</span><span class="src-str">"/^([\.-\w]+)\/([\.-\w]+)(.*)$/i"</span><span class="src-sym">, </span><span class="src-var">$this</span><span class="src-sym">-></span><a href="class.upload.html#var$file_src_mime">file_src_mime</a><span class="src-sym">)) </span><span class="src-sym">{</span></div></li> <li><div class="src-line"><a name="a2475"></a> <span class="src-var">$this</span><span class="src-sym">-></span><a href="class.upload.html#var$file_src_mime">file_src_mime</a> = <a href="http://www.php.net/preg_replace">preg_replace</a><span class="src-sym">(</span><span class="src-str">"/^([\.-\w]+)\/([\.-\w]+)(.*)$/i"</span><span class="src-sym">, </span><span class="src-str">'$1/$2'</span><span class="src-sym">, </span><span class="src-var">$this</span><span class="src-sym">-></span><a href="class.upload.html#var$file_src_mime">file_src_mime</a><span class="src-sym">)</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a2476"></a> <span class="src-var">$this</span><span class="src-sym">-></span><a href="class.upload.html#var$log">log</a> .= <span class="src-str">'-&nbsp;MIME validated as ' </span>. <span class="src-var">$this</span><span class="src-sym">-></span><a href="class.upload.html#var$file_src_mime">file_src_mime</a> . <span class="src-str">'<br />'</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a2477"></a> <span class="src-sym">} </span><span class="src-key">else </span><span class="src-sym">{</span></div></li> <li><div class="src-line"><a name="a2478"></a> <span class="src-var">$this</span><span class="src-sym">-></span><a href="class.upload.html#var$file_src_mime">file_src_mime</a> = <span class="src-id">null</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a2479"></a> <span class="src-sym">}</span></div></li> <li><div class="src-line"><a name="a2480"></a> <span class="src-sym">} </span><span class="src-key">else </span><span class="src-sym">{</span></div></li> <li><div class="src-line"><a name="a2481"></a> <span class="src-var">$this</span><span class="src-sym">-></span><a href="class.upload.html#var$log">log</a> .= <span class="src-str">'&nbsp;&nbsp;&nbsp;&nbsp;UNIX file() command failed<br />'</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a2482"></a> <span class="src-sym">}</span></div></li> <li><div class="src-line"><a name="a2483"></a> <span class="src-sym">} </span><span class="src-key">else </span><span class="src-sym">{</span></div></li> <li><div class="src-line"><a name="a2484"></a> <span class="src-var">$this</span><span class="src-sym">-></span><a href="class.upload.html#var$log">log</a> .= <span class="src-str">'&nbsp;&nbsp;&nbsp;&nbsp;UNIX file() command not availabled<br />'</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a2485"></a> <span class="src-sym">}</span></div></li> <li><div class="src-line"><a name="a2486"></a> <span class="src-sym">} </span><span class="src-key">else </span><span class="src-sym">{</span></div></li> <li><div class="src-line"><a name="a2487"></a> <span class="src-var">$this</span><span class="src-sym">-></span><a href="class.upload.html#var$log">log</a> .= <span class="src-str">'- UNIX file() command is deactivated<br />'</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a2488"></a> <span class="src-sym">}</span></div></li> <li><div class="src-line"><a name="a2489"></a> <span class="src-sym">}</span></div></li> <li><div class="src-line"><a name="a2490"></a> </div></li> <li><div class="src-line"><a name="a2491"></a> <span class="src-comm">// checks MIME type with mime_magic</span></div></li> <li><div class="src-line"><a name="a2492"></a> <span class="src-key">if </span><span class="src-sym">(</span><span class="src-sym">!</span><span class="src-var">$this</span><span class="src-sym">-></span><a href="class.upload.html#var$file_src_mime">file_src_mime</a> || <span class="src-sym">!</span><a href="http://www.php.net/is_string">is_string</a><span class="src-sym">(</span><span class="src-var">$this</span><span class="src-sym">-></span><a href="class.upload.html#var$file_src_mime">file_src_mime</a><span class="src-sym">) </span>|| <span class="src-key">empty</span><span class="src-sym">(</span><span class="src-var">$this</span><span class="src-sym">-></span><a href="class.upload.html#var$file_src_mime">file_src_mime</a><span class="src-sym">) </span>|| <a href="http://www.php.net/strpos">strpos</a><span class="src-sym">(</span><span class="src-var">$this</span><span class="src-sym">-></span><a href="class.upload.html#var$file_src_mime">file_src_mime</a><span class="src-sym">, </span><span class="src-str">'/'</span><span class="src-sym">) </span>=== <span class="src-id">FALSE</span><span class="src-sym">) </span><span class="src-sym">{</span></div></li> <li><div class="src-line"><a name="a2493"></a> <span class="src-key">if </span><span class="src-sym">(</span><span class="src-var">$this</span><span class="src-sym">-></span><a href="class.upload.html#var$mime_magic">mime_magic</a><span class="src-sym">) </span><span class="src-sym">{</span></div></li> <li><div class="src-line"><a name="a2494"></a> <span class="src-var">$this</span><span class="src-sym">-></span><a href="class.upload.html#var$log">log</a> .= <span class="src-str">'- Checking MIME type with mime.magic file (mime_content_type())<br />'</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a2495"></a> <span class="src-key">if </span><span class="src-sym">(</span><a href="http://www.php.net/function_exists">function_exists</a><span class="src-sym">(</span><span class="src-str">'mime_content_type'</span><span class="src-sym">)) </span><span class="src-sym">{</span></div></li> <li><div class="src-line"><a name="a2496"></a> <span class="src-var">$this</span><span class="src-sym">-></span><a href="class.upload.html#var$file_src_mime">file_src_mime</a> = <a href="http://www.php.net/mime_content_type">mime_content_type</a><span class="src-sym">(</span><span class="src-var">$this</span><span class="src-sym">-></span><span class="src-var">file_src_pathname</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a2497"></a> <span class="src-var">$this</span><span class="src-sym">-></span><a href="class.upload.html#var$log">log</a> .= <span class="src-str">'&nbsp;&nbsp;&nbsp;&nbsp;MIME type detected as ' </span>. <span class="src-var">$this</span><span class="src-sym">-></span><a href="class.upload.html#var$file_src_mime">file_src_mime</a> . <span class="src-str">' by mime_content_type()<br />'</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a2498"></a> <span class="src-key">if </span><span class="src-sym">(</span><a href="http://www.php.net/preg_match">preg_match</a><span class="src-sym">(</span><span class="src-str">"/^([\.-\w]+)\/([\.-\w]+)(.*)$/i"</span><span class="src-sym">, </span><span class="src-var">$this</span><span class="src-sym">-></span><a href="class.upload.html#var$file_src_mime">file_src_mime</a><span class="src-sym">)) </span><span class="src-sym">{</span></div></li> <li><div class="src-line"><a name="a2499"></a> <span class="src-var">$this</span><span class="src-sym">-></span><a href="class.upload.html#var$file_src_mime">file_src_mime</a> = <a href="http://www.php.net/preg_replace">preg_replace</a><span class="src-sym">(</span><span class="src-str">"/^([\.-\w]+)\/([\.-\w]+)(.*)$/i"</span><span class="src-sym">, </span><span class="src-str">'$1/$2'</span><span class="src-sym">, </span><span class="src-var">$this</span><span class="src-sym">-></span><a href="class.upload.html#var$file_src_mime">file_src_mime</a><span class="src-sym">)</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a2500"></a> <span class="src-var">$this</span><span class="src-sym">-></span><a href="class.upload.html#var$log">log</a> .= <span class="src-str">'-&nbsp;MIME validated as ' </span>. <span class="src-var">$this</span><span class="src-sym">-></span><a href="class.upload.html#var$file_src_mime">file_src_mime</a> . <span class="src-str">'<br />'</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a2501"></a> <span class="src-sym">} </span><span class="src-key">else </span><span class="src-sym">{</span></div></li> <li><div class="src-line"><a name="a2502"></a> <span class="src-var">$this</span><span class="src-sym">-></span><a href="class.upload.html#var$file_src_mime">file_src_mime</a> = <span class="src-id">null</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a2503"></a> <span class="src-sym">}</span></div></li> <li><div class="src-line"><a name="a2504"></a> <span class="src-sym">} </span><span class="src-key">else </span><span class="src-sym">{</span></div></li> <li><div class="src-line"><a name="a2505"></a> <span class="src-var">$this</span><span class="src-sym">-></span><a href="class.upload.html#var$log">log</a> .= <span class="src-str">'&nbsp;&nbsp;&nbsp;&nbsp;mime_content_type() is not available<br />'</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a2506"></a> <span class="src-sym">}</span></div></li> <li><div class="src-line"><a name="a2507"></a> <span class="src-sym">} </span><span class="src-key">else </span><span class="src-sym">{</span></div></li> <li><div class="src-line"><a name="a2508"></a> <span class="src-var">$this</span><span class="src-sym">-></span><a href="class.upload.html#var$log">log</a> .= <span class="src-str">'- mime.magic file (mime_content_type()) is deactivated<br />'</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a2509"></a> <span class="src-sym">}</span></div></li> <li><div class="src-line"><a name="a2510"></a> <span class="src-sym">}</span></div></li> <li><div class="src-line"><a name="a2511"></a> </div></li> <li><div class="src-line"><a name="a2512"></a> <span class="src-comm">// checks MIME type with getimagesize()</span></div></li> <li><div class="src-line"><a name="a2513"></a> <span class="src-key">if </span><span class="src-sym">(</span><span class="src-sym">!</span><span class="src-var">$this</span><span class="src-sym">-></span><a href="class.upload.html#var$file_src_mime">file_src_mime</a> || <span class="src-sym">!</span><a href="http://www.php.net/is_string">is_string</a><span class="src-sym">(</span><span class="src-var">$this</span><span class="src-sym">-></span><a href="class.upload.html#var$file_src_mime">file_src_mime</a><span class="src-sym">) </span>|| <span class="src-key">empty</span><span class="src-sym">(</span><span class="src-var">$this</span><span class="src-sym">-></span><a href="class.upload.html#var$file_src_mime">file_src_mime</a><span class="src-sym">) </span>|| <a href="http://www.php.net/strpos">strpos</a><span class="src-sym">(</span><span class="src-var">$this</span><span class="src-sym">-></span><a href="class.upload.html#var$file_src_mime">file_src_mime</a><span class="src-sym">, </span><span class="src-str">'/'</span><span class="src-sym">) </span>=== <span class="src-id">FALSE</span><span class="src-sym">) </span><span class="src-sym">{</span></div></li> <li><div class="src-line"><a name="a2514"></a> <span class="src-key">if </span><span class="src-sym">(</span><span class="src-var">$this</span><span class="src-sym">-></span><a href="class.upload.html#var$mime_getimagesize">mime_getimagesize</a><span class="src-sym">) </span><span class="src-sym">{</span></div></li> <li><div class="src-line"><a name="a2515"></a> <span class="src-var">$this</span><span class="src-sym">-></span><a href="class.upload.html#var$log">log</a> .= <span class="src-str">'- Checking MIME type with getimagesize()<br />'</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a2516"></a> <span class="src-var">$info </span>= <a href="http://www.php.net/getimagesize">getimagesize</a><span class="src-sym">(</span><span class="src-var">$this</span><span class="src-sym">-></span><span class="src-var">file_src_pathname</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a2517"></a> <span class="src-key">if </span><span class="src-sym">(</span><a href="http://www.php.net/is_array">is_array</a><span class="src-sym">(</span><span class="src-var">$info</span><span class="src-sym">) </span>&& <a href="http://www.php.net/array_key_exists">array_key_exists</a><span class="src-sym">(</span><span class="src-str">'mime'</span><span class="src-sym">, </span><span class="src-var">$info</span><span class="src-sym">)) </span><span class="src-sym">{</span></div></li> <li><div class="src-line"><a name="a2518"></a> <span class="src-var">$this</span><span class="src-sym">-></span><a href="class.upload.html#var$file_src_mime">file_src_mime</a> = <a href="http://www.php.net/trim">trim</a><span class="src-sym">(</span><span class="src-var">$info</span><span class="src-sym">[</span><span class="src-str">'mime'</span><span class="src-sym">]</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a2519"></a> <span class="src-key">if </span><span class="src-sym">(</span><span class="src-key">empty</span><span class="src-sym">(</span><span class="src-var">$this</span><span class="src-sym">-></span><a href="class.upload.html#var$file_src_mime">file_src_mime</a><span class="src-sym">)) </span><span class="src-sym">{</span></div></li> <li><div class="src-line"><a name="a2520"></a> <span class="src-var">$this</span><span class="src-sym">-></span><a href="class.upload.html#var$log">log</a> .= <span class="src-str">'&nbsp;&nbsp;&nbsp;&nbsp;MIME empty, guessing from type<br />'</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a2521"></a> <span class="src-var">$mime </span>= <span class="src-sym">(</span><a href="http://www.php.net/is_array">is_array</a><span class="src-sym">(</span><span class="src-var">$info</span><span class="src-sym">) </span>&& <a href="http://www.php.net/array_key_exists">array_key_exists</a><span class="src-sym">(</span><span class="src-num">2</span><span class="src-sym">, </span><span class="src-var">$info</span><span class="src-sym">) </span>? <span class="src-var">$info</span><span class="src-sym">[</span><span class="src-num">2</span><span class="src-sym">] </span>: <span class="src-id">null</span><span class="src-sym">)</span><span class="src-sym">; </span><span class="src-comm">// 1 = GIF, 2 = JPG, 3 = PNG</span></div></li> <li><div class="src-line"><a name="a2522"></a> <span class="src-var">$this</span><span class="src-sym">-></span><a href="class.upload.html#var$file_src_mime">file_src_mime</a> = <span class="src-sym">(</span><span class="src-var">$mime</span>==<span class="src-id">IMAGETYPE_GIF </span>? <span class="src-str">'image/gif' </span>: <span class="src-sym">(</span><span class="src-var">$mime</span>==<span class="src-id">IMAGETYPE_JPEG </span>? <span class="src-str">'image/jpeg' </span>: <span class="src-sym">(</span><span class="src-var">$mime</span>==<span class="src-id">IMAGETYPE_PNG </span>? <span class="src-str">'image/png' </span>: <span class="src-sym">(</span><span class="src-var">$mime</span>==<span class="src-id">IMAGETYPE_BMP </span>? <span class="src-str">'image/bmp' </span>: <span class="src-id">null</span><span class="src-sym">))))</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a2523"></a> <span class="src-sym">}</span></div></li> <li><div class="src-line"><a name="a2524"></a> <span class="src-var">$this</span><span class="src-sym">-></span><a href="class.upload.html#var$log">log</a> .= <span class="src-str">'&nbsp;&nbsp;&nbsp;&nbsp;MIME type detected as ' </span>. <span class="src-var">$this</span><span class="src-sym">-></span><a href="class.upload.html#var$file_src_mime">file_src_mime</a> . <span class="src-str">' by PHP getimagesize() function<br />'</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a2525"></a> <span class="src-key">if </span><span class="src-sym">(</span><a href="http://www.php.net/preg_match">preg_match</a><span class="src-sym">(</span><span class="src-str">"/^([\.-\w]+)\/([\.-\w]+)(.*)$/i"</span><span class="src-sym">, </span><span class="src-var">$this</span><span class="src-sym">-></span><a href="class.upload.html#var$file_src_mime">file_src_mime</a><span class="src-sym">)) </span><span class="src-sym">{</span></div></li> <li><div class="src-line"><a name="a2526"></a> <span class="src-var">$this</span><span class="src-sym">-></span><a href="class.upload.html#var$file_src_mime">file_src_mime</a> = <a href="http://www.php.net/preg_replace">preg_replace</a><span class="src-sym">(</span><span class="src-str">"/^([\.-\w]+)\/([\.-\w]+)(.*)$/i"</span><span class="src-sym">, </span><span class="src-str">'$1/$2'</span><span class="src-sym">, </span><span class="src-var">$this</span><span class="src-sym">-></span><a href="class.upload.html#var$file_src_mime">file_src_mime</a><span class="src-sym">)</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a2527"></a> <span class="src-var">$this</span><span class="src-sym">-></span><a href="class.upload.html#var$log">log</a> .= <span class="src-str">'-&nbsp;MIME validated as ' </span>. <span class="src-var">$this</span><span class="src-sym">-></span><a href="class.upload.html#var$file_src_mime">file_src_mime</a> . <span class="src-str">'<br />'</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a2528"></a> <span class="src-sym">} </span><span class="src-key">else </span><span class="src-sym">{</span></div></li> <li><div class="src-line"><a name="a2529"></a> <span class="src-var">$this</span><span class="src-sym">-></span><a href="class.upload.html#var$file_src_mime">file_src_mime</a> = <span class="src-id">null</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a2530"></a> <span class="src-sym">}</span></div></li> <li><div class="src-line"><a name="a2531"></a> <span class="src-sym">} </span><span class="src-key">else </span><span class="src-sym">{</span></div></li> <li><div class="src-line"><a name="a2532"></a> <span class="src-var">$this</span><span class="src-sym">-></span><a href="class.upload.html#var$log">log</a> .= <span class="src-str">'&nbsp;&nbsp;&nbsp;&nbsp;getimagesize() failed<br />'</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a2533"></a> <span class="src-sym">}</span></div></li> <li><div class="src-line"><a name="a2534"></a> <span class="src-sym">} </span><span class="src-key">else </span><span class="src-sym">{</span></div></li> <li><div class="src-line"><a name="a2535"></a> <span class="src-var">$this</span><span class="src-sym">-></span><a href="class.upload.html#var$log">log</a> .= <span class="src-str">'- getimagesize() is deactivated<br />'</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a2536"></a> <span class="src-sym">}</span></div></li> <li><div class="src-line"><a name="a2537"></a> <span class="src-sym">}</span></div></li> <li><div class="src-line"><a name="a2538"></a> </div></li> <li><div class="src-line"><a name="a2539"></a> <span class="src-comm">// default to MIME from browser (or Flash)</span></div></li> <li><div class="src-line"><a name="a2540"></a> <span class="src-key">if </span><span class="src-sym">(</span><span class="src-sym">!</span><span class="src-key">empty</span><span class="src-sym">(</span><span class="src-var">$mime_from_browser</span><span class="src-sym">) </span>&& <span class="src-sym">!</span><span class="src-var">$this</span><span class="src-sym">-></span><a href="class.upload.html#var$file_src_mime">file_src_mime</a> || <span class="src-sym">!</span><a href="http://www.php.net/is_string">is_string</a><span class="src-sym">(</span><span class="src-var">$this</span><span class="src-sym">-></span><a href="class.upload.html#var$file_src_mime">file_src_mime</a><span class="src-sym">) </span>|| <span class="src-key">empty</span><span class="src-sym">(</span><span class="src-var">$this</span><span class="src-sym">-></span><a href="class.upload.html#var$file_src_mime">file_src_mime</a><span class="src-sym">)) </span><span class="src-sym">{</span></div></li> <li><div class="src-line"><a name="a2541"></a> <span class="src-var">$this</span><span class="src-sym">-></span><a href="class.upload.html#var$file_src_mime">file_src_mime</a> =<span class="src-var">$mime_from_browser</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a2542"></a> <span class="src-var">$this</span><span class="src-sym">-></span><a href="class.upload.html#var$log">log</a> .= <span class="src-str">'- MIME type detected as ' </span>. <span class="src-var">$this</span><span class="src-sym">-></span><a href="class.upload.html#var$file_src_mime">file_src_mime</a> . <span class="src-str">' by browser<br />'</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a2543"></a> <span class="src-key">if </span><span class="src-sym">(</span><a href="http://www.php.net/preg_match">preg_match</a><span class="src-sym">(</span><span class="src-str">"/^([\.-\w]+)\/([\.-\w]+)(.*)$/i"</span><span class="src-sym">, </span><span class="src-var">$this</span><span class="src-sym">-></span><a href="class.upload.html#var$file_src_mime">file_src_mime</a><span class="src-sym">)) </span><span class="src-sym">{</span></div></li> <li><div class="src-line"><a name="a2544"></a> <span class="src-var">$this</span><span class="src-sym">-></span><a href="class.upload.html#var$file_src_mime">file_src_mime</a> = <a href="http://www.php.net/preg_replace">preg_replace</a><span class="src-sym">(</span><span class="src-str">"/^([\.-\w]+)\/([\.-\w]+)(.*)$/i"</span><span class="src-sym">, </span><span class="src-str">'$1/$2'</span><span class="src-sym">, </span><span class="src-var">$this</span><span class="src-sym">-></span><a href="class.upload.html#var$file_src_mime">file_src_mime</a><span class="src-sym">)</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a2545"></a> <span class="src-var">$this</span><span class="src-sym">-></span><a href="class.upload.html#var$log">log</a> .= <span class="src-str">'-&nbsp;MIME validated as ' </span>. <span class="src-var">$this</span><span class="src-sym">-></span><a href="class.upload.html#var$file_src_mime">file_src_mime</a> . <span class="src-str">'<br />'</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a2546"></a> <span class="src-sym">} </span><span class="src-key">else </span><span class="src-sym">{</span></div></li> <li><div class="src-line"><a name="a2547"></a> <span class="src-var">$this</span><span class="src-sym">-></span><a href="class.upload.html#var$file_src_mime">file_src_mime</a> = <span class="src-id">null</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a2548"></a> <span class="src-sym">}</span></div></li> <li><div class="src-line"><a name="a2549"></a> <span class="src-sym">}</span></div></li> <li><div class="src-line"><a name="a2550"></a> </div></li> <li><div class="src-line"><a name="a2551"></a> <span class="src-comm">// we need to work some magic if we upload via Flash</span></div></li> <li><div class="src-line"><a name="a2552"></a> <span class="src-key">if </span><span class="src-sym">(</span><span class="src-var">$this</span><span class="src-sym">-></span><a href="class.upload.html#var$file_src_mime">file_src_mime</a> == <span class="src-str">'application/octet-stream' </span>|| <span class="src-sym">!</span><span class="src-var">$this</span><span class="src-sym">-></span><a href="class.upload.html#var$file_src_mime">file_src_mime</a> || <span class="src-sym">!</span><a href="http://www.php.net/is_string">is_string</a><span class="src-sym">(</span><span class="src-var">$this</span><span class="src-sym">-></span><a href="class.upload.html#var$file_src_mime">file_src_mime</a><span class="src-sym">) </span>|| <span class="src-key">empty</span><span class="src-sym">(</span><span class="src-var">$this</span><span class="src-sym">-></span><a href="class.upload.html#var$file_src_mime">file_src_mime</a><span class="src-sym">) </span>|| <a href="http://www.php.net/strpos">strpos</a><span class="src-sym">(</span><span class="src-var">$this</span><span class="src-sym">-></span><a href="class.upload.html#var$file_src_mime">file_src_mime</a><span class="src-sym">, </span><span class="src-str">'/'</span><span class="src-sym">) </span>=== <span class="src-id">FALSE</span><span class="src-sym">) </span><span class="src-sym">{</span></div></li> <li><div class="src-line"><a name="a2553"></a> <span class="src-key">if </span><span class="src-sym">(</span><span class="src-var">$this</span><span class="src-sym">-></span><a href="class.upload.html#var$file_src_mime">file_src_mime</a> == <span class="src-str">'application/octet-stream'</span><span class="src-sym">) </span><span class="src-var">$this</span><span class="src-sym">-></span><a href="class.upload.html#var$log">log</a> .= <span class="src-str">'- Flash may be rewriting MIME as application/octet-stream<br />'</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a2554"></a> <span class="src-var">$this</span><span class="src-sym">-></span><a href="class.upload.html#var$log">log</a> .= <span class="src-str">'- Try to guess MIME type from file extension (' </span>. <span class="src-var">$this</span><span class="src-sym">-></span><a href="class.upload.html#var$file_src_name_ext">file_src_name_ext</a> . <span class="src-str">'): '</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a2555"></a> <span class="src-key">switch</span><span class="src-sym">(</span><span class="src-var">$this</span><span class="src-sym">-></span><a href="class.upload.html#var$file_src_name_ext">file_src_name_ext</a><span class="src-sym">) </span><span class="src-sym">{</span></div></li> <li><div class="src-line"><a name="a2556"></a> <span class="src-key">case </span><span class="src-str">'jpg'</span>:</div></li> <li><div class="src-line"><a name="a2557"></a> <span class="src-key">case </span><span class="src-str">'jpeg'</span>:</div></li> <li><div class="src-line"><a name="a2558"></a> <span class="src-key">case </span><span class="src-str">'jpe'</span>:</div></li> <li><div class="src-line"><a name="a2559"></a> <span class="src-var">$this</span><span class="src-sym">-></span><a href="class.upload.html#var$file_src_mime">file_src_mime</a> = <span class="src-str">'image/jpeg'</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a2560"></a> <span class="src-key">break</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a2561"></a> <span class="src-key">case </span><span class="src-str">'gif'</span>:</div></li> <li><div class="src-line"><a name="a2562"></a> <span class="src-var">$this</span><span class="src-sym">-></span><a href="class.upload.html#var$file_src_mime">file_src_mime</a> = <span class="src-str">'image/gif'</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a2563"></a> <span class="src-key">break</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a2564"></a> <span class="src-key">case </span><span class="src-str">'png'</span>:</div></li> <li><div class="src-line"><a name="a2565"></a> <span class="src-var">$this</span><span class="src-sym">-></span><a href="class.upload.html#var$file_src_mime">file_src_mime</a> = <span class="src-str">'image/png'</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a2566"></a> <span class="src-key">break</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a2567"></a> <span class="src-key">case </span><span class="src-str">'bmp'</span>:</div></li> <li><div class="src-line"><a name="a2568"></a> <span class="src-var">$this</span><span class="src-sym">-></span><a href="class.upload.html#var$file_src_mime">file_src_mime</a> = <span class="src-str">'image/bmp'</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a2569"></a> <span class="src-key">break</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a2570"></a> <span class="src-key">case </span><span class="src-str">'flv'</span>:</div></li> <li><div class="src-line"><a name="a2571"></a> <span class="src-var">$this</span><span class="src-sym">-></span><a href="class.upload.html#var$file_src_mime">file_src_mime</a> = <span class="src-str">'video/x-flv'</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a2572"></a> <span class="src-key">break</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a2573"></a> <span class="src-key">case </span><span class="src-str">'js' </span>:</div></li> <li><div class="src-line"><a name="a2574"></a> <span class="src-var">$this</span><span class="src-sym">-></span><a href="class.upload.html#var$file_src_mime">file_src_mime</a> = <span class="src-str">'application/x-javascript'</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a2575"></a> <span class="src-key">break</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a2576"></a> <span class="src-key">case </span><span class="src-str">'json' </span>:</div></li> <li><div class="src-line"><a name="a2577"></a> <span class="src-var">$this</span><span class="src-sym">-></span><a href="class.upload.html#var$file_src_mime">file_src_mime</a> = <span class="src-str">'application/json'</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a2578"></a> <span class="src-key">break</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a2579"></a> <span class="src-key">case </span><span class="src-str">'tiff' </span>:</div></li> <li><div class="src-line"><a name="a2580"></a> <span class="src-var">$this</span><span class="src-sym">-></span><a href="class.upload.html#var$file_src_mime">file_src_mime</a> = <span class="src-str">'image/tiff'</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a2581"></a> <span class="src-key">break</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a2582"></a> <span class="src-key">case </span><span class="src-str">'css' </span>:</div></li> <li><div class="src-line"><a name="a2583"></a> <span class="src-var">$this</span><span class="src-sym">-></span><a href="class.upload.html#var$file_src_mime">file_src_mime</a> = <span class="src-str">'text/css'</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a2584"></a> <span class="src-key">break</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a2585"></a> <span class="src-key">case </span><span class="src-str">'xml' </span>:</div></li> <li><div class="src-line"><a name="a2586"></a> <span class="src-var">$this</span><span class="src-sym">-></span><a href="class.upload.html#var$file_src_mime">file_src_mime</a> = <span class="src-str">'application/xml'</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a2587"></a> <span class="src-key">break</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a2588"></a> <span class="src-key">case </span><span class="src-str">'doc' </span>:</div></li> <li><div class="src-line"><a name="a2589"></a> <span class="src-key">case </span><span class="src-str">'docx' </span>:</div></li> <li><div class="src-line"><a name="a2590"></a> <span class="src-var">$this</span><span class="src-sym">-></span><a href="class.upload.html#var$file_src_mime">file_src_mime</a> = <span class="src-str">'application/msword'</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a2591"></a> <span class="src-key">break</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a2592"></a> <span class="src-key">case </span><span class="src-str">'xls' </span>:</div></li> <li><div class="src-line"><a name="a2593"></a> <span class="src-key">case </span><span class="src-str">'xlt' </span>:</div></li> <li><div class="src-line"><a name="a2594"></a> <span class="src-key">case </span><span class="src-str">'xlm' </span>:</div></li> <li><div class="src-line"><a name="a2595"></a> <span class="src-key">case </span><span class="src-str">'xld' </span>:</div></li> <li><div class="src-line"><a name="a2596"></a> <span class="src-key">case </span><span class="src-str">'xla' </span>:</div></li> <li><div class="src-line"><a name="a2597"></a> <span class="src-key">case </span><span class="src-str">'xlc' </span>:</div></li> <li><div class="src-line"><a name="a2598"></a> <span class="src-key">case </span><span class="src-str">'xlw' </span>:</div></li> <li><div class="src-line"><a name="a2599"></a> <span class="src-key">case </span><span class="src-str">'xll' </span>:</div></li> <li><div class="src-line"><a name="a2600"></a> <span class="src-var">$this</span><span class="src-sym">-></span><a href="class.upload.html#var$file_src_mime">file_src_mime</a> = <span class="src-str">'application/vnd.ms-excel'</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a2601"></a> <span class="src-key">break</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a2602"></a> <span class="src-key">case </span><span class="src-str">'ppt' </span>:</div></li> <li><div class="src-line"><a name="a2603"></a> <span class="src-key">case </span><span class="src-str">'pps' </span>:</div></li> <li><div class="src-line"><a name="a2604"></a> <span class="src-var">$this</span><span class="src-sym">-></span><a href="class.upload.html#var$file_src_mime">file_src_mime</a> = <span class="src-str">'application/vnd.ms-powerpoint'</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a2605"></a> <span class="src-key">break</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a2606"></a> <span class="src-key">case </span><span class="src-str">'rtf' </span>:</div></li> <li><div class="src-line"><a name="a2607"></a> <span class="src-var">$this</span><span class="src-sym">-></span><a href="class.upload.html#var$file_src_mime">file_src_mime</a> = <span class="src-str">'application/rtf'</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a2608"></a> <span class="src-key">break</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a2609"></a> <span class="src-key">case </span><span class="src-str">'pdf' </span>:</div></li> <li><div class="src-line"><a name="a2610"></a> <span class="src-var">$this</span><span class="src-sym">-></span><a href="class.upload.html#var$file_src_mime">file_src_mime</a> = <span class="src-str">'application/pdf'</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a2611"></a> <span class="src-key">break</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a2612"></a> <span class="src-key">case </span><span class="src-str">'html' </span>:</div></li> <li><div class="src-line"><a name="a2613"></a> <span class="src-key">case </span><span class="src-str">'htm' </span>:</div></li> <li><div class="src-line"><a name="a2614"></a> <span class="src-key">case </span><span class="src-str">'php' </span>:</div></li> <li><div class="src-line"><a name="a2615"></a> <span class="src-var">$this</span><span class="src-sym">-></span><a href="class.upload.html#var$file_src_mime">file_src_mime</a> = <span class="src-str">'text/html'</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a2616"></a> <span class="src-key">break</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a2617"></a> <span class="src-key">case </span><span class="src-str">'txt' </span>:</div></li> <li><div class="src-line"><a name="a2618"></a> <span class="src-var">$this</span><span class="src-sym">-></span><a href="class.upload.html#var$file_src_mime">file_src_mime</a> = <span class="src-str">'text/plain'</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a2619"></a> <span class="src-key">break</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a2620"></a> <span class="src-key">case </span><span class="src-str">'mpeg' </span>:</div></li> <li><div class="src-line"><a name="a2621"></a> <span class="src-key">case </span><span class="src-str">'mpg' </span>:</div></li> <li><div class="src-line"><a name="a2622"></a> <span class="src-key">case </span><span class="src-str">'mpe' </span>:</div></li> <li><div class="src-line"><a name="a2623"></a> <span class="src-var">$this</span><span class="src-sym">-></span><a href="class.upload.html#var$file_src_mime">file_src_mime</a> = <span class="src-str">'video/mpeg'</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a2624"></a> <span class="src-key">break</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a2625"></a> <span class="src-key">case </span><span class="src-str">'mp3' </span>:</div></li> <li><div class="src-line"><a name="a2626"></a> <span class="src-var">$this</span><span class="src-sym">-></span><a href="class.upload.html#var$file_src_mime">file_src_mime</a> = <span class="src-str">'audio/mpeg3'</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a2627"></a> <span class="src-key">break</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a2628"></a> <span class="src-key">case </span><span class="src-str">'wav' </span>:</div></li> <li><div class="src-line"><a name="a2629"></a> <span class="src-var">$this</span><span class="src-sym">-></span><a href="class.upload.html#var$file_src_mime">file_src_mime</a> = <span class="src-str">'audio/wav'</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a2630"></a> <span class="src-key">break</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a2631"></a> <span class="src-key">case </span><span class="src-str">'aiff' </span>:</div></li> <li><div class="src-line"><a name="a2632"></a> <span class="src-key">case </span><span class="src-str">'aif' </span>:</div></li> <li><div class="src-line"><a name="a2633"></a> <span class="src-var">$this</span><span class="src-sym">-></span><a href="class.upload.html#var$file_src_mime">file_src_mime</a> = <span class="src-str">'audio/aiff'</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a2634"></a> <span class="src-key">break</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a2635"></a> <span class="src-key">case </span><span class="src-str">'avi' </span>:</div></li> <li><div class="src-line"><a name="a2636"></a> <span class="src-var">$this</span><span class="src-sym">-></span><a href="class.upload.html#var$file_src_mime">file_src_mime</a> = <span class="src-str">'video/msvideo'</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a2637"></a> <span class="src-key">break</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a2638"></a> <span class="src-key">case </span><span class="src-str">'wmv' </span>:</div></li> <li><div class="src-line"><a name="a2639"></a> <span class="src-var">$this</span><span class="src-sym">-></span><a href="class.upload.html#var$file_src_mime">file_src_mime</a> = <span class="src-str">'video/x-ms-wmv'</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a2640"></a> <span class="src-key">break</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a2641"></a> <span class="src-key">case </span><span class="src-str">'mov' </span>:</div></li> <li><div class="src-line"><a name="a2642"></a> <span class="src-var">$this</span><span class="src-sym">-></span><a href="class.upload.html#var$file_src_mime">file_src_mime</a> = <span class="src-str">'video/quicktime'</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a2643"></a> <span class="src-key">break</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a2644"></a> <span class="src-key">case </span><span class="src-str">'zip' </span>:</div></li> <li><div class="src-line"><a name="a2645"></a> <span class="src-var">$this</span><span class="src-sym">-></span><a href="class.upload.html#var$file_src_mime">file_src_mime</a> = <span class="src-str">'application/zip'</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a2646"></a> <span class="src-key">break</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a2647"></a> <span class="src-key">case </span><span class="src-str">'tar' </span>:</div></li> <li><div class="src-line"><a name="a2648"></a> <span class="src-var">$this</span><span class="src-sym">-></span><a href="class.upload.html#var$file_src_mime">file_src_mime</a> = <span class="src-str">'application/x-tar'</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a2649"></a> <span class="src-key">break</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a2650"></a> <span class="src-key">case </span><span class="src-str">'swf' </span>:</div></li> <li><div class="src-line"><a name="a2651"></a> <span class="src-var">$this</span><span class="src-sym">-></span><a href="class.upload.html#var$file_src_mime">file_src_mime</a> = <span class="src-str">'application/x-shockwave-flash'</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a2652"></a> <span class="src-key">break</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a2653"></a> <span class="src-key">case </span><span class="src-str">'odt'</span>:</div></li> <li><div class="src-line"><a name="a2654"></a> <span class="src-var">$this</span><span class="src-sym">-></span><a href="class.upload.html#var$file_src_mime">file_src_mime</a> = <span class="src-str">'application/vnd.oasis.opendocument.text'</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a2655"></a> <span class="src-key">break</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a2656"></a> <span class="src-key">case </span><span class="src-str">'ott'</span>:</div></li> <li><div class="src-line"><a name="a2657"></a> <span class="src-var">$this</span><span class="src-sym">-></span><a href="class.upload.html#var$file_src_mime">file_src_mime</a> = <span class="src-str">'application/vnd.oasis.opendocument.text-template'</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a2658"></a> <span class="src-key">break</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a2659"></a> <span class="src-key">case </span><span class="src-str">'oth'</span>:</div></li> <li><div class="src-line"><a name="a2660"></a> <span class="src-var">$this</span><span class="src-sym">-></span><a href="class.upload.html#var$file_src_mime">file_src_mime</a> = <span class="src-str">'application/vnd.oasis.opendocument.text-web'</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a2661"></a> <span class="src-key">break</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a2662"></a> <span class="src-key">case </span><span class="src-str">'odm'</span>:</div></li> <li><div class="src-line"><a name="a2663"></a> <span class="src-var">$this</span><span class="src-sym">-></span><a href="class.upload.html#var$file_src_mime">file_src_mime</a> = <span class="src-str">'application/vnd.oasis.opendocument.text-master'</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a2664"></a> <span class="src-key">break</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a2665"></a> <span class="src-key">case </span><span class="src-str">'odg'</span>:</div></li> <li><div class="src-line"><a name="a2666"></a> <span class="src-var">$this</span><span class="src-sym">-></span><a href="class.upload.html#var$file_src_mime">file_src_mime</a> = <span class="src-str">'application/vnd.oasis.opendocument.graphics'</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a2667"></a> <span class="src-key">break</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a2668"></a> <span class="src-key">case </span><span class="src-str">'otg'</span>:</div></li> <li><div class="src-line"><a name="a2669"></a> <span class="src-var">$this</span><span class="src-sym">-></span><a href="class.upload.html#var$file_src_mime">file_src_mime</a> = <span class="src-str">'application/vnd.oasis.opendocument.graphics-template'</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a2670"></a> <span class="src-key">break</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a2671"></a> <span class="src-key">case </span><span class="src-str">'odp'</span>:</div></li> <li><div class="src-line"><a name="a2672"></a> <span class="src-var">$this</span><span class="src-sym">-></span><a href="class.upload.html#var$file_src_mime">file_src_mime</a> = <span class="src-str">'application/vnd.oasis.opendocument.presentation'</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a2673"></a> <span class="src-key">break</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a2674"></a> <span class="src-key">case </span><span class="src-str">'otp'</span>:</div></li> <li><div class="src-line"><a name="a2675"></a> <span class="src-var">$this</span><span class="src-sym">-></span><a href="class.upload.html#var$file_src_mime">file_src_mime</a> = <span class="src-str">'application/vnd.oasis.opendocument.presentation-template'</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a2676"></a> <span class="src-key">break</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a2677"></a> <span class="src-key">case </span><span class="src-str">'ods'</span>:</div></li> <li><div class="src-line"><a name="a2678"></a> <span class="src-var">$this</span><span class="src-sym">-></span><a href="class.upload.html#var$file_src_mime">file_src_mime</a> = <span class="src-str">'application/vnd.oasis.opendocument.spreadsheet'</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a2679"></a> <span class="src-key">break</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a2680"></a> <span class="src-key">case </span><span class="src-str">'ots'</span>:</div></li> <li><div class="src-line"><a name="a2681"></a> <span class="src-var">$this</span><span class="src-sym">-></span><a href="class.upload.html#var$file_src_mime">file_src_mime</a> = <span class="src-str">'application/vnd.oasis.opendocument.spreadsheet-template'</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a2682"></a> <span class="src-key">break</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a2683"></a> <span class="src-key">case </span><span class="src-str">'odc'</span>:</div></li> <li><div class="src-line"><a name="a2684"></a> <span class="src-var">$this</span><span class="src-sym">-></span><a href="class.upload.html#var$file_src_mime">file_src_mime</a> = <span class="src-str">'application/vnd.oasis.opendocument.chart'</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a2685"></a> <span class="src-key">break</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a2686"></a> <span class="src-key">case </span><span class="src-str">'odf'</span>:</div></li> <li><div class="src-line"><a name="a2687"></a> <span class="src-var">$this</span><span class="src-sym">-></span><a href="class.upload.html#var$file_src_mime">file_src_mime</a> = <span class="src-str">'application/vnd.oasis.opendocument.formula'</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a2688"></a> <span class="src-key">break</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a2689"></a> <span class="src-key">case </span><span class="src-str">'odb'</span>:</div></li> <li><div class="src-line"><a name="a2690"></a> <span class="src-var">$this</span><span class="src-sym">-></span><a href="class.upload.html#var$file_src_mime">file_src_mime</a> = <span class="src-str">'application/vnd.oasis.opendocument.database'</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a2691"></a> <span class="src-key">break</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a2692"></a> <span class="src-key">case </span><span class="src-str">'odi'</span>:</div></li> <li><div class="src-line"><a name="a2693"></a> <span class="src-var">$this</span><span class="src-sym">-></span><a href="class.upload.html#var$file_src_mime">file_src_mime</a> = <span class="src-str">'application/vnd.oasis.opendocument.image'</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a2694"></a> <span class="src-key">break</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a2695"></a> <span class="src-key">case </span><span class="src-str">'oxt'</span>:</div></li> <li><div class="src-line"><a name="a2696"></a> <span class="src-var">$this</span><span class="src-sym">-></span><a href="class.upload.html#var$file_src_mime">file_src_mime</a> = <span class="src-str">'application/vnd.openofficeorg.extension'</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a2697"></a> <span class="src-key">break</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a2698"></a> <span class="src-key">case </span><span class="src-str">'docx'</span>:</div></li> <li><div class="src-line"><a name="a2699"></a> <span class="src-var">$this</span><span class="src-sym">-></span><a href="class.upload.html#var$file_src_mime">file_src_mime</a> = <span class="src-str">'application/vnd.openxmlformats-officedocument.wordprocessingml.document'</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a2700"></a> <span class="src-key">break</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a2701"></a> <span class="src-key">case </span><span class="src-str">'docm'</span>:</div></li> <li><div class="src-line"><a name="a2702"></a> <span class="src-var">$this</span><span class="src-sym">-></span><a href="class.upload.html#var$file_src_mime">file_src_mime</a> = <span class="src-str">'application/vnd.ms-word.document.macroEnabled.12'</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a2703"></a> <span class="src-key">break</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a2704"></a> <span class="src-key">case </span><span class="src-str">'dotx'</span>:</div></li> <li><div class="src-line"><a name="a2705"></a> <span class="src-var">$this</span><span class="src-sym">-></span><a href="class.upload.html#var$file_src_mime">file_src_mime</a> = <span class="src-str">'application/vnd.openxmlformats-officedocument.wordprocessingml.template'</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a2706"></a> <span class="src-key">break</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a2707"></a> <span class="src-key">case </span><span class="src-str">'dotm'</span>:</div></li> <li><div class="src-line"><a name="a2708"></a> <span class="src-var">$this</span><span class="src-sym">-></span><a href="class.upload.html#var$file_src_mime">file_src_mime</a> = <span class="src-str">'application/vnd.ms-word.template.macroEnabled.12'</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a2709"></a> <span class="src-key">break</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a2710"></a> <span class="src-key">case </span><span class="src-str">'xlsx'</span>:</div></li> <li><div class="src-line"><a name="a2711"></a> <span class="src-var">$this</span><span class="src-sym">-></span><a href="class.upload.html#var$file_src_mime">file_src_mime</a> = <span class="src-str">'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a2712"></a> <span class="src-key">break</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a2713"></a> <span class="src-key">case </span><span class="src-str">'xlsm'</span>:</div></li> <li><div class="src-line"><a name="a2714"></a> <span class="src-var">$this</span><span class="src-sym">-></span><a href="class.upload.html#var$file_src_mime">file_src_mime</a> = <span class="src-str">'application/vnd.ms-excel.sheet.macroEnabled.12'</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a2715"></a> <span class="src-key">break</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a2716"></a> <span class="src-key">case </span><span class="src-str">'xltx'</span>:</div></li> <li><div class="src-line"><a name="a2717"></a> <span class="src-var">$this</span><span class="src-sym">-></span><a href="class.upload.html#var$file_src_mime">file_src_mime</a> = <span class="src-str">'application/vnd.openxmlformats-officedocument.spreadsheetml.template'</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a2718"></a> <span class="src-key">break</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a2719"></a> <span class="src-key">case </span><span class="src-str">'xltm'</span>:</div></li> <li><div class="src-line"><a name="a2720"></a> <span class="src-var">$this</span><span class="src-sym">-></span><a href="class.upload.html#var$file_src_mime">file_src_mime</a> = <span class="src-str">'application/vnd.ms-excel.template.macroEnabled.12'</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a2721"></a> <span class="src-key">break</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a2722"></a> <span class="src-key">case </span><span class="src-str">'xlsb'</span>:</div></li> <li><div class="src-line"><a name="a2723"></a> <span class="src-var">$this</span><span class="src-sym">-></span><a href="class.upload.html#var$file_src_mime">file_src_mime</a> = <span class="src-str">'application/vnd.ms-excel.sheet.binary.macroEnabled.12'</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a2724"></a> <span class="src-key">break</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a2725"></a> <span class="src-key">case </span><span class="src-str">'xlam'</span>:</div></li> <li><div class="src-line"><a name="a2726"></a> <span class="src-var">$this</span><span class="src-sym">-></span><a href="class.upload.html#var$file_src_mime">file_src_mime</a> = <span class="src-str">'application/vnd.ms-excel.addin.macroEnabled.12'</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a2727"></a> <span class="src-key">break</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a2728"></a> <span class="src-key">case </span><span class="src-str">'pptx'</span>:</div></li> <li><div class="src-line"><a name="a2729"></a> <span class="src-var">$this</span><span class="src-sym">-></span><a href="class.upload.html#var$file_src_mime">file_src_mime</a> = <span class="src-str">'application/vnd.openxmlformats-officedocument.presentationml.presentation'</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a2730"></a> <span class="src-key">break</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a2731"></a> <span class="src-key">case </span><span class="src-str">'pptm'</span>:</div></li> <li><div class="src-line"><a name="a2732"></a> <span class="src-var">$this</span><span class="src-sym">-></span><a href="class.upload.html#var$file_src_mime">file_src_mime</a> = <span class="src-str">'application/vnd.ms-powerpoint.presentation.macroEnabled.12'</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a2733"></a> <span class="src-key">break</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a2734"></a> <span class="src-key">case </span><span class="src-str">'ppsx'</span>:</div></li> <li><div class="src-line"><a name="a2735"></a> <span class="src-var">$this</span><span class="src-sym">-></span><a href="class.upload.html#var$file_src_mime">file_src_mime</a> = <span class="src-str">'application/vnd.openxmlformats-officedocument.presentationml.slideshow'</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a2736"></a> <span class="src-key">break</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a2737"></a> <span class="src-key">case </span><span class="src-str">'ppsm'</span>:</div></li> <li><div class="src-line"><a name="a2738"></a> <span class="src-var">$this</span><span class="src-sym">-></span><a href="class.upload.html#var$file_src_mime">file_src_mime</a> = <span class="src-str">'application/vnd.ms-powerpoint.slideshow.macroEnabled.12'</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a2739"></a> <span class="src-key">break</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a2740"></a> <span class="src-key">case </span><span class="src-str">'potx'</span>:</div></li> <li><div class="src-line"><a name="a2741"></a> <span class="src-var">$this</span><span class="src-sym">-></span><a href="class.upload.html#var$file_src_mime">file_src_mime</a> = <span class="src-str">'application/vnd.openxmlformats-officedocument.presentationml.template'</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a2742"></a> <span class="src-key">break</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a2743"></a> <span class="src-key">case </span><span class="src-str">'potm'</span>:</div></li> <li><div class="src-line"><a name="a2744"></a> <span class="src-var">$this</span><span class="src-sym">-></span><a href="class.upload.html#var$file_src_mime">file_src_mime</a> = <span class="src-str">'application/vnd.ms-powerpoint.template.macroEnabled.12'</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a2745"></a> <span class="src-key">break</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a2746"></a> <span class="src-key">case </span><span class="src-str">'ppam'</span>:</div></li> <li><div class="src-line"><a name="a2747"></a> <span class="src-var">$this</span><span class="src-sym">-></span><a href="class.upload.html#var$file_src_mime">file_src_mime</a> = <span class="src-str">'application/vnd.ms-powerpoint.addin.macroEnabled.12'</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a2748"></a> <span class="src-key">break</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a2749"></a> <span class="src-key">case </span><span class="src-str">'sldx'</span>:</div></li> <li><div class="src-line"><a name="a2750"></a> <span class="src-var">$this</span><span class="src-sym">-></span><a href="class.upload.html#var$file_src_mime">file_src_mime</a> = <span class="src-str">'application/vnd.openxmlformats-officedocument.presentationml.slide'</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a2751"></a> <span class="src-key">break</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a2752"></a> <span class="src-key">case </span><span class="src-str">'sldm'</span>:</div></li> <li><div class="src-line"><a name="a2753"></a> <span class="src-var">$this</span><span class="src-sym">-></span><a href="class.upload.html#var$file_src_mime">file_src_mime</a> = <span class="src-str">'application/vnd.ms-powerpoint.slide.macroEnabled.12'</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a2754"></a> <span class="src-key">break</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a2755"></a> <span class="src-key">case </span><span class="src-str">'thmx'</span>:</div></li> <li><div class="src-line"><a name="a2756"></a> <span class="src-var">$this</span><span class="src-sym">-></span><a href="class.upload.html#var$file_src_mime">file_src_mime</a> = <span class="src-str">'application/vnd.ms-officetheme'</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a2757"></a> <span class="src-key">break</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a2758"></a> <span class="src-key">case </span><span class="src-str">'onetoc'</span>:</div></li> <li><div class="src-line"><a name="a2759"></a> <span class="src-key">case </span><span class="src-str">'onetoc2'</span>:</div></li> <li><div class="src-line"><a name="a2760"></a> <span class="src-key">case </span><span class="src-str">'onetmp'</span>:</div></li> <li><div class="src-line"><a name="a2761"></a> <span class="src-key">case </span><span class="src-str">'onepkg'</span>:</div></li> <li><div class="src-line"><a name="a2762"></a> <span class="src-var">$this</span><span class="src-sym">-></span><a href="class.upload.html#var$file_src_mime">file_src_mime</a> = <span class="src-str">'application/onenote'</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a2763"></a> <span class="src-key">break</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a2764"></a> <span class="src-sym">}</span></div></li> <li><div class="src-line"><a name="a2765"></a> <span class="src-key">if </span><span class="src-sym">(</span><span class="src-var">$this</span><span class="src-sym">-></span><a href="class.upload.html#var$file_src_mime">file_src_mime</a> == <span class="src-str">'application/octet-stream'</span><span class="src-sym">) </span><span class="src-sym">{</span></div></li> <li><div class="src-line"><a name="a2766"></a> <span class="src-var">$this</span><span class="src-sym">-></span><a href="class.upload.html#var$log">log</a> .= <span class="src-str">'doesn\'t look like anything known<br />'</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a2767"></a> <span class="src-sym">} </span><span class="src-key">else </span><span class="src-sym">{</span></div></li> <li><div class="src-line"><a name="a2768"></a> <span class="src-var">$this</span><span class="src-sym">-></span><a href="class.upload.html#var$log">log</a> .= <span class="src-str">'MIME type set to ' </span>. <span class="src-var">$this</span><span class="src-sym">-></span><a href="class.upload.html#var$file_src_mime">file_src_mime</a> . <span class="src-str">'<br />'</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a2769"></a> <span class="src-sym">}</span></div></li> <li><div class="src-line"><a name="a2770"></a> <span class="src-sym">}</span></div></li> <li><div class="src-line"><a name="a2771"></a> </div></li> <li><div class="src-line"><a name="a2772"></a> <span class="src-key">if </span><span class="src-sym">(</span><span class="src-sym">!</span><span class="src-var">$this</span><span class="src-sym">-></span><a href="class.upload.html#var$file_src_mime">file_src_mime</a> || <span class="src-sym">!</span><a href="http://www.php.net/is_string">is_string</a><span class="src-sym">(</span><span class="src-var">$this</span><span class="src-sym">-></span><a href="class.upload.html#var$file_src_mime">file_src_mime</a><span class="src-sym">) </span>|| <span class="src-key">empty</span><span class="src-sym">(</span><span class="src-var">$this</span><span class="src-sym">-></span><a href="class.upload.html#var$file_src_mime">file_src_mime</a><span class="src-sym">) </span>|| <a href="http://www.php.net/strpos">strpos</a><span class="src-sym">(</span><span class="src-var">$this</span><span class="src-sym">-></span><a href="class.upload.html#var$file_src_mime">file_src_mime</a><span class="src-sym">, </span><span class="src-str">'/'</span><span class="src-sym">) </span>=== <span class="src-id">FALSE</span><span class="src-sym">) </span><span class="src-sym">{</span></div></li> <li><div class="src-line"><a name="a2773"></a> <span class="src-var">$this</span><span class="src-sym">-></span><a href="class.upload.html#var$log">log</a> .= <span class="src-str">'- MIME type couldn\'t be detected! (' </span>. (string) <span class="src-var">$this</span><span class="src-sym">-></span><a href="class.upload.html#var$file_src_mime">file_src_mime</a> . <span class="src-str">')<br />'</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a2774"></a> <span class="src-sym">}</span></div></li> <li><div class="src-line"><a name="a2775"></a> </div></li> <li><div class="src-line"><a name="a2776"></a> <span class="src-comm">// determine whether the file is an image</span></div></li> <li><div class="src-line"><a name="a2777"></a> <span class="src-key">if </span><span class="src-sym">(</span><span class="src-var">$this</span><span class="src-sym">-></span><a href="class.upload.html#var$file_src_mime">file_src_mime</a> && <a href="http://www.php.net/is_string">is_string</a><span class="src-sym">(</span><span class="src-var">$this</span><span class="src-sym">-></span><a href="class.upload.html#var$file_src_mime">file_src_mime</a><span class="src-sym">) </span>&& <span class="src-sym">!</span><span class="src-key">empty</span><span class="src-sym">(</span><span class="src-var">$this</span><span class="src-sym">-></span><a href="class.upload.html#var$file_src_mime">file_src_mime</a><span class="src-sym">) </span>&& <a href="http://www.php.net/array_key_exists">array_key_exists</a><span class="src-sym">(</span><span class="src-var">$this</span><span class="src-sym">-></span><a href="class.upload.html#var$file_src_mime">file_src_mime</a><span class="src-sym">, </span><span class="src-var">$this</span><span class="src-sym">-></span><span class="src-var">image_supported</span><span class="src-sym">)) </span><span class="src-sym">{</span></div></li> <li><div class="src-line"><a name="a2778"></a> <span class="src-var">$this</span><span class="src-sym">-></span><span class="src-var">file_is_image </span>= <span class="src-id">true</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a2779"></a> <span class="src-var">$this</span><span class="src-sym">-></span><span class="src-var">image_src_type </span>= <span class="src-var">$this</span><span class="src-sym">-></span><span class="src-var">image_supported</span><span class="src-sym">[</span><span class="src-var">$this</span><span class="src-sym">-></span><a href="class.upload.html#var$file_src_mime">file_src_mime</a><span class="src-sym">]</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a2780"></a> <span class="src-sym">}</span></div></li> <li><div class="src-line"><a name="a2781"></a> </div></li> <li><div class="src-line"><a name="a2782"></a> <span class="src-comm">// if the file is an image, we gather some useful data</span></div></li> <li><div class="src-line"><a name="a2783"></a> <span class="src-key">if </span><span class="src-sym">(</span><span class="src-var">$this</span><span class="src-sym">-></span><span class="src-var">file_is_image</span><span class="src-sym">) </span><span class="src-sym">{</span></div></li> <li><div class="src-line"><a name="a2784"></a> <span class="src-key">if </span><span class="src-sym">(</span><span class="src-var">$h </span>= <a href="http://www.php.net/fopen">fopen</a><span class="src-sym">(</span><span class="src-var">$this</span><span class="src-sym">-></span><span class="src-var">file_src_pathname</span><span class="src-sym">, </span><span class="src-str">'r'</span><span class="src-sym">)) </span><span class="src-sym">{</span></div></li> <li><div class="src-line"><a name="a2785"></a> <a href="http://www.php.net/fclose">fclose</a><span class="src-sym">(</span><span class="src-var">$h</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a2786"></a> <span class="src-var">$info </span>= <a href="http://www.php.net/getimagesize">getimagesize</a><span class="src-sym">(</span><span class="src-var">$this</span><span class="src-sym">-></span><span class="src-var">file_src_pathname</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a2787"></a> <span class="src-key">if </span><span class="src-sym">(</span><a href="http://www.php.net/is_array">is_array</a><span class="src-sym">(</span><span class="src-var">$info</span><span class="src-sym">)) </span><span class="src-sym">{</span></div></li> <li><div class="src-line"><a name="a2788"></a> <span class="src-var">$this</span><span class="src-sym">-></span><span class="src-var">image_src_x </span>= <span class="src-var">$info</span><span class="src-sym">[</span><span class="src-num">0</span><span class="src-sym">]</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a2789"></a> <span class="src-var">$this</span><span class="src-sym">-></span><span class="src-var">image_src_y </span>= <span class="src-var">$info</span><span class="src-sym">[</span><span class="src-num">1</span><span class="src-sym">]</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a2790"></a> <span class="src-var">$this</span><span class="src-sym">-></span><span class="src-var">image_dst_x </span>= <span class="src-var">$this</span><span class="src-sym">-></span><span class="src-var">image_src_x</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a2791"></a> <span class="src-var">$this</span><span class="src-sym">-></span><span class="src-var">image_dst_y </span>= <span class="src-var">$this</span><span class="src-sym">-></span><span class="src-var">image_src_y</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a2792"></a> <span class="src-var">$this</span><span class="src-sym">-></span><span class="src-var">image_src_pixels </span>= <span class="src-var">$this</span><span class="src-sym">-></span><span class="src-var">image_src_x </span>* <span class="src-var">$this</span><span class="src-sym">-></span><span class="src-var">image_src_y</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a2793"></a> <span class="src-var">$this</span><span class="src-sym">-></span><span class="src-var">image_src_bits </span>= <a href="http://www.php.net/array_key_exists">array_key_exists</a><span class="src-sym">(</span><span class="src-str">'bits'</span><span class="src-sym">, </span><span class="src-var">$info</span><span class="src-sym">) </span>? <span class="src-var">$info</span><span class="src-sym">[</span><span class="src-str">'bits'</span><span class="src-sym">] </span>: <span class="src-id">null</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a2794"></a> <span class="src-sym">} </span><span class="src-key">else </span><span class="src-sym">{</span></div></li> <li><div class="src-line"><a name="a2795"></a> <span class="src-var">$this</span><span class="src-sym">-></span><span class="src-var">file_is_image </span>= <span class="src-id">false</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a2796"></a> <span class="src-var">$this</span><span class="src-sym">-></span><a href="class.upload.html#var$uploaded">uploaded</a> = <span class="src-id">false</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a2797"></a> <span class="src-var">$this</span><span class="src-sym">-></span><a href="class.upload.html#var$log">log</a> .= <span class="src-str">'- can\'t retrieve image information, image may have been tampered with<br />'</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a2798"></a> <span class="src-var">$this</span><span class="src-sym">-></span><a href="class.upload.html#var$error">error</a> = <span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id">translate</span><span class="src-sym">(</span><span class="src-str">'incorrect_file'</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a2799"></a> <span class="src-sym">}</span></div></li> <li><div class="src-line"><a name="a2800"></a> <span class="src-sym">} </span><span class="src-key">else </span><span class="src-sym">{</span></div></li> <li><div class="src-line"><a name="a2801"></a> <span class="src-var">$this</span><span class="src-sym">-></span><a href="class.upload.html#var$log">log</a> .= <span class="src-str">'- can\'t read source file directly. open_basedir restriction in place?<br />'</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a2802"></a> <span class="src-sym">}</span></div></li> <li><div class="src-line"><a name="a2803"></a> <span class="src-sym">}</span></div></li> <li><div class="src-line"><a name="a2804"></a> </div></li> <li><div class="src-line"><a name="a2805"></a> <span class="src-var">$this</span><span class="src-sym">-></span><a href="class.upload.html#var$log">log</a> .= <span class="src-str">'<b>source variables</b><br />'</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a2806"></a> <span class="src-var">$this</span><span class="src-sym">-></span><a href="class.upload.html#var$log">log</a> .= <span class="src-str">'- You can use all these before calling process()<br />'</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a2807"></a> <span class="src-var">$this</span><span class="src-sym">-></span><a href="class.upload.html#var$log">log</a> .= <span class="src-str">'&nbsp;&nbsp;&nbsp;&nbsp;file_src_name : ' </span>. <span class="src-var">$this</span><span class="src-sym">-></span><a href="class.upload.html#var$file_src_name">file_src_name</a> . <span class="src-str">'<br />'</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a2808"></a> <span class="src-var">$this</span><span class="src-sym">-></span><a href="class.upload.html#var$log">log</a> .= <span class="src-str">'&nbsp;&nbsp;&nbsp;&nbsp;file_src_name_body : ' </span>. <span class="src-var">$this</span><span class="src-sym">-></span><a href="class.upload.html#var$file_src_name_body">file_src_name_body</a> . <span class="src-str">'<br />'</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a2809"></a> <span class="src-var">$this</span><span class="src-sym">-></span><a href="class.upload.html#var$log">log</a> .= <span class="src-str">'&nbsp;&nbsp;&nbsp;&nbsp;file_src_name_ext : ' </span>. <span class="src-var">$this</span><span class="src-sym">-></span><a href="class.upload.html#var$file_src_name_ext">file_src_name_ext</a> . <span class="src-str">'<br />'</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a2810"></a> <span class="src-var">$this</span><span class="src-sym">-></span><a href="class.upload.html#var$log">log</a> .= <span class="src-str">'&nbsp;&nbsp;&nbsp;&nbsp;file_src_pathname : ' </span>. <span class="src-var">$this</span><span class="src-sym">-></span><span class="src-var">file_src_pathname </span>. <span class="src-str">'<br />'</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a2811"></a> <span class="src-var">$this</span><span class="src-sym">-></span><a href="class.upload.html#var$log">log</a> .= <span class="src-str">'&nbsp;&nbsp;&nbsp;&nbsp;file_src_mime : ' </span>. <span class="src-var">$this</span><span class="src-sym">-></span><a href="class.upload.html#var$file_src_mime">file_src_mime</a> . <span class="src-str">'<br />'</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a2812"></a> <span class="src-var">$this</span><span class="src-sym">-></span><a href="class.upload.html#var$log">log</a> .= <span class="src-str">'&nbsp;&nbsp;&nbsp;&nbsp;file_src_size : ' </span>. <span class="src-var">$this</span><span class="src-sym">-></span><a href="class.upload.html#var$file_src_size">file_src_size</a> . <span class="src-str">' (max= ' </span>. <span class="src-var">$this</span><span class="src-sym">-></span><a href="class.upload.html#var$file_max_size">file_max_size</a> . <span class="src-str">')<br />'</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a2813"></a> <span class="src-var">$this</span><span class="src-sym">-></span><a href="class.upload.html#var$log">log</a> .= <span class="src-str">'&nbsp;&nbsp;&nbsp;&nbsp;file_src_error : ' </span>. <span class="src-var">$this</span><span class="src-sym">-></span><a href="class.upload.html#var$file_src_error">file_src_error</a> . <span class="src-str">'<br />'</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a2814"></a> </div></li> <li><div class="src-line"><a name="a2815"></a> <span class="src-key">if </span><span class="src-sym">(</span><span class="src-var">$this</span><span class="src-sym">-></span><span class="src-var">file_is_image</span><span class="src-sym">) </span><span class="src-sym">{</span></div></li> <li><div class="src-line"><a name="a2816"></a> <span class="src-var">$this</span><span class="src-sym">-></span><a href="class.upload.html#var$log">log</a> .= <span class="src-str">'- source file is an image<br />'</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a2817"></a> <span class="src-var">$this</span><span class="src-sym">-></span><a href="class.upload.html#var$log">log</a> .= <span class="src-str">'&nbsp;&nbsp;&nbsp;&nbsp;image_src_x : ' </span>. <span class="src-var">$this</span><span class="src-sym">-></span><span class="src-var">image_src_x </span>. <span class="src-str">'<br />'</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a2818"></a> <span class="src-var">$this</span><span class="src-sym">-></span><a href="class.upload.html#var$log">log</a> .= <span class="src-str">'&nbsp;&nbsp;&nbsp;&nbsp;image_src_y : ' </span>. <span class="src-var">$this</span><span class="src-sym">-></span><span class="src-var">image_src_y </span>. <span class="src-str">'<br />'</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a2819"></a> <span class="src-var">$this</span><span class="src-sym">-></span><a href="class.upload.html#var$log">log</a> .= <span class="src-str">'&nbsp;&nbsp;&nbsp;&nbsp;image_src_pixels : ' </span>. <span class="src-var">$this</span><span class="src-sym">-></span><span class="src-var">image_src_pixels </span>. <span class="src-str">'<br />'</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a2820"></a> <span class="src-var">$this</span><span class="src-sym">-></span><a href="class.upload.html#var$log">log</a> .= <span class="src-str">'&nbsp;&nbsp;&nbsp;&nbsp;image_src_type : ' </span>. <span class="src-var">$this</span><span class="src-sym">-></span><span class="src-var">image_src_type </span>. <span class="src-str">'<br />'</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a2821"></a> <span class="src-var">$this</span><span class="src-sym">-></span><a href="class.upload.html#var$log">log</a> .= <span class="src-str">'&nbsp;&nbsp;&nbsp;&nbsp;image_src_bits : ' </span>. <span class="src-var">$this</span><span class="src-sym">-></span><span class="src-var">image_src_bits </span>. <span class="src-str">'<br />'</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a2822"></a> <span class="src-sym">}</span></div></li> <li><div class="src-line"><a name="a2823"></a> <span class="src-sym">}</span></div></li> <li><div class="src-line"><a name="a2824"></a> </div></li> <li><div class="src-line"><a name="a2825"></a> <span class="src-sym">}</span></div></li> <li><div class="src-line"><a name="a2826"></a> </div></li> <li><div class="src-line"><a name="a2827"></a> <span class="src-doc">/**</span></div></li> <li><div class="src-line"><a name="a2828"></a><span class="src-doc"> * Returns the version of GD</span></div></li> <li><div class="src-line"><a name="a2829"></a><span class="src-doc"> *</span></div></li> <li><div class="src-line"><a name="a2830"></a><span class="src-doc"> * </span><span class="src-doc-coretag">@access</span><span class="src-doc"> public</span></div></li> <li><div class="src-line"><a name="a2831"></a><span class="src-doc"> * </span><span class="src-doc-coretag">@param </span><span class="src-doc"> </span><span class="src-doc-type">boolean </span><span class="src-doc"> </span><span class="src-doc-var">$full </span><span class="src-doc">Optional flag to get precise version</span></div></li> <li><div class="src-line"><a name="a2832"></a><span class="src-doc"> * </span><span class="src-doc-coretag">@return </span><span class="src-doc-type">float </span><span class="src-doc">GD version</span></div></li> <li><div class="src-line"><a name="a2833"></a><span class="src-doc"> */</span></div></li> <li><div class="src-line"><a name="a2834"></a> <span class="src-key">function </span><a href="class.upload.html#methodgdversion">gdversion</a><span class="src-sym">(</span><span class="src-var">$full </span>= <span class="src-id">false</span><span class="src-sym">) </span><span class="src-sym">{</span></div></li> <li><div class="src-line"><a name="a2835"></a> <span class="src-key">static </span><span class="src-var">$gd_version </span>= <span class="src-id">null</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a2836"></a> <span class="src-key">static </span><span class="src-var">$gd_full_version </span>= <span class="src-id">null</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a2837"></a> <span class="src-key">if </span><span class="src-sym">(</span><span class="src-var">$gd_version </span>=== <span class="src-id">null</span><span class="src-sym">) </span><span class="src-sym">{</span></div></li> <li><div class="src-line"><a name="a2838"></a> <span class="src-key">if </span><span class="src-sym">(</span><span class="src-id">function_exists</span><span class="src-sym">(</span><span class="src-str">'gd_info'</span><span class="src-sym">)) </span><span class="src-sym">{</span></div></li> <li><div class="src-line"><a name="a2839"></a> <span class="src-var">$gd </span>= <span class="src-id">gd_info</span><span class="src-sym">(</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a2840"></a> <span class="src-var">$gd </span>= <span class="src-var">$gd</span><span class="src-sym">[</span><span class="src-str">"GD Version"</span><span class="src-sym">]</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a2841"></a> <span class="src-var">$regex </span>= <span class="src-str">"/([\d\.]+)/i"</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a2842"></a> <span class="src-sym">} </span><span class="src-key">else </span><span class="src-sym">{</span></div></li> <li><div class="src-line"><a name="a2843"></a> <span class="src-id">ob_start</span><span class="src-sym">(</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a2844"></a> <a href="http://www.php.net/phpinfo">phpinfo</a><span class="src-sym">(</span><span class="src-num">8</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a2845"></a> <span class="src-var">$gd </span>= <a href="http://www.php.net/ob_get_contents">ob_get_contents</a><span class="src-sym">(</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a2846"></a> <a href="http://www.php.net/ob_end_clean">ob_end_clean</a><span class="src-sym">(</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a2847"></a> <span class="src-var">$regex </span>= <span class="src-str">"/\bgd\s+version\b[^\d\n\r]+?([\d\.]+)/i"</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a2848"></a> <span class="src-sym">}</span></div></li> <li><div class="src-line"><a name="a2849"></a> <span class="src-key">if </span><span class="src-sym">(</span><span class="src-id">preg_match</span><span class="src-sym">(</span><span class="src-var">$regex</span><span class="src-sym">, </span><span class="src-var">$gd</span><span class="src-sym">, </span><span class="src-var">$m</span><span class="src-sym">)) </span><span class="src-sym">{</span></div></li> <li><div class="src-line"><a name="a2850"></a> <span class="src-var">$gd_full_version </span>= (string) <span class="src-var">$m</span><span class="src-sym">[</span><span class="src-num">1</span><span class="src-sym">]</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a2851"></a> <span class="src-var">$gd_version </span>= (float) <span class="src-var">$m</span><span class="src-sym">[</span><span class="src-num">1</span><span class="src-sym">]</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a2852"></a> <span class="src-sym">} </span><span class="src-key">else </span><span class="src-sym">{</span></div></li> <li><div class="src-line"><a name="a2853"></a> <span class="src-var">$gd_full_version </span>= <span class="src-str">'none'</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a2854"></a> <span class="src-var">$gd_version </span>= <span class="src-num">0</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a2855"></a> <span class="src-sym">}</span></div></li> <li><div class="src-line"><a name="a2856"></a> <span class="src-sym">}</span></div></li> <li><div class="src-line"><a name="a2857"></a> <span class="src-key">if </span><span class="src-sym">(</span><span class="src-var">$full</span><span class="src-sym">) </span><span class="src-sym">{</span></div></li> <li><div class="src-line"><a name="a2858"></a> <span class="src-key">return </span><span class="src-var">$gd_full_version</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a2859"></a> <span class="src-sym">} </span><span class="src-key">else </span><span class="src-sym">{</span></div></li> <li><div class="src-line"><a name="a2860"></a> <span class="src-key">return </span><span class="src-var">$gd_version</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a2861"></a> <span class="src-sym">}</span></div></li> <li><div class="src-line"><a name="a2862"></a> <span class="src-sym">}</span></div></li> <li><div class="src-line"><a name="a2863"></a> </div></li> <li><div class="src-line"><a name="a2864"></a> </div></li> <li><div class="src-line"><a name="a2865"></a> <span class="src-doc">/**</span></div></li> <li><div class="src-line"><a name="a2866"></a><span class="src-doc"> * Creates directories recursively</span></div></li> <li><div class="src-line"><a name="a2867"></a><span class="src-doc"> *</span></div></li> <li><div class="src-line"><a name="a2868"></a><span class="src-doc"> * </span><span class="src-doc-coretag">@access</span><span class="src-doc"> private</span></div></li> <li><div class="src-line"><a name="a2869"></a><span class="src-doc"> * </span><span class="src-doc-coretag">@param </span><span class="src-doc"> </span><span class="src-doc-type">string </span><span class="src-doc"> </span><span class="src-doc-var">$path </span><span class="src-doc">Path to create</span></div></li> <li><div class="src-line"><a name="a2870"></a><span class="src-doc"> * </span><span class="src-doc-coretag">@param </span><span class="src-doc"> </span><span class="src-doc-type">integer </span><span class="src-doc-var">$mode </span><span class="src-doc">Optional permissions</span></div></li> <li><div class="src-line"><a name="a2871"></a><span class="src-doc"> * </span><span class="src-doc-coretag">@return </span><span class="src-doc-type">boolean </span><span class="src-doc">Success</span></div></li> <li><div class="src-line"><a name="a2872"></a><span class="src-doc"> */</span></div></li> <li><div class="src-line"><a name="a2873"></a> <span class="src-key">function </span><span class="src-id">rmkdir</span><span class="src-sym">(</span><span class="src-var">$path</span><span class="src-sym">, </span><span class="src-var">$mode </span>= <span class="src-num">0777</span><span class="src-sym">) </span><span class="src-sym">{</span></div></li> <li><div class="src-line"><a name="a2874"></a> <span class="src-key">return </span><a href="http://www.php.net/is_dir">is_dir</a><span class="src-sym">(</span><span class="src-var">$path</span><span class="src-sym">) </span>|| <span class="src-sym">( </span><span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id">rmkdir</span><span class="src-sym">(</span><a href="http://www.php.net/dirname">dirname</a><span class="src-sym">(</span><span class="src-var">$path</span><span class="src-sym">)</span><span class="src-sym">, </span><span class="src-var">$mode</span><span class="src-sym">) </span>&& <span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id">_mkdir</span><span class="src-sym">(</span><span class="src-var">$path</span><span class="src-sym">, </span><span class="src-var">$mode</span><span class="src-sym">) )</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a2875"></a> <span class="src-sym">}</span></div></li> <li><div class="src-line"><a name="a2876"></a> </div></li> <li><div class="src-line"><a name="a2877"></a> </div></li> <li><div class="src-line"><a name="a2878"></a> <span class="src-doc">/**</span></div></li> <li><div class="src-line"><a name="a2879"></a><span class="src-doc"> * Creates directory</span></div></li> <li><div class="src-line"><a name="a2880"></a><span class="src-doc"> *</span></div></li> <li><div class="src-line"><a name="a2881"></a><span class="src-doc"> * </span><span class="src-doc-coretag">@access</span><span class="src-doc"> private</span></div></li> <li><div class="src-line"><a name="a2882"></a><span class="src-doc"> * </span><span class="src-doc-coretag">@param </span><span class="src-doc"> </span><span class="src-doc-type">string </span><span class="src-doc"> </span><span class="src-doc-var">$path </span><span class="src-doc">Path to create</span></div></li> <li><div class="src-line"><a name="a2883"></a><span class="src-doc"> * </span><span class="src-doc-coretag">@param </span><span class="src-doc"> </span><span class="src-doc-type">integer </span><span class="src-doc-var">$mode </span><span class="src-doc">Optional permissions</span></div></li> <li><div class="src-line"><a name="a2884"></a><span class="src-doc"> * </span><span class="src-doc-coretag">@return </span><span class="src-doc-type">boolean </span><span class="src-doc">Success</span></div></li> <li><div class="src-line"><a name="a2885"></a><span class="src-doc"> */</span></div></li> <li><div class="src-line"><a name="a2886"></a> <span class="src-key">function </span><span class="src-id">_mkdir</span><span class="src-sym">(</span><span class="src-var">$path</span><span class="src-sym">, </span><span class="src-var">$mode </span>= <span class="src-num">0777</span><span class="src-sym">) </span><span class="src-sym">{</span></div></li> <li><div class="src-line"><a name="a2887"></a> <span class="src-var">$old </span>= <a href="http://www.php.net/umask">umask</a><span class="src-sym">(</span><span class="src-num">0</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a2888"></a> <span class="src-var">$res </span>= <span class="src-sym">@</span><a href="http://www.php.net/mkdir">mkdir</a><span class="src-sym">(</span><span class="src-var">$path</span><span class="src-sym">, </span><span class="src-var">$mode</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a2889"></a> <a href="http://www.php.net/umask">umask</a><span class="src-sym">(</span><span class="src-var">$old</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a2890"></a> <span class="src-key">return </span><span class="src-var">$res</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a2891"></a> <span class="src-sym">}</span></div></li> <li><div class="src-line"><a name="a2892"></a> </div></li> <li><div class="src-line"><a name="a2893"></a> </div></li> <li><div class="src-line"><a name="a2894"></a> <span class="src-doc">/**</span></div></li> <li><div class="src-line"><a name="a2895"></a><span class="src-doc"> * Translate error messages</span></div></li> <li><div class="src-line"><a name="a2896"></a><span class="src-doc"> *</span></div></li> <li><div class="src-line"><a name="a2897"></a><span class="src-doc"> * </span><span class="src-doc-coretag">@access</span><span class="src-doc"> private</span></div></li> <li><div class="src-line"><a name="a2898"></a><span class="src-doc"> * </span><span class="src-doc-coretag">@param </span><span class="src-doc"> </span><span class="src-doc-type">string </span><span class="src-doc"> </span><span class="src-doc-var">$str </span><span class="src-doc"> Message to translate</span></div></li> <li><div class="src-line"><a name="a2899"></a><span class="src-doc"> * </span><span class="src-doc-coretag">@param </span><span class="src-doc"> </span><span class="src-doc-type">array </span><span class="src-doc"> </span><span class="src-doc-var">$tokens </span><span class="src-doc">Optional token values</span></div></li> <li><div class="src-line"><a name="a2900"></a><span class="src-doc"> * </span><span class="src-doc-coretag">@return </span><span class="src-doc-type">string </span><span class="src-doc">Translated string</span></div></li> <li><div class="src-line"><a name="a2901"></a><span class="src-doc"> */</span></div></li> <li><div class="src-line"><a name="a2902"></a> <span class="src-key">function </span><span class="src-id">translate</span><span class="src-sym">(</span><span class="src-var">$str</span><span class="src-sym">, </span><span class="src-var">$tokens </span>= <span class="src-key">array</span><span class="src-sym">(</span><span class="src-sym">)) </span><span class="src-sym">{</span></div></li> <li><div class="src-line"><a name="a2903"></a> <span class="src-key">if </span><span class="src-sym">(</span><a href="http://www.php.net/array_key_exists">array_key_exists</a><span class="src-sym">(</span><span class="src-var">$str</span><span class="src-sym">, </span><span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id"><a href="class.upload.html#var$translation">translation</a></span><span class="src-sym">)) </span><span class="src-var">$str </span>= <span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id"><a href="class.upload.html#var$translation">translation</a></span><span class="src-sym">[</span><span class="src-var">$str</span><span class="src-sym">]</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a2904"></a> <span class="src-key">if </span><span class="src-sym">(</span><a href="http://www.php.net/is_array">is_array</a><span class="src-sym">(</span><span class="src-var">$tokens</span><span class="src-sym">) </span>&& <a href="http://www.php.net/sizeof">sizeof</a><span class="src-sym">(</span><span class="src-var">$tokens</span><span class="src-sym">) </span>> <span class="src-num">0</span><span class="src-sym">) </span><span class="src-var">$str </span>= <a href="http://www.php.net/vsprintf">vsprintf</a><span class="src-sym">(</span><span class="src-var">$str</span><span class="src-sym">, </span><span class="src-var">$tokens</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a2905"></a> <span class="src-key">return </span><span class="src-var">$str</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a2906"></a> <span class="src-sym">}</span></div></li> <li><div class="src-line"><a name="a2907"></a> </div></li> <li><div class="src-line"><a name="a2908"></a> <span class="src-doc">/**</span></div></li> <li><div class="src-line"><a name="a2909"></a><span class="src-doc"> * Decodes colors</span></div></li> <li><div class="src-line"><a name="a2910"></a><span class="src-doc"> *</span></div></li> <li><div class="src-line"><a name="a2911"></a><span class="src-doc"> * </span><span class="src-doc-coretag">@access</span><span class="src-doc"> private</span></div></li> <li><div class="src-line"><a name="a2912"></a><span class="src-doc"> * </span><span class="src-doc-coretag">@param </span><span class="src-doc"> </span><span class="src-doc-type">string </span><span class="src-doc"> </span><span class="src-doc-var">$color </span><span class="src-doc"> Color string</span></div></li> <li><div class="src-line"><a name="a2913"></a><span class="src-doc"> * </span><span class="src-doc-coretag">@return </span><span class="src-doc-type">array </span><span class="src-doc">RGB colors</span></div></li> <li><div class="src-line"><a name="a2914"></a><span class="src-doc"> */</span></div></li> <li><div class="src-line"><a name="a2915"></a> <span class="src-key">function </span><span class="src-id">getcolors</span><span class="src-sym">(</span><span class="src-var">$color</span><span class="src-sym">) </span><span class="src-sym">{</span></div></li> <li><div class="src-line"><a name="a2916"></a> <span class="src-var">$r </span>= <a href="http://www.php.net/sscanf">sscanf</a><span class="src-sym">(</span><span class="src-var">$color</span><span class="src-sym">, </span><span class="src-str">"#%2x%2x%2x"</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a2917"></a> <span class="src-var">$red </span>= <span class="src-sym">(</span><a href="http://www.php.net/array_key_exists">array_key_exists</a><span class="src-sym">(</span><span class="src-num">0</span><span class="src-sym">, </span><span class="src-var">$r</span><span class="src-sym">) </span>&& <a href="http://www.php.net/is_numeric">is_numeric</a><span class="src-sym">(</span><span class="src-var">$r</span><span class="src-sym">[</span><span class="src-num">0</span><span class="src-sym">]</span><span class="src-sym">) </span>? <span class="src-var">$r</span><span class="src-sym">[</span><span class="src-num">0</span><span class="src-sym">] </span>: <span class="src-num">0</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a2918"></a> <span class="src-var">$green </span>= <span class="src-sym">(</span><a href="http://www.php.net/array_key_exists">array_key_exists</a><span class="src-sym">(</span><span class="src-num">1</span><span class="src-sym">, </span><span class="src-var">$r</span><span class="src-sym">) </span>&& <a href="http://www.php.net/is_numeric">is_numeric</a><span class="src-sym">(</span><span class="src-var">$r</span><span class="src-sym">[</span><span class="src-num">1</span><span class="src-sym">]</span><span class="src-sym">) </span>? <span class="src-var">$r</span><span class="src-sym">[</span><span class="src-num">1</span><span class="src-sym">] </span>: <span class="src-num">0</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a2919"></a> <span class="src-var">$blue </span>= <span class="src-sym">(</span><a href="http://www.php.net/array_key_exists">array_key_exists</a><span class="src-sym">(</span><span class="src-num">2</span><span class="src-sym">, </span><span class="src-var">$r</span><span class="src-sym">) </span>&& <a href="http://www.php.net/is_numeric">is_numeric</a><span class="src-sym">(</span><span class="src-var">$r</span><span class="src-sym">[</span><span class="src-num">2</span><span class="src-sym">]</span><span class="src-sym">) </span>? <span class="src-var">$r</span><span class="src-sym">[</span><span class="src-num">2</span><span class="src-sym">] </span>: <span class="src-num">0</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a2920"></a> <span class="src-key">return </span><span class="src-key">array</span><span class="src-sym">(</span><span class="src-var">$red</span><span class="src-sym">, </span><span class="src-var">$green</span><span class="src-sym">, </span><span class="src-var">$blue</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a2921"></a> <span class="src-sym">}</span></div></li> <li><div class="src-line"><a name="a2922"></a> </div></li> <li><div class="src-line"><a name="a2923"></a> <span class="src-doc">/**</span></div></li> <li><div class="src-line"><a name="a2924"></a><span class="src-doc"> * Creates a container image</span></div></li> <li><div class="src-line"><a name="a2925"></a><span class="src-doc"> *</span></div></li> <li><div class="src-line"><a name="a2926"></a><span class="src-doc"> * </span><span class="src-doc-coretag">@access</span><span class="src-doc"> private</span></div></li> <li><div class="src-line"><a name="a2927"></a><span class="src-doc"> * </span><span class="src-doc-coretag">@param </span><span class="src-doc"> </span><span class="src-doc-type">integer </span><span class="src-doc"> </span><span class="src-doc-var">$x </span><span class="src-doc"> Width</span></div></li> <li><div class="src-line"><a name="a2928"></a><span class="src-doc"> * </span><span class="src-doc-coretag">@param </span><span class="src-doc"> </span><span class="src-doc-type">integer </span><span class="src-doc"> </span><span class="src-doc-var">$y </span><span class="src-doc"> Height</span></div></li> <li><div class="src-line"><a name="a2929"></a><span class="src-doc"> * </span><span class="src-doc-coretag">@param </span><span class="src-doc"> </span><span class="src-doc-type">boolean </span><span class="src-doc"> </span><span class="src-doc-var">$fill </span><span class="src-doc">Optional flag to draw the background color or not</span></div></li> <li><div class="src-line"><a name="a2930"></a><span class="src-doc"> * </span><span class="src-doc-coretag">@param </span><span class="src-doc"> </span><span class="src-doc-type">boolean </span><span class="src-doc"> </span><span class="src-doc-var">$trsp </span><span class="src-doc">Optional flag to set the background to be transparent</span></div></li> <li><div class="src-line"><a name="a2931"></a><span class="src-doc"> * </span><span class="src-doc-coretag">@return </span><span class="src-doc-type">resource </span><span class="src-doc">Container image</span></div></li> <li><div class="src-line"><a name="a2932"></a><span class="src-doc"> */</span></div></li> <li><div class="src-line"><a name="a2933"></a> <span class="src-key">function </span><span class="src-id">imagecreatenew</span><span class="src-sym">(</span><span class="src-var">$x</span><span class="src-sym">, </span><span class="src-var">$y</span><span class="src-sym">, </span><span class="src-var">$fill </span>= <span class="src-id">true</span><span class="src-sym">, </span><span class="src-var">$trsp </span>= <span class="src-id">false</span><span class="src-sym">) </span><span class="src-sym">{</span></div></li> <li><div class="src-line"><a name="a2934"></a> <span class="src-key">if </span><span class="src-sym">(</span><span class="src-var">$x </span>< <span class="src-num">1</span><span class="src-sym">) </span><span class="src-var">$x </span>= <span class="src-num">1</span><span class="src-sym">; </span><span class="src-key">if </span><span class="src-sym">(</span><span class="src-var">$y </span>< <span class="src-num">1</span><span class="src-sym">) </span><span class="src-var">$y </span>= <span class="src-num">1</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a2935"></a> <span class="src-key">if </span><span class="src-sym">(</span><span class="src-var">$this</span><span class="src-sym">-></span><a href="class.upload.html#methodgdversion">gdversion</a><span class="src-sym">(</span><span class="src-sym">) </span>>= <span class="src-num">2 </span>&& <span class="src-sym">!</span><span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id"><a href="class.upload.html#var$image_is_palette">image_is_palette</a></span><span class="src-sym">) </span><span class="src-sym">{</span></div></li> <li><div class="src-line"><a name="a2936"></a> <span class="src-comm">// create a true color image</span></div></li> <li><div class="src-line"><a name="a2937"></a> <span class="src-var">$dst_im </span>= <a href="http://www.php.net/imagecreatetruecolor">imagecreatetruecolor</a><span class="src-sym">(</span><span class="src-var">$x</span><span class="src-sym">, </span><span class="src-var">$y</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a2938"></a> <span class="src-comm">// this preserves transparency in PNGs, in true color</span></div></li> <li><div class="src-line"><a name="a2939"></a> <span class="src-key">if </span><span class="src-sym">(</span><span class="src-key">empty</span><span class="src-sym">(</span><span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id"><a href="class.upload.html#var$image_background_color">image_background_color</a></span><span class="src-sym">) </span>|| <span class="src-var">$trsp</span><span class="src-sym">) </span><span class="src-sym">{</span></div></li> <li><div class="src-line"><a name="a2940"></a> <a href="http://www.php.net/imagealphablending">imagealphablending</a><span class="src-sym">(</span><span class="src-var">$dst_im</span><span class="src-sym">, </span><span class="src-id">false </span><span class="src-sym">)</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a2941"></a> <a href="http://www.php.net/imagefilledrectangle">imagefilledrectangle</a><span class="src-sym">(</span><span class="src-var">$dst_im</span><span class="src-sym">, </span><span class="src-num">0</span><span class="src-sym">, </span><span class="src-num">0</span><span class="src-sym">, </span><span class="src-var">$x</span><span class="src-sym">, </span><span class="src-var">$y</span><span class="src-sym">, </span><a href="http://www.php.net/imagecolorallocatealpha">imagecolorallocatealpha</a><span class="src-sym">(</span><span class="src-var">$dst_im</span><span class="src-sym">, </span><span class="src-num">0</span><span class="src-sym">, </span><span class="src-num">0</span><span class="src-sym">, </span><span class="src-num">0</span><span class="src-sym">, </span><span class="src-num">127</span><span class="src-sym">))</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a2942"></a> <span class="src-sym">}</span></div></li> <li><div class="src-line"><a name="a2943"></a> <span class="src-sym">} </span><span class="src-key">else </span><span class="src-sym">{</span></div></li> <li><div class="src-line"><a name="a2944"></a> <span class="src-comm">// creates a palette image</span></div></li> <li><div class="src-line"><a name="a2945"></a> <span class="src-var">$dst_im </span>= <a href="http://www.php.net/imagecreate">imagecreate</a><span class="src-sym">(</span><span class="src-var">$x</span><span class="src-sym">, </span><span class="src-var">$y</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a2946"></a> <span class="src-comm">// preserves transparency for palette images, if the original image has transparency</span></div></li> <li><div class="src-line"><a name="a2947"></a> <span class="src-key">if </span><span class="src-sym">((</span><span class="src-var">$fill </span>&& <span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id"><a href="class.upload.html#var$image_is_transparent">image_is_transparent</a> </span>&& <span class="src-key">empty</span><span class="src-sym">(</span><span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id"><a href="class.upload.html#var$image_background_color">image_background_color</a></span><span class="src-sym">)) </span>|| <span class="src-var">$trsp</span><span class="src-sym">) </span><span class="src-sym">{</span></div></li> <li><div class="src-line"><a name="a2948"></a> <a href="http://www.php.net/imagefilledrectangle">imagefilledrectangle</a><span class="src-sym">(</span><span class="src-var">$dst_im</span><span class="src-sym">, </span><span class="src-num">0</span><span class="src-sym">, </span><span class="src-num">0</span><span class="src-sym">, </span><span class="src-var">$x</span><span class="src-sym">, </span><span class="src-var">$y</span><span class="src-sym">, </span><span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id"><a href="class.upload.html#var$image_transparent_color">image_transparent_color</a></span><span class="src-sym">)</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a2949"></a> <a href="http://www.php.net/imagecolortransparent">imagecolortransparent</a><span class="src-sym">(</span><span class="src-var">$dst_im</span><span class="src-sym">, </span><span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id"><a href="class.upload.html#var$image_transparent_color">image_transparent_color</a></span><span class="src-sym">)</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a2950"></a> <span class="src-sym">}</span></div></li> <li><div class="src-line"><a name="a2951"></a> <span class="src-sym">}</span></div></li> <li><div class="src-line"><a name="a2952"></a> <span class="src-comm">// fills with background color if any is set</span></div></li> <li><div class="src-line"><a name="a2953"></a> <span class="src-key">if </span><span class="src-sym">(</span><span class="src-var">$fill </span>&& <span class="src-sym">!</span><span class="src-key">empty</span><span class="src-sym">(</span><span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id"><a href="class.upload.html#var$image_background_color">image_background_color</a></span><span class="src-sym">) </span>&& <span class="src-sym">!</span><span class="src-var">$trsp</span><span class="src-sym">) </span><span class="src-sym">{</span></div></li> <li><div class="src-line"><a name="a2954"></a> list<span class="src-sym">(</span><span class="src-var">$red</span><span class="src-sym">, </span><span class="src-var">$green</span><span class="src-sym">, </span><span class="src-var">$blue</span><span class="src-sym">) </span>= <span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id">getcolors</span><span class="src-sym">(</span><span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id"><a href="class.upload.html#var$image_background_color">image_background_color</a></span><span class="src-sym">)</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a2955"></a> <span class="src-var">$background_color </span>= <a href="http://www.php.net/imagecolorallocate">imagecolorallocate</a><span class="src-sym">(</span><span class="src-var">$dst_im</span><span class="src-sym">, </span><span class="src-var">$red</span><span class="src-sym">, </span><span class="src-var">$green</span><span class="src-sym">, </span><span class="src-var">$blue</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a2956"></a> <a href="http://www.php.net/imagefilledrectangle">imagefilledrectangle</a><span class="src-sym">(</span><span class="src-var">$dst_im</span><span class="src-sym">, </span><span class="src-num">0</span><span class="src-sym">, </span><span class="src-num">0</span><span class="src-sym">, </span><span class="src-var">$x</span><span class="src-sym">, </span><span class="src-var">$y</span><span class="src-sym">, </span><span class="src-var">$background_color</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a2957"></a> <span class="src-sym">}</span></div></li> <li><div class="src-line"><a name="a2958"></a> <span class="src-key">return </span><span class="src-var">$dst_im</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a2959"></a> <span class="src-sym">}</span></div></li> <li><div class="src-line"><a name="a2960"></a> </div></li> <li><div class="src-line"><a name="a2961"></a> </div></li> <li><div class="src-line"><a name="a2962"></a> <span class="src-doc">/**</span></div></li> <li><div class="src-line"><a name="a2963"></a><span class="src-doc"> * Transfers an image from the container to the destination image</span></div></li> <li><div class="src-line"><a name="a2964"></a><span class="src-doc"> *</span></div></li> <li><div class="src-line"><a name="a2965"></a><span class="src-doc"> * </span><span class="src-doc-coretag">@access</span><span class="src-doc"> private</span></div></li> <li><div class="src-line"><a name="a2966"></a><span class="src-doc"> * </span><span class="src-doc-coretag">@param </span><span class="src-doc"> </span><span class="src-doc-type">resource </span><span class="src-doc-var">$src_im </span><span class="src-doc">Container image</span></div></li> <li><div class="src-line"><a name="a2967"></a><span class="src-doc"> * </span><span class="src-doc-coretag">@param </span><span class="src-doc"> </span><span class="src-doc-type">resource </span><span class="src-doc-var">$dst_im </span><span class="src-doc">Destination image</span></div></li> <li><div class="src-line"><a name="a2968"></a><span class="src-doc"> * </span><span class="src-doc-coretag">@return </span><span class="src-doc-type">resource </span><span class="src-doc">Destination image</span></div></li> <li><div class="src-line"><a name="a2969"></a><span class="src-doc"> */</span></div></li> <li><div class="src-line"><a name="a2970"></a> <span class="src-key">function </span><span class="src-id">imagetransfer</span><span class="src-sym">(</span><span class="src-var">$src_im</span><span class="src-sym">, </span><span class="src-var">$dst_im</span><span class="src-sym">) </span><span class="src-sym">{</span></div></li> <li><div class="src-line"><a name="a2971"></a> <span class="src-key">if </span><span class="src-sym">(</span><a href="http://www.php.net/is_resource">is_resource</a><span class="src-sym">(</span><span class="src-var">$dst_im</span><span class="src-sym">)) </span><a href="http://www.php.net/imagedestroy">imagedestroy</a><span class="src-sym">(</span><span class="src-var">$dst_im</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a2972"></a> <span class="src-var">$dst_im </span>= <span class="src-sym">& </span><span class="src-var">$src_im</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a2973"></a> <span class="src-key">return </span><span class="src-var">$dst_im</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a2974"></a> <span class="src-sym">}</span></div></li> <li><div class="src-line"><a name="a2975"></a> </div></li> <li><div class="src-line"><a name="a2976"></a> <span class="src-doc">/**</span></div></li> <li><div class="src-line"><a name="a2977"></a><span class="src-doc"> * Merges two images</span></div></li> <li><div class="src-line"><a name="a2978"></a><span class="src-doc"> *</span></div></li> <li><div class="src-line"><a name="a2979"></a><span class="src-doc"> * If the output format is PNG, then we do it pixel per pixel to retain the alpha channel</span></div></li> <li><div class="src-line"><a name="a2980"></a><span class="src-doc"> *</span></div></li> <li><div class="src-line"><a name="a2981"></a><span class="src-doc"> * </span><span class="src-doc-coretag">@access</span><span class="src-doc"> private</span></div></li> <li><div class="src-line"><a name="a2982"></a><span class="src-doc"> * </span><span class="src-doc-coretag">@param </span><span class="src-doc"> </span><span class="src-doc-type">resource </span><span class="src-doc-var">$dst_img </span><span class="src-doc">Destination image</span></div></li> <li><div class="src-line"><a name="a2983"></a><span class="src-doc"> * </span><span class="src-doc-coretag">@param </span><span class="src-doc"> </span><span class="src-doc-type">resource </span><span class="src-doc-var">$src_img </span><span class="src-doc">Overlay image</span></div></li> <li><div class="src-line"><a name="a2984"></a><span class="src-doc"> * </span><span class="src-doc-coretag">@param </span><span class="src-doc"> </span><span class="src-doc-type">int </span><span class="src-doc"> </span><span class="src-doc-var">$dst_x </span><span class="src-doc"> x-coordinate of destination point</span></div></li> <li><div class="src-line"><a name="a2985"></a><span class="src-doc"> * </span><span class="src-doc-coretag">@param </span><span class="src-doc"> </span><span class="src-doc-type">int </span><span class="src-doc"> </span><span class="src-doc-var">$dst_y </span><span class="src-doc"> y-coordinate of destination point</span></div></li> <li><div class="src-line"><a name="a2986"></a><span class="src-doc"> * </span><span class="src-doc-coretag">@param </span><span class="src-doc"> </span><span class="src-doc-type">int </span><span class="src-doc"> </span><span class="src-doc-var">$src_x </span><span class="src-doc"> x-coordinate of source point</span></div></li> <li><div class="src-line"><a name="a2987"></a><span class="src-doc"> * </span><span class="src-doc-coretag">@param </span><span class="src-doc"> </span><span class="src-doc-type">int </span><span class="src-doc"> </span><span class="src-doc-var">$src_y </span><span class="src-doc"> y-coordinate of source point</span></div></li> <li><div class="src-line"><a name="a2988"></a><span class="src-doc"> * </span><span class="src-doc-coretag">@param </span><span class="src-doc"> </span><span class="src-doc-type">int </span><span class="src-doc"> </span><span class="src-doc-var">$src_w </span><span class="src-doc"> Source width</span></div></li> <li><div class="src-line"><a name="a2989"></a><span class="src-doc"> * </span><span class="src-doc-coretag">@param </span><span class="src-doc"> </span><span class="src-doc-type">int </span><span class="src-doc"> </span><span class="src-doc-var">$src_h </span><span class="src-doc"> Source height</span></div></li> <li><div class="src-line"><a name="a2990"></a><span class="src-doc"> * </span><span class="src-doc-coretag">@param </span><span class="src-doc"> </span><span class="src-doc-type">int </span><span class="src-doc"> </span><span class="src-doc-var">$pct </span><span class="src-doc"> Optional percentage of the overlay, between 0 and 100 (default: 100)</span></div></li> <li><div class="src-line"><a name="a2991"></a><span class="src-doc"> * </span><span class="src-doc-coretag">@return </span><span class="src-doc-type">resource </span><span class="src-doc">Destination image</span></div></li> <li><div class="src-line"><a name="a2992"></a><span class="src-doc"> */</span></div></li> <li><div class="src-line"><a name="a2993"></a> <span class="src-key">function </span><span class="src-id">imagecopymergealpha</span><span class="src-sym">(</span><span class="src-sym">&</span><span class="src-var">$dst_im</span><span class="src-sym">, </span><span class="src-sym">&</span><span class="src-var">$src_im</span><span class="src-sym">, </span><span class="src-var">$dst_x</span><span class="src-sym">, </span><span class="src-var">$dst_y</span><span class="src-sym">, </span><span class="src-var">$src_x</span><span class="src-sym">, </span><span class="src-var">$src_y</span><span class="src-sym">, </span><span class="src-var">$src_w</span><span class="src-sym">, </span><span class="src-var">$src_h</span><span class="src-sym">, </span><span class="src-var">$pct </span>= <span class="src-num">0</span><span class="src-sym">) </span><span class="src-sym">{</span></div></li> <li><div class="src-line"><a name="a2994"></a> <span class="src-var">$dst_x </span>= (int) <span class="src-var">$dst_x</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a2995"></a> <span class="src-var">$dst_y </span>= (int) <span class="src-var">$dst_y</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a2996"></a> <span class="src-var">$src_x </span>= (int) <span class="src-var">$src_x</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a2997"></a> <span class="src-var">$src_y </span>= (int) <span class="src-var">$src_y</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a2998"></a> <span class="src-var">$src_w </span>= (int) <span class="src-var">$src_w</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a2999"></a> <span class="src-var">$src_h </span>= (int) <span class="src-var">$src_h</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a3000"></a> <span class="src-var">$pct </span>= (int) <span class="src-var">$pct</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a3001"></a> <span class="src-var">$dst_w </span>= <a href="http://www.php.net/imagesx">imagesx</a><span class="src-sym">(</span><span class="src-var">$dst_im</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a3002"></a> <span class="src-var">$dst_h </span>= <a href="http://www.php.net/imagesy">imagesy</a><span class="src-sym">(</span><span class="src-var">$dst_im</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a3003"></a> </div></li> <li><div class="src-line"><a name="a3004"></a> <span class="src-key">for </span><span class="src-sym">(</span><span class="src-var">$y </span>= <span class="src-var">$src_y</span><span class="src-sym">; </span><span class="src-var">$y </span>< <span class="src-var">$src_h</span><span class="src-sym">; </span><span class="src-var">$y</span>++<span class="src-sym">) </span><span class="src-sym">{</span></div></li> <li><div class="src-line"><a name="a3005"></a> <span class="src-key">for </span><span class="src-sym">(</span><span class="src-var">$x </span>= <span class="src-var">$src_x</span><span class="src-sym">; </span><span class="src-var">$x </span>< <span class="src-var">$src_w</span><span class="src-sym">; </span><span class="src-var">$x</span>++<span class="src-sym">) </span><span class="src-sym">{</span></div></li> <li><div class="src-line"><a name="a3006"></a> </div></li> <li><div class="src-line"><a name="a3007"></a> <span class="src-key">if </span><span class="src-sym">(</span><span class="src-var">$x </span>+ <span class="src-var">$dst_x </span>>= <span class="src-num">0 </span>&& <span class="src-var">$x </span>+ <span class="src-var">$dst_x </span>< <span class="src-var">$dst_w </span>&& <span class="src-var">$x </span>+ <span class="src-var">$src_x </span>>= <span class="src-num">0 </span>&& <span class="src-var">$x </span>+ <span class="src-var">$src_x </span>< <span class="src-var">$src_w</span></div></li> <li><div class="src-line"><a name="a3008"></a> && <span class="src-var">$y </span>+ <span class="src-var">$dst_y </span>>= <span class="src-num">0 </span>&& <span class="src-var">$y </span>+ <span class="src-var">$dst_y </span>< <span class="src-var">$dst_h </span>&& <span class="src-var">$y </span>+ <span class="src-var">$src_y </span>>= <span class="src-num">0 </span>&& <span class="src-var">$y </span>+ <span class="src-var">$src_y </span>< <span class="src-var">$src_h</span><span class="src-sym">) </span><span class="src-sym">{</span></div></li> <li><div class="src-line"><a name="a3009"></a> </div></li> <li><div class="src-line"><a name="a3010"></a> <span class="src-var">$dst_pixel </span>= <a href="http://www.php.net/imagecolorsforindex">imagecolorsforindex</a><span class="src-sym">(</span><span class="src-var">$dst_im</span><span class="src-sym">, </span><a href="http://www.php.net/imagecolorat">imagecolorat</a><span class="src-sym">(</span><span class="src-var">$dst_im</span><span class="src-sym">, </span><span class="src-var">$x </span>+ <span class="src-var">$dst_x</span><span class="src-sym">, </span><span class="src-var">$y </span>+ <span class="src-var">$dst_y</span><span class="src-sym">))</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a3011"></a> <span class="src-var">$src_pixel </span>= <a href="http://www.php.net/imagecolorsforindex">imagecolorsforindex</a><span class="src-sym">(</span><span class="src-var">$src_im</span><span class="src-sym">, </span><a href="http://www.php.net/imagecolorat">imagecolorat</a><span class="src-sym">(</span><span class="src-var">$src_im</span><span class="src-sym">, </span><span class="src-var">$x </span>+ <span class="src-var">$src_x</span><span class="src-sym">, </span><span class="src-var">$y </span>+ <span class="src-var">$src_y</span><span class="src-sym">))</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a3012"></a> </div></li> <li><div class="src-line"><a name="a3013"></a> <span class="src-var">$src_alpha </span>= <span class="src-num">1 </span>- <span class="src-sym">(</span><span class="src-var">$src_pixel</span><span class="src-sym">[</span><span class="src-str">'alpha'</span><span class="src-sym">] </span>/ <span class="src-num">127</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a3014"></a> <span class="src-var">$dst_alpha </span>= <span class="src-num">1 </span>- <span class="src-sym">(</span><span class="src-var">$dst_pixel</span><span class="src-sym">[</span><span class="src-str">'alpha'</span><span class="src-sym">] </span>/ <span class="src-num">127</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a3015"></a> <span class="src-var">$opacity </span>= <span class="src-var">$src_alpha </span>* <span class="src-var">$pct </span>/ <span class="src-num">100</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a3016"></a> <span class="src-key">if </span><span class="src-sym">(</span><span class="src-var">$dst_alpha </span>>= <span class="src-var">$opacity</span><span class="src-sym">) </span><span class="src-var">$alpha </span>= <span class="src-var">$dst_alpha</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a3017"></a> <span class="src-key">if </span><span class="src-sym">(</span><span class="src-var">$dst_alpha </span>< <span class="src-var">$opacity</span><span class="src-sym">) </span><span class="src-var">$alpha </span>= <span class="src-var">$opacity</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a3018"></a> <span class="src-key">if </span><span class="src-sym">(</span><span class="src-var">$alpha </span>> <span class="src-num">1</span><span class="src-sym">) </span><span class="src-var">$alpha </span>= <span class="src-num">1</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a3019"></a> </div></li> <li><div class="src-line"><a name="a3020"></a> <span class="src-key">if </span><span class="src-sym">(</span><span class="src-var">$opacity </span>> <span class="src-num">0</span><span class="src-sym">) </span><span class="src-sym">{</span></div></li> <li><div class="src-line"><a name="a3021"></a> <span class="src-var">$dst_red </span>= <a href="http://www.php.net/round">round</a><span class="src-sym">(( (</span><span class="src-var">$dst_pixel</span><span class="src-sym">[</span><span class="src-str">'red'</span><span class="src-sym">] </span>* <span class="src-var">$dst_alpha </span>* <span class="src-sym">(</span><span class="src-num">1 </span>- <span class="src-var">$opacity</span><span class="src-sym">)) ) )</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a3022"></a> <span class="src-var">$dst_green </span>= <a href="http://www.php.net/round">round</a><span class="src-sym">(( (</span><span class="src-var">$dst_pixel</span><span class="src-sym">[</span><span class="src-str">'green'</span><span class="src-sym">] </span>* <span class="src-var">$dst_alpha </span>* <span class="src-sym">(</span><span class="src-num">1 </span>- <span class="src-var">$opacity</span><span class="src-sym">)) ) )</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a3023"></a> <span class="src-var">$dst_blue </span>= <a href="http://www.php.net/round">round</a><span class="src-sym">(( (</span><span class="src-var">$dst_pixel</span><span class="src-sym">[</span><span class="src-str">'blue'</span><span class="src-sym">] </span>* <span class="src-var">$dst_alpha </span>* <span class="src-sym">(</span><span class="src-num">1 </span>- <span class="src-var">$opacity</span><span class="src-sym">)) ) )</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a3024"></a> <span class="src-var">$src_red </span>= <a href="http://www.php.net/round">round</a><span class="src-sym">(((</span><span class="src-var">$src_pixel</span><span class="src-sym">[</span><span class="src-str">'red'</span><span class="src-sym">] </span>* <span class="src-var">$opacity</span><span class="src-sym">)) )</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a3025"></a> <span class="src-var">$src_green </span>= <a href="http://www.php.net/round">round</a><span class="src-sym">(((</span><span class="src-var">$src_pixel</span><span class="src-sym">[</span><span class="src-str">'green'</span><span class="src-sym">] </span>* <span class="src-var">$opacity</span><span class="src-sym">)) )</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a3026"></a> <span class="src-var">$src_blue </span>= <a href="http://www.php.net/round">round</a><span class="src-sym">(((</span><span class="src-var">$src_pixel</span><span class="src-sym">[</span><span class="src-str">'blue'</span><span class="src-sym">] </span>* <span class="src-var">$opacity</span><span class="src-sym">)) )</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a3027"></a> <span class="src-var">$red </span>= <a href="http://www.php.net/round">round</a><span class="src-sym">((</span><span class="src-var">$dst_red </span>+ <span class="src-var">$src_red </span><span class="src-sym">) </span>/ <span class="src-sym">(</span><span class="src-var">$dst_alpha </span>* <span class="src-sym">(</span><span class="src-num">1 </span>- <span class="src-var">$opacity</span><span class="src-sym">) </span>+ <span class="src-var">$opacity</span><span class="src-sym">))</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a3028"></a> <span class="src-var">$green </span>= <a href="http://www.php.net/round">round</a><span class="src-sym">((</span><span class="src-var">$dst_green </span>+ <span class="src-var">$src_green</span><span class="src-sym">) </span>/ <span class="src-sym">(</span><span class="src-var">$dst_alpha </span>* <span class="src-sym">(</span><span class="src-num">1 </span>- <span class="src-var">$opacity</span><span class="src-sym">) </span>+ <span class="src-var">$opacity</span><span class="src-sym">))</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a3029"></a> <span class="src-var">$blue </span>= <a href="http://www.php.net/round">round</a><span class="src-sym">((</span><span class="src-var">$dst_blue </span>+ <span class="src-var">$src_blue </span><span class="src-sym">) </span>/ <span class="src-sym">(</span><span class="src-var">$dst_alpha </span>* <span class="src-sym">(</span><span class="src-num">1 </span>- <span class="src-var">$opacity</span><span class="src-sym">) </span>+ <span class="src-var">$opacity</span><span class="src-sym">))</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a3030"></a> <span class="src-key">if </span><span class="src-sym">(</span><span class="src-var">$red </span>> <span class="src-num">255</span><span class="src-sym">) </span><span class="src-var">$red </span>= <span class="src-num">255</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a3031"></a> <span class="src-key">if </span><span class="src-sym">(</span><span class="src-var">$green </span>> <span class="src-num">255</span><span class="src-sym">) </span><span class="src-var">$green </span>= <span class="src-num">255</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a3032"></a> <span class="src-key">if </span><span class="src-sym">(</span><span class="src-var">$blue </span>> <span class="src-num">255</span><span class="src-sym">) </span><span class="src-var">$blue </span>= <span class="src-num">255</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a3033"></a> <span class="src-var">$alpha </span>= <a href="http://www.php.net/round">round</a><span class="src-sym">((</span><span class="src-num">1 </span>- <span class="src-var">$alpha</span><span class="src-sym">) </span>* <span class="src-num">127</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a3034"></a> <span class="src-var">$color </span>= <a href="http://www.php.net/imagecolorallocatealpha">imagecolorallocatealpha</a><span class="src-sym">(</span><span class="src-var">$dst_im</span><span class="src-sym">, </span><span class="src-var">$red</span><span class="src-sym">, </span><span class="src-var">$green</span><span class="src-sym">, </span><span class="src-var">$blue</span><span class="src-sym">, </span><span class="src-var">$alpha</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a3035"></a> <a href="http://www.php.net/imagesetpixel">imagesetpixel</a><span class="src-sym">(</span><span class="src-var">$dst_im</span><span class="src-sym">, </span><span class="src-var">$x </span>+ <span class="src-var">$dst_x</span><span class="src-sym">, </span><span class="src-var">$y </span>+ <span class="src-var">$dst_y</span><span class="src-sym">, </span><span class="src-var">$color</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a3036"></a> <span class="src-sym">}</span></div></li> <li><div class="src-line"><a name="a3037"></a> <span class="src-sym">}</span></div></li> <li><div class="src-line"><a name="a3038"></a> <span class="src-sym">}</span></div></li> <li><div class="src-line"><a name="a3039"></a> <span class="src-sym">}</span></div></li> <li><div class="src-line"><a name="a3040"></a> <span class="src-key">return </span><span class="src-id">true</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a3041"></a> <span class="src-sym">}</span></div></li> <li><div class="src-line"><a name="a3042"></a> </div></li> <li><div class="src-line"><a name="a3043"></a> </div></li> <li><div class="src-line"><a name="a3044"></a> </div></li> <li><div class="src-line"><a name="a3045"></a> <span class="src-doc">/**</span></div></li> <li><div class="src-line"><a name="a3046"></a><span class="src-doc"> * Actually uploads the file, and act on it according to the set processing class variables</span></div></li> <li><div class="src-line"><a name="a3047"></a><span class="src-doc"> *</span></div></li> <li><div class="src-line"><a name="a3048"></a><span class="src-doc"> * This function copies the uploaded file to the given location, eventually performing actions on it.</span></div></li> <li><div class="src-line"><a name="a3049"></a><span class="src-doc"> * Typically, you can call </span><span class="src-doc-inlinetag">{@link process}</span><span class="src-doc"> several times for the same file,</span></div></li> <li><div class="src-line"><a name="a3050"></a><span class="src-doc"> * for instance to create a resized image and a thumbnail of the same file.</span></div></li> <li><div class="src-line"><a name="a3051"></a><span class="src-doc"> * The original uploaded file remains intact in its temporary location, so you can use </span><span class="src-doc-inlinetag">{@link process}</span><span class="src-doc"> several times.</span></div></li> <li><div class="src-line"><a name="a3052"></a><span class="src-doc"> * You will be able to delete the uploaded file with </span><span class="src-doc-inlinetag">{@link clean}</span><span class="src-doc"> when you have finished all your </span><span class="src-doc-inlinetag">{@link process}</span><span class="src-doc"> calls.</span></div></li> <li><div class="src-line"><a name="a3053"></a><span class="src-doc"> *</span></div></li> <li><div class="src-line"><a name="a3054"></a><span class="src-doc"> * According to the processing class variables set in the calling file, the file can be renamed,</span></div></li> <li><div class="src-line"><a name="a3055"></a><span class="src-doc"> * and if it is an image, can be resized or converted.</span></div></li> <li><div class="src-line"><a name="a3056"></a><span class="src-doc"> *</span></div></li> <li><div class="src-line"><a name="a3057"></a><span class="src-doc"> * When the processing is completed, and the file copied to its new location, the</span></div></li> <li><div class="src-line"><a name="a3058"></a><span class="src-doc"> * processing class variables will be reset to their default value.</span></div></li> <li><div class="src-line"><a name="a3059"></a><span class="src-doc"> * This allows you to set new properties, and perform another </span><span class="src-doc-inlinetag">{@link process}</span><span class="src-doc"> on the same uploaded file</span></div></li> <li><div class="src-line"><a name="a3060"></a><span class="src-doc"> *</span></div></li> <li><div class="src-line"><a name="a3061"></a><span class="src-doc"> * If the function is called with a null or empty argument, then it will return the content of the picture</span></div></li> <li><div class="src-line"><a name="a3062"></a><span class="src-doc"> *</span></div></li> <li><div class="src-line"><a name="a3063"></a><span class="src-doc"> * It will set </span><span class="src-doc-inlinetag">{@link processed}</span><span class="src-doc"> (and </span><span class="src-doc-inlinetag">{@link error}</span><span class="src-doc"> is an error occurred)</span></div></li> <li><div class="src-line"><a name="a3064"></a><span class="src-doc"> *</span></div></li> <li><div class="src-line"><a name="a3065"></a><span class="src-doc"> * </span><span class="src-doc-coretag">@access</span><span class="src-doc"> public</span></div></li> <li><div class="src-line"><a name="a3066"></a><span class="src-doc"> * </span><span class="src-doc-coretag">@param </span><span class="src-doc"> </span><span class="src-doc-type">string </span><span class="src-doc-var">$server_path </span><span class="src-doc">Optional path location of the uploaded file, with an ending slash</span></div></li> <li><div class="src-line"><a name="a3067"></a><span class="src-doc"> * </span><span class="src-doc-coretag">@return </span><span class="src-doc-type">string </span><span class="src-doc">Optional content of the image</span></div></li> <li><div class="src-line"><a name="a3068"></a><span class="src-doc"> */</span></div></li> <li><div class="src-line"><a name="a3069"></a> <span class="src-key">function </span><a href="class.upload.html#methodprocess">process</a><span class="src-sym">(</span><span class="src-var">$server_path </span>= <span class="src-id">null</span><span class="src-sym">) </span><span class="src-sym">{</span></div></li> <li><div class="src-line"><a name="a3070"></a> </div></li> <li><div class="src-line"><a name="a3071"></a> <span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id"><a href="class.upload.html#var$error">error</a> </span>= <span class="src-str">''</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a3072"></a> <span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id"><a href="class.upload.html#var$processed">processed</a> </span>= <span class="src-id">true</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a3073"></a> <span class="src-var">$return_mode </span>= <span class="src-id">false</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a3074"></a> <span class="src-var">$return_content </span>= <span class="src-id">null</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a3075"></a> </div></li> <li><div class="src-line"><a name="a3076"></a> <span class="src-key">if </span><span class="src-sym">(</span><span class="src-sym">!</span><span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id"><a href="class.upload.html#var$uploaded">uploaded</a></span><span class="src-sym">) </span><span class="src-sym">{</span></div></li> <li><div class="src-line"><a name="a3077"></a> <span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id"><a href="class.upload.html#var$error">error</a> </span>= <span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id">translate</span><span class="src-sym">(</span><span class="src-str">'file_not_uploaded'</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a3078"></a> <span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id"><a href="class.upload.html#var$processed">processed</a> </span>= <span class="src-id">false</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a3079"></a> <span class="src-sym">}</span></div></li> <li><div class="src-line"><a name="a3080"></a> </div></li> <li><div class="src-line"><a name="a3081"></a> <span class="src-key">if </span><span class="src-sym">(</span><span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id"><a href="class.upload.html#var$processed">processed</a></span><span class="src-sym">) </span><span class="src-sym">{</span></div></li> <li><div class="src-line"><a name="a3082"></a> <span class="src-key">if </span><span class="src-sym">(</span><span class="src-key">empty</span><span class="src-sym">(</span><span class="src-var">$server_path</span><span class="src-sym">) </span>|| <a href="http://www.php.net/is_null">is_null</a><span class="src-sym">(</span><span class="src-var">$server_path</span><span class="src-sym">)) </span><span class="src-sym">{</span></div></li> <li><div class="src-line"><a name="a3083"></a> <span class="src-var">$this</span><span class="src-sym">-></span><a href="http://www.php.net/log">log</a> .= <span class="src-str">'<b>process file and return the content</b><br />'</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a3084"></a> <span class="src-var">$return_mode </span>= <span class="src-id">true</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a3085"></a> <span class="src-sym">} </span><span class="src-key">else </span><span class="src-sym">{</span></div></li> <li><div class="src-line"><a name="a3086"></a> <span class="src-key">if</span><span class="src-sym">(</span><a href="http://www.php.net/strtolower">strtolower</a><span class="src-sym">(</span><a href="http://www.php.net/substr">substr</a><span class="src-sym">(</span><span class="src-id">PHP_OS</span><span class="src-sym">, </span><span class="src-num">0</span><span class="src-sym">, </span><span class="src-num">3</span><span class="src-sym">)) </span>=== <span class="src-str">'win'</span><span class="src-sym">) </span><span class="src-sym">{</span></div></li> <li><div class="src-line"><a name="a3087"></a> <span class="src-key">if </span><span class="src-sym">(</span><a href="http://www.php.net/substr">substr</a><span class="src-sym">(</span><span class="src-var">$server_path</span><span class="src-sym">, </span>-<span class="src-num">1</span><span class="src-sym">, </span><span class="src-num">1</span><span class="src-sym">) </span>!= <span class="src-str">'\\'</span><span class="src-sym">) </span><span class="src-var">$server_path </span>= <span class="src-var">$server_path </span>. <span class="src-str">'\\'</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a3088"></a> <span class="src-sym">} </span><span class="src-key">else </span><span class="src-sym">{</span></div></li> <li><div class="src-line"><a name="a3089"></a> <span class="src-key">if </span><span class="src-sym">(</span><a href="http://www.php.net/substr">substr</a><span class="src-sym">(</span><span class="src-var">$server_path</span><span class="src-sym">, </span>-<span class="src-num">1</span><span class="src-sym">, </span><span class="src-num">1</span><span class="src-sym">) </span>!= <span class="src-str">'/'</span><span class="src-sym">) </span><span class="src-var">$server_path </span>= <span class="src-var">$server_path </span>. <span class="src-str">'/'</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a3090"></a> <span class="src-sym">}</span></div></li> <li><div class="src-line"><a name="a3091"></a> <span class="src-var">$this</span><span class="src-sym">-></span><a href="http://www.php.net/log">log</a> .= <span class="src-str">'<b>process file to ' </span>. <span class="src-var">$server_path </span>. <span class="src-str">'</b><br />'</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a3092"></a> <span class="src-sym">}</span></div></li> <li><div class="src-line"><a name="a3093"></a> <span class="src-sym">}</span></div></li> <li><div class="src-line"><a name="a3094"></a> </div></li> <li><div class="src-line"><a name="a3095"></a> <span class="src-key">if </span><span class="src-sym">(</span><span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id"><a href="class.upload.html#var$processed">processed</a></span><span class="src-sym">) </span><span class="src-sym">{</span></div></li> <li><div class="src-line"><a name="a3096"></a> <span class="src-comm">// checks file max size</span></div></li> <li><div class="src-line"><a name="a3097"></a> <span class="src-key">if </span><span class="src-sym">(</span><span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id"><a href="class.upload.html#var$file_src_size">file_src_size</a> </span>> <span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id"><a href="class.upload.html#var$file_max_size">file_max_size</a> </span><span class="src-sym">) </span><span class="src-sym">{</span></div></li> <li><div class="src-line"><a name="a3098"></a> <span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id"><a href="class.upload.html#var$processed">processed</a> </span>= <span class="src-id">false</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a3099"></a> <span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id"><a href="class.upload.html#var$error">error</a> </span>= <span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id">translate</span><span class="src-sym">(</span><span class="src-str">'file_too_big'</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a3100"></a> <span class="src-sym">} </span><span class="src-key">else </span><span class="src-sym">{</span></div></li> <li><div class="src-line"><a name="a3101"></a> <span class="src-var">$this</span><span class="src-sym">-></span><a href="http://www.php.net/log">log</a> .= <span class="src-str">'- file size OK<br />'</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a3102"></a> <span class="src-sym">}</span></div></li> <li><div class="src-line"><a name="a3103"></a> <span class="src-sym">}</span></div></li> <li><div class="src-line"><a name="a3104"></a> </div></li> <li><div class="src-line"><a name="a3105"></a> <span class="src-key">if </span><span class="src-sym">(</span><span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id"><a href="class.upload.html#var$processed">processed</a></span><span class="src-sym">) </span><span class="src-sym">{</span></div></li> <li><div class="src-line"><a name="a3106"></a> <span class="src-comm">// turn dangerous scripts into text files</span></div></li> <li><div class="src-line"><a name="a3107"></a> <span class="src-key">if </span><span class="src-sym">(</span><span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id"><a href="class.upload.html#var$no_script">no_script</a></span><span class="src-sym">) </span><span class="src-sym">{</span></div></li> <li><div class="src-line"><a name="a3108"></a> <span class="src-key">if </span><span class="src-sym">(((</span><a href="http://www.php.net/substr">substr</a><span class="src-sym">(</span><span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id"><a href="class.upload.html#var$file_src_mime">file_src_mime</a></span><span class="src-sym">, </span><span class="src-num">0</span><span class="src-sym">, </span><span class="src-num">5</span><span class="src-sym">) </span>== <span class="src-str">'text/' </span>|| <a href="http://www.php.net/strpos">strpos</a><span class="src-sym">(</span><span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id"><a href="class.upload.html#var$file_src_mime">file_src_mime</a></span><span class="src-sym">, </span><span class="src-str">'javascript'</span><span class="src-sym">) </span>!== <span class="src-id">false</span><span class="src-sym">) </span>&& <span class="src-sym">(</span><a href="http://www.php.net/substr">substr</a><span class="src-sym">(</span><span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id"><a href="class.upload.html#var$file_src_name">file_src_name</a></span><span class="src-sym">, </span>-<span class="src-num">4</span><span class="src-sym">) </span>!= <span class="src-str">'.txt'</span><span class="src-sym">))</span></div></li> <li><div class="src-line"><a name="a3109"></a> || <a href="http://www.php.net/preg_match">preg_match</a><span class="src-sym">(</span><span class="src-str">'/\.(php|pl|py|cgi|asp)$/i'</span><span class="src-sym">, </span><span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id"><a href="class.upload.html#var$file_src_name">file_src_name</a></span><span class="src-sym">) </span>|| <span class="src-key">empty</span><span class="src-sym">(</span><span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id"><a href="class.upload.html#var$file_src_name_ext">file_src_name_ext</a></span><span class="src-sym">)) </span><span class="src-sym">{</span></div></li> <li><div class="src-line"><a name="a3110"></a> <span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id"><a href="class.upload.html#var$file_src_mime">file_src_mime</a> </span>= <span class="src-str">'text/plain'</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a3111"></a> <span class="src-var">$this</span><span class="src-sym">-></span><a href="http://www.php.net/log">log</a> .= <span class="src-str">'- script ' </span>. <span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id"><a href="class.upload.html#var$file_src_name">file_src_name</a> </span>. <span class="src-str">' renamed as ' </span>. <span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id"><a href="class.upload.html#var$file_src_name">file_src_name</a> </span>. <span class="src-str">'.txt!<br />'</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a3112"></a> <span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id"><a href="class.upload.html#var$file_src_name_ext">file_src_name_ext</a> </span>.= <span class="src-sym">(</span><span class="src-key">empty</span><span class="src-sym">(</span><span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id"><a href="class.upload.html#var$file_src_name_ext">file_src_name_ext</a></span><span class="src-sym">) </span>? <span class="src-str">'txt' </span>: <span class="src-str">'.txt'</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a3113"></a> <span class="src-sym">}</span></div></li> <li><div class="src-line"><a name="a3114"></a> <span class="src-sym">}</span></div></li> <li><div class="src-line"><a name="a3115"></a> </div></li> <li><div class="src-line"><a name="a3116"></a> <span class="src-key">if </span><span class="src-sym">(</span><span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id"><a href="class.upload.html#var$mime_check">mime_check</a> </span>&& <span class="src-key">empty</span><span class="src-sym">(</span><span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id"><a href="class.upload.html#var$file_src_mime">file_src_mime</a></span><span class="src-sym">)) </span><span class="src-sym">{</span></div></li> <li><div class="src-line"><a name="a3117"></a> <span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id"><a href="class.upload.html#var$processed">processed</a> </span>= <span class="src-id">false</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a3118"></a> <span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id"><a href="class.upload.html#var$error">error</a> </span>= <span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id">translate</span><span class="src-sym">(</span><span class="src-str">'no_mime'</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a3119"></a> <span class="src-sym">} </span><span class="src-key">else </span><span class="src-key">if </span><span class="src-sym">(</span><span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id"><a href="class.upload.html#var$mime_check">mime_check</a> </span>&& <span class="src-sym">!</span><span class="src-key">empty</span><span class="src-sym">(</span><span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id"><a href="class.upload.html#var$file_src_mime">file_src_mime</a></span><span class="src-sym">) </span>&& <a href="http://www.php.net/strpos">strpos</a><span class="src-sym">(</span><span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id"><a href="class.upload.html#var$file_src_mime">file_src_mime</a></span><span class="src-sym">, </span><span class="src-str">'/'</span><span class="src-sym">) </span>!== <span class="src-id">false</span><span class="src-sym">) </span><span class="src-sym">{</span></div></li> <li><div class="src-line"><a name="a3120"></a> list<span class="src-sym">(</span><span class="src-var">$m1</span><span class="src-sym">, </span><span class="src-var">$m2</span><span class="src-sym">) </span>= <a href="http://www.php.net/explode">explode</a><span class="src-sym">(</span><span class="src-str">'/'</span><span class="src-sym">, </span><span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id"><a href="class.upload.html#var$file_src_mime">file_src_mime</a></span><span class="src-sym">)</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a3121"></a> <span class="src-var">$allowed </span>= <span class="src-id">false</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a3122"></a> <span class="src-comm">// check wether the mime type is allowed</span></div></li> <li><div class="src-line"><a name="a3123"></a> <span class="src-key">foreach</span><span class="src-sym">(</span><span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id"><a href="class.upload.html#var$allowed">allowed</a> </span><span class="src-key">as </span><span class="src-var">$k </span>=> <span class="src-var">$v</span><span class="src-sym">) </span><span class="src-sym">{</span></div></li> <li><div class="src-line"><a name="a3124"></a> list<span class="src-sym">(</span><span class="src-var">$v1</span><span class="src-sym">, </span><span class="src-var">$v2</span><span class="src-sym">) </span>= <a href="http://www.php.net/explode">explode</a><span class="src-sym">(</span><span class="src-str">'/'</span><span class="src-sym">, </span><span class="src-var">$v</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a3125"></a> <span class="src-key">if </span><span class="src-sym">((</span><span class="src-var">$v1 </span>== <span class="src-str">'*' </span>&& <span class="src-var">$v2 </span>== <span class="src-str">'*'</span><span class="src-sym">) </span>|| <span class="src-sym">(</span><span class="src-var">$v1 </span>== <span class="src-var">$m1 </span>&& <span class="src-sym">(</span><span class="src-var">$v2 </span>== <span class="src-var">$m2 </span>|| <span class="src-var">$v2 </span>== <span class="src-str">'*'</span><span class="src-sym">))) </span><span class="src-sym">{</span></div></li> <li><div class="src-line"><a name="a3126"></a> <span class="src-var">$allowed </span>= <span class="src-id">true</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a3127"></a> <span class="src-key">break</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a3128"></a> <span class="src-sym">}</span></div></li> <li><div class="src-line"><a name="a3129"></a> <span class="src-sym">}</span></div></li> <li><div class="src-line"><a name="a3130"></a> <span class="src-comm">// check wether the mime type is forbidden</span></div></li> <li><div class="src-line"><a name="a3131"></a> <span class="src-key">foreach</span><span class="src-sym">(</span><span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id"><a href="class.upload.html#var$forbidden">forbidden</a> </span><span class="src-key">as </span><span class="src-var">$k </span>=> <span class="src-var">$v</span><span class="src-sym">) </span><span class="src-sym">{</span></div></li> <li><div class="src-line"><a name="a3132"></a> list<span class="src-sym">(</span><span class="src-var">$v1</span><span class="src-sym">, </span><span class="src-var">$v2</span><span class="src-sym">) </span>= <a href="http://www.php.net/explode">explode</a><span class="src-sym">(</span><span class="src-str">'/'</span><span class="src-sym">, </span><span class="src-var">$v</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a3133"></a> <span class="src-key">if </span><span class="src-sym">((</span><span class="src-var">$v1 </span>== <span class="src-str">'*' </span>&& <span class="src-var">$v2 </span>== <span class="src-str">'*'</span><span class="src-sym">) </span>|| <span class="src-sym">(</span><span class="src-var">$v1 </span>== <span class="src-var">$m1 </span>&& <span class="src-sym">(</span><span class="src-var">$v2 </span>== <span class="src-var">$m2 </span>|| <span class="src-var">$v2 </span>== <span class="src-str">'*'</span><span class="src-sym">))) </span><span class="src-sym">{</span></div></li> <li><div class="src-line"><a name="a3134"></a> <span class="src-var">$allowed </span>= <span class="src-id">false</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a3135"></a> <span class="src-key">break</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a3136"></a> <span class="src-sym">}</span></div></li> <li><div class="src-line"><a name="a3137"></a> <span class="src-sym">}</span></div></li> <li><div class="src-line"><a name="a3138"></a> <span class="src-key">if </span><span class="src-sym">(</span><span class="src-sym">!</span><span class="src-var">$allowed</span><span class="src-sym">) </span><span class="src-sym">{</span></div></li> <li><div class="src-line"><a name="a3139"></a> <span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id"><a href="class.upload.html#var$processed">processed</a> </span>= <span class="src-id">false</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a3140"></a> <span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id"><a href="class.upload.html#var$error">error</a> </span>= <span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id">translate</span><span class="src-sym">(</span><span class="src-str">'incorrect_file'</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a3141"></a> <span class="src-sym">} </span><span class="src-key">else </span><span class="src-sym">{</span></div></li> <li><div class="src-line"><a name="a3142"></a> <span class="src-var">$this</span><span class="src-sym">-></span><a href="http://www.php.net/log">log</a> .= <span class="src-str">'- file mime OK : ' </span>. <span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id"><a href="class.upload.html#var$file_src_mime">file_src_mime</a> </span>. <span class="src-str">'<br />'</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a3143"></a> <span class="src-sym">}</span></div></li> <li><div class="src-line"><a name="a3144"></a> <span class="src-sym">} </span><span class="src-key">else </span><span class="src-sym">{</span></div></li> <li><div class="src-line"><a name="a3145"></a> <span class="src-var">$this</span><span class="src-sym">-></span><a href="http://www.php.net/log">log</a> .= <span class="src-str">'- file mime (not checked) : ' </span>. <span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id"><a href="class.upload.html#var$file_src_mime">file_src_mime</a> </span>. <span class="src-str">'<br />'</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a3146"></a> <span class="src-sym">}</span></div></li> <li><div class="src-line"><a name="a3147"></a> </div></li> <li><div class="src-line"><a name="a3148"></a> <span class="src-comm">// if the file is an image, we can check on its dimensions</span></div></li> <li><div class="src-line"><a name="a3149"></a> <span class="src-comm">// these checks are not available if open_basedir restrictions are in place</span></div></li> <li><div class="src-line"><a name="a3150"></a> <span class="src-key">if </span><span class="src-sym">(</span><span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id">file_is_image</span><span class="src-sym">) </span><span class="src-sym">{</span></div></li> <li><div class="src-line"><a name="a3151"></a> <span class="src-key">if </span><span class="src-sym">(</span><a href="http://www.php.net/is_numeric">is_numeric</a><span class="src-sym">(</span><span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id">image_src_x</span><span class="src-sym">) </span>&& <a href="http://www.php.net/is_numeric">is_numeric</a><span class="src-sym">(</span><span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id">image_src_y</span><span class="src-sym">)) </span><span class="src-sym">{</span></div></li> <li><div class="src-line"><a name="a3152"></a> <span class="src-var">$ratio </span>= <span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id">image_src_x </span>/ <span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id">image_src_y</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a3153"></a> <span class="src-key">if </span><span class="src-sym">(</span><span class="src-sym">!</span><a href="http://www.php.net/is_null">is_null</a><span class="src-sym">(</span><span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id"><a href="class.upload.html#var$image_max_width">image_max_width</a></span><span class="src-sym">) </span>&& <span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id">image_src_x </span>> <span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id"><a href="class.upload.html#var$image_max_width">image_max_width</a></span><span class="src-sym">) </span><span class="src-sym">{</span></div></li> <li><div class="src-line"><a name="a3154"></a> <span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id"><a href="class.upload.html#var$processed">processed</a> </span>= <span class="src-id">false</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a3155"></a> <span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id"><a href="class.upload.html#var$error">error</a> </span>= <span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id">translate</span><span class="src-sym">(</span><span class="src-str">'image_too_wide'</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a3156"></a> <span class="src-sym">}</span></div></li> <li><div class="src-line"><a name="a3157"></a> <span class="src-key">if </span><span class="src-sym">(</span><span class="src-sym">!</span><a href="http://www.php.net/is_null">is_null</a><span class="src-sym">(</span><span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id"><a href="class.upload.html#var$image_min_width">image_min_width</a></span><span class="src-sym">) </span>&& <span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id">image_src_x </span>< <span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id"><a href="class.upload.html#var$image_min_width">image_min_width</a></span><span class="src-sym">) </span><span class="src-sym">{</span></div></li> <li><div class="src-line"><a name="a3158"></a> <span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id"><a href="class.upload.html#var$processed">processed</a> </span>= <span class="src-id">false</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a3159"></a> <span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id"><a href="class.upload.html#var$error">error</a> </span>= <span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id">translate</span><span class="src-sym">(</span><span class="src-str">'image_too_narrow'</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a3160"></a> <span class="src-sym">}</span></div></li> <li><div class="src-line"><a name="a3161"></a> <span class="src-key">if </span><span class="src-sym">(</span><span class="src-sym">!</span><a href="http://www.php.net/is_null">is_null</a><span class="src-sym">(</span><span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id"><a href="class.upload.html#var$image_max_height">image_max_height</a></span><span class="src-sym">) </span>&& <span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id">image_src_y </span>> <span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id"><a href="class.upload.html#var$image_max_height">image_max_height</a></span><span class="src-sym">) </span><span class="src-sym">{</span></div></li> <li><div class="src-line"><a name="a3162"></a> <span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id"><a href="class.upload.html#var$processed">processed</a> </span>= <span class="src-id">false</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a3163"></a> <span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id"><a href="class.upload.html#var$error">error</a> </span>= <span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id">translate</span><span class="src-sym">(</span><span class="src-str">'image_too_high'</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a3164"></a> <span class="src-sym">}</span></div></li> <li><div class="src-line"><a name="a3165"></a> <span class="src-key">if </span><span class="src-sym">(</span><span class="src-sym">!</span><a href="http://www.php.net/is_null">is_null</a><span class="src-sym">(</span><span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id"><a href="class.upload.html#var$image_min_height">image_min_height</a></span><span class="src-sym">) </span>&& <span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id">image_src_y </span>< <span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id"><a href="class.upload.html#var$image_min_height">image_min_height</a></span><span class="src-sym">) </span><span class="src-sym">{</span></div></li> <li><div class="src-line"><a name="a3166"></a> <span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id"><a href="class.upload.html#var$processed">processed</a> </span>= <span class="src-id">false</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a3167"></a> <span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id"><a href="class.upload.html#var$error">error</a> </span>= <span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id">translate</span><span class="src-sym">(</span><span class="src-str">'image_too_short'</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a3168"></a> <span class="src-sym">}</span></div></li> <li><div class="src-line"><a name="a3169"></a> <span class="src-key">if </span><span class="src-sym">(</span><span class="src-sym">!</span><a href="http://www.php.net/is_null">is_null</a><span class="src-sym">(</span><span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id"><a href="class.upload.html#var$image_max_ratio">image_max_ratio</a></span><span class="src-sym">) </span>&& <span class="src-var">$ratio </span>> <span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id"><a href="class.upload.html#var$image_max_ratio">image_max_ratio</a></span><span class="src-sym">) </span><span class="src-sym">{</span></div></li> <li><div class="src-line"><a name="a3170"></a> <span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id"><a href="class.upload.html#var$processed">processed</a> </span>= <span class="src-id">false</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a3171"></a> <span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id"><a href="class.upload.html#var$error">error</a> </span>= <span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id">translate</span><span class="src-sym">(</span><span class="src-str">'ratio_too_high'</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a3172"></a> <span class="src-sym">}</span></div></li> <li><div class="src-line"><a name="a3173"></a> <span class="src-key">if </span><span class="src-sym">(</span><span class="src-sym">!</span><a href="http://www.php.net/is_null">is_null</a><span class="src-sym">(</span><span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id"><a href="class.upload.html#var$image_min_ratio">image_min_ratio</a></span><span class="src-sym">) </span>&& <span class="src-var">$ratio </span>< <span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id"><a href="class.upload.html#var$image_min_ratio">image_min_ratio</a></span><span class="src-sym">) </span><span class="src-sym">{</span></div></li> <li><div class="src-line"><a name="a3174"></a> <span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id"><a href="class.upload.html#var$processed">processed</a> </span>= <span class="src-id">false</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a3175"></a> <span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id"><a href="class.upload.html#var$error">error</a> </span>= <span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id">translate</span><span class="src-sym">(</span><span class="src-str">'ratio_too_low'</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a3176"></a> <span class="src-sym">}</span></div></li> <li><div class="src-line"><a name="a3177"></a> <span class="src-key">if </span><span class="src-sym">(</span><span class="src-sym">!</span><a href="http://www.php.net/is_null">is_null</a><span class="src-sym">(</span><span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id"><a href="class.upload.html#var$image_max_pixels">image_max_pixels</a></span><span class="src-sym">) </span>&& <span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id">image_src_pixels </span>> <span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id"><a href="class.upload.html#var$image_max_pixels">image_max_pixels</a></span><span class="src-sym">) </span><span class="src-sym">{</span></div></li> <li><div class="src-line"><a name="a3178"></a> <span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id"><a href="class.upload.html#var$processed">processed</a> </span>= <span class="src-id">false</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a3179"></a> <span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id"><a href="class.upload.html#var$error">error</a> </span>= <span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id">translate</span><span class="src-sym">(</span><span class="src-str">'too_many_pixels'</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a3180"></a> <span class="src-sym">}</span></div></li> <li><div class="src-line"><a name="a3181"></a> <span class="src-key">if </span><span class="src-sym">(</span><span class="src-sym">!</span><a href="http://www.php.net/is_null">is_null</a><span class="src-sym">(</span><span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id"><a href="class.upload.html#var$image_min_pixels">image_min_pixels</a></span><span class="src-sym">) </span>&& <span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id">image_src_pixels </span>< <span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id"><a href="class.upload.html#var$image_min_pixels">image_min_pixels</a></span><span class="src-sym">) </span><span class="src-sym">{</span></div></li> <li><div class="src-line"><a name="a3182"></a> <span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id"><a href="class.upload.html#var$processed">processed</a> </span>= <span class="src-id">false</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a3183"></a> <span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id"><a href="class.upload.html#var$error">error</a> </span>= <span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id">translate</span><span class="src-sym">(</span><span class="src-str">'not_enough_pixels'</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a3184"></a> <span class="src-sym">}</span></div></li> <li><div class="src-line"><a name="a3185"></a> <span class="src-sym">} </span><span class="src-key">else </span><span class="src-sym">{</span></div></li> <li><div class="src-line"><a name="a3186"></a> <span class="src-var">$this</span><span class="src-sym">-></span><a href="http://www.php.net/log">log</a> .= <span class="src-str">'- no image properties available, can\'t enforce dimension checks : ' </span>. <span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id"><a href="class.upload.html#var$file_src_mime">file_src_mime</a> </span>. <span class="src-str">'<br />'</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a3187"></a> <span class="src-sym">}</span></div></li> <li><div class="src-line"><a name="a3188"></a> <span class="src-sym">}</span></div></li> <li><div class="src-line"><a name="a3189"></a> <span class="src-sym">}</span></div></li> <li><div class="src-line"><a name="a3190"></a> </div></li> <li><div class="src-line"><a name="a3191"></a> <span class="src-key">if </span><span class="src-sym">(</span><span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id"><a href="class.upload.html#var$processed">processed</a></span><span class="src-sym">) </span><span class="src-sym">{</span></div></li> <li><div class="src-line"><a name="a3192"></a> <span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id">file_dst_path </span>= <span class="src-var">$server_path</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a3193"></a> </div></li> <li><div class="src-line"><a name="a3194"></a> <span class="src-comm">// repopulate dst variables from src</span></div></li> <li><div class="src-line"><a name="a3195"></a> <span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id"><a href="class.upload.html#var$file_dst_name">file_dst_name</a> </span>= <span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id"><a href="class.upload.html#var$file_src_name">file_src_name</a></span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a3196"></a> <span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id"><a href="class.upload.html#var$file_dst_name_body">file_dst_name_body</a> </span>= <span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id"><a href="class.upload.html#var$file_src_name_body">file_src_name_body</a></span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a3197"></a> <span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id"><a href="class.upload.html#var$file_dst_name_ext">file_dst_name_ext</a> </span>= <span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id"><a href="class.upload.html#var$file_src_name_ext">file_src_name_ext</a></span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a3198"></a> <span class="src-key">if </span><span class="src-sym">(</span><span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id"><a href="class.upload.html#var$file_overwrite">file_overwrite</a></span><span class="src-sym">) </span><span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id"><a href="class.upload.html#var$file_auto_rename">file_auto_rename</a> </span>= <span class="src-id">false</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a3199"></a> </div></li> <li><div class="src-line"><a name="a3200"></a> <span class="src-key">if </span><span class="src-sym">(</span><span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id"><a href="class.upload.html#var$image_convert">image_convert</a> </span>!= <span class="src-str">''</span><span class="src-sym">) </span><span class="src-sym">{ </span><span class="src-comm">// if we convert as an image</span></div></li> <li><div class="src-line"><a name="a3201"></a> <span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id"><a href="class.upload.html#var$file_dst_name_ext">file_dst_name_ext</a> </span>= <span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id"><a href="class.upload.html#var$image_convert">image_convert</a></span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a3202"></a> <span class="src-var">$this</span><span class="src-sym">-></span><a href="http://www.php.net/log">log</a> .= <span class="src-str">'- new file name ext : ' </span>. <span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id"><a href="class.upload.html#var$image_convert">image_convert</a> </span>. <span class="src-str">'<br />'</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a3203"></a> <span class="src-sym">}</span></div></li> <li><div class="src-line"><a name="a3204"></a> <span class="src-key">if </span><span class="src-sym">(</span><span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id"><a href="class.upload.html#var$file_new_name_body">file_new_name_body</a> </span>!= <span class="src-str">''</span><span class="src-sym">) </span><span class="src-sym">{ </span><span class="src-comm">// rename file body</span></div></li> <li><div class="src-line"><a name="a3205"></a> <span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id"><a href="class.upload.html#var$file_dst_name_body">file_dst_name_body</a> </span>= <span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id"><a href="class.upload.html#var$file_new_name_body">file_new_name_body</a></span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a3206"></a> <span class="src-var">$this</span><span class="src-sym">-></span><a href="http://www.php.net/log">log</a> .= <span class="src-str">'- new file name body : ' </span>. <span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id"><a href="class.upload.html#var$file_new_name_body">file_new_name_body</a> </span>. <span class="src-str">'<br />'</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a3207"></a> <span class="src-sym">}</span></div></li> <li><div class="src-line"><a name="a3208"></a> <span class="src-key">if </span><span class="src-sym">(</span><span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id"><a href="class.upload.html#var$file_new_name_ext">file_new_name_ext</a> </span>!= <span class="src-str">''</span><span class="src-sym">) </span><span class="src-sym">{ </span><span class="src-comm">// rename file ext</span></div></li> <li><div class="src-line"><a name="a3209"></a> <span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id"><a href="class.upload.html#var$file_dst_name_ext">file_dst_name_ext</a> </span>= <span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id"><a href="class.upload.html#var$file_new_name_ext">file_new_name_ext</a></span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a3210"></a> <span class="src-var">$this</span><span class="src-sym">-></span><a href="http://www.php.net/log">log</a> .= <span class="src-str">'- new file name ext : ' </span>. <span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id"><a href="class.upload.html#var$file_new_name_ext">file_new_name_ext</a> </span>. <span class="src-str">'<br />'</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a3211"></a> <span class="src-sym">}</span></div></li> <li><div class="src-line"><a name="a3212"></a> <span class="src-key">if </span><span class="src-sym">(</span><span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id"><a href="class.upload.html#var$file_name_body_add">file_name_body_add</a> </span>!= <span class="src-str">''</span><span class="src-sym">) </span><span class="src-sym">{ </span><span class="src-comm">// append a string to the name</span></div></li> <li><div class="src-line"><a name="a3213"></a> <span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id"><a href="class.upload.html#var$file_dst_name_body">file_dst_name_body</a> </span>= <span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id"><a href="class.upload.html#var$file_dst_name_body">file_dst_name_body</a> </span>. <span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id"><a href="class.upload.html#var$file_name_body_add">file_name_body_add</a></span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a3214"></a> <span class="src-var">$this</span><span class="src-sym">-></span><a href="http://www.php.net/log">log</a> .= <span class="src-str">'- file name body append : ' </span>. <span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id"><a href="class.upload.html#var$file_name_body_add">file_name_body_add</a> </span>. <span class="src-str">'<br />'</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a3215"></a> <span class="src-sym">}</span></div></li> <li><div class="src-line"><a name="a3216"></a> <span class="src-key">if </span><span class="src-sym">(</span><span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id"><a href="class.upload.html#var$file_name_body_pre">file_name_body_pre</a> </span>!= <span class="src-str">''</span><span class="src-sym">) </span><span class="src-sym">{ </span><span class="src-comm">// prepend a string to the name</span></div></li> <li><div class="src-line"><a name="a3217"></a> <span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id"><a href="class.upload.html#var$file_dst_name_body">file_dst_name_body</a> </span>= <span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id"><a href="class.upload.html#var$file_name_body_pre">file_name_body_pre</a> </span>. <span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id"><a href="class.upload.html#var$file_dst_name_body">file_dst_name_body</a></span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a3218"></a> <span class="src-var">$this</span><span class="src-sym">-></span><a href="http://www.php.net/log">log</a> .= <span class="src-str">'- file name body prepend : ' </span>. <span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id"><a href="class.upload.html#var$file_name_body_pre">file_name_body_pre</a> </span>. <span class="src-str">'<br />'</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a3219"></a> <span class="src-sym">}</span></div></li> <li><div class="src-line"><a name="a3220"></a> <span class="src-key">if </span><span class="src-sym">(</span><span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id"><a href="class.upload.html#var$file_safe_name">file_safe_name</a></span><span class="src-sym">) </span><span class="src-sym">{ </span><span class="src-comm">// formats the name</span></div></li> <li><div class="src-line"><a name="a3221"></a> <span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id"><a href="class.upload.html#var$file_dst_name_body">file_dst_name_body</a> </span>= <a href="http://www.php.net/str_replace">str_replace</a><span class="src-sym">(</span><span class="src-key">array</span><span class="src-sym">(</span><span class="src-str">' '</span><span class="src-sym">, </span><span class="src-str">'-'</span><span class="src-sym">)</span><span class="src-sym">, </span><span class="src-key">array</span><span class="src-sym">(</span><span class="src-str">'_'</span><span class="src-sym">,</span><span class="src-str">'_'</span><span class="src-sym">)</span><span class="src-sym">, </span><span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id"><a href="class.upload.html#var$file_dst_name_body">file_dst_name_body</a></span><span class="src-sym">) </span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a3222"></a> <span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id"><a href="class.upload.html#var$file_dst_name_body">file_dst_name_body</a> </span>= <a href="http://www.php.net/preg_replace">preg_replace</a><span class="src-sym">(</span><span class="src-str">'/[^A-Za-z0-9_]/'</span><span class="src-sym">, </span><span class="src-str">''</span><span class="src-sym">, </span><span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id"><a href="class.upload.html#var$file_dst_name_body">file_dst_name_body</a></span><span class="src-sym">) </span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a3223"></a> <span class="src-var">$this</span><span class="src-sym">-></span><a href="http://www.php.net/log">log</a> .= <span class="src-str">'- file name safe format<br />'</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a3224"></a> <span class="src-sym">}</span></div></li> <li><div class="src-line"><a name="a3225"></a> </div></li> <li><div class="src-line"><a name="a3226"></a> <span class="src-var">$this</span><span class="src-sym">-></span><a href="http://www.php.net/log">log</a> .= <span class="src-str">'- destination variables<br />'</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a3227"></a> <span class="src-key">if </span><span class="src-sym">(</span><span class="src-key">empty</span><span class="src-sym">(</span><span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id">file_dst_path</span><span class="src-sym">) </span>|| <a href="http://www.php.net/is_null">is_null</a><span class="src-sym">(</span><span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id">file_dst_path</span><span class="src-sym">)) </span><span class="src-sym">{</span></div></li> <li><div class="src-line"><a name="a3228"></a> <span class="src-var">$this</span><span class="src-sym">-></span><a href="http://www.php.net/log">log</a> .= <span class="src-str">'&nbsp;&nbsp;&nbsp;&nbsp;file_dst_path : n/a<br />'</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a3229"></a> <span class="src-sym">} </span><span class="src-key">else </span><span class="src-sym">{</span></div></li> <li><div class="src-line"><a name="a3230"></a> <span class="src-var">$this</span><span class="src-sym">-></span><a href="http://www.php.net/log">log</a> .= <span class="src-str">'&nbsp;&nbsp;&nbsp;&nbsp;file_dst_path : ' </span>. <span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id">file_dst_path </span>. <span class="src-str">'<br />'</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a3231"></a> <span class="src-sym">}</span></div></li> <li><div class="src-line"><a name="a3232"></a> <span class="src-var">$this</span><span class="src-sym">-></span><a href="http://www.php.net/log">log</a> .= <span class="src-str">'&nbsp;&nbsp;&nbsp;&nbsp;file_dst_name_body : ' </span>. <span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id"><a href="class.upload.html#var$file_dst_name_body">file_dst_name_body</a> </span>. <span class="src-str">'<br />'</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a3233"></a> <span class="src-var">$this</span><span class="src-sym">-></span><a href="http://www.php.net/log">log</a> .= <span class="src-str">'&nbsp;&nbsp;&nbsp;&nbsp;file_dst_name_ext : ' </span>. <span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id"><a href="class.upload.html#var$file_dst_name_ext">file_dst_name_ext</a> </span>. <span class="src-str">'<br />'</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a3234"></a> </div></li> <li><div class="src-line"><a name="a3235"></a> <span class="src-comm">// do we do some image manipulation?</span></div></li> <li><div class="src-line"><a name="a3236"></a> <span class="src-var">$image_manipulation </span>= <span class="src-sym">(</span><span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id">file_is_image </span>&& <span class="src-sym">(</span></div></li> <li><div class="src-line"><a name="a3237"></a> <span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id"><a href="class.upload.html#var$image_resize">image_resize</a></span></div></li> <li><div class="src-line"><a name="a3238"></a> || <span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id"><a href="class.upload.html#var$image_convert">image_convert</a> </span>!= <span class="src-str">''</span></div></li> <li><div class="src-line"><a name="a3239"></a> || <a href="http://www.php.net/is_numeric">is_numeric</a><span class="src-sym">(</span><span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id"><a href="class.upload.html#var$image_brightness">image_brightness</a></span><span class="src-sym">)</span></div></li> <li><div class="src-line"><a name="a3240"></a> || <a href="http://www.php.net/is_numeric">is_numeric</a><span class="src-sym">(</span><span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id"><a href="class.upload.html#var$image_contrast">image_contrast</a></span><span class="src-sym">)</span></div></li> <li><div class="src-line"><a name="a3241"></a> || <a href="http://www.php.net/is_numeric">is_numeric</a><span class="src-sym">(</span><span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id"><a href="class.upload.html#var$image_threshold">image_threshold</a></span><span class="src-sym">)</span></div></li> <li><div class="src-line"><a name="a3242"></a> || <span class="src-sym">!</span><span class="src-key">empty</span><span class="src-sym">(</span><span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id"><a href="class.upload.html#var$image_tint_color">image_tint_color</a></span><span class="src-sym">)</span></div></li> <li><div class="src-line"><a name="a3243"></a> || <span class="src-sym">!</span><span class="src-key">empty</span><span class="src-sym">(</span><span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id"><a href="class.upload.html#var$image_overlay_color">image_overlay_color</a></span><span class="src-sym">)</span></div></li> <li><div class="src-line"><a name="a3244"></a> || <span class="src-sym">!</span><span class="src-key">empty</span><span class="src-sym">(</span><span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id"><a href="class.upload.html#var$image_text">image_text</a></span><span class="src-sym">)</span></div></li> <li><div class="src-line"><a name="a3245"></a> || <span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id"><a href="class.upload.html#var$image_greyscale">image_greyscale</a></span></div></li> <li><div class="src-line"><a name="a3246"></a> || <span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id"><a href="class.upload.html#var$image_negative">image_negative</a></span></div></li> <li><div class="src-line"><a name="a3247"></a> || <span class="src-sym">!</span><span class="src-key">empty</span><span class="src-sym">(</span><span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id"><a href="class.upload.html#var$image_watermark">image_watermark</a></span><span class="src-sym">)</span></div></li> <li><div class="src-line"><a name="a3248"></a> || <a href="http://www.php.net/is_numeric">is_numeric</a><span class="src-sym">(</span><span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id"><a href="class.upload.html#var$image_rotate">image_rotate</a></span><span class="src-sym">)</span></div></li> <li><div class="src-line"><a name="a3249"></a> || <a href="http://www.php.net/is_numeric">is_numeric</a><span class="src-sym">(</span><span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id"><a href="class.upload.html#var$jpeg_size">jpeg_size</a></span><span class="src-sym">)</span></div></li> <li><div class="src-line"><a name="a3250"></a> || <span class="src-sym">!</span><span class="src-key">empty</span><span class="src-sym">(</span><span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id"><a href="class.upload.html#var$image_flip">image_flip</a></span><span class="src-sym">)</span></div></li> <li><div class="src-line"><a name="a3251"></a> || <span class="src-sym">!</span><span class="src-key">empty</span><span class="src-sym">(</span><span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id"><a href="class.upload.html#var$image_crop">image_crop</a></span><span class="src-sym">)</span></div></li> <li><div class="src-line"><a name="a3252"></a> || <span class="src-sym">!</span><span class="src-key">empty</span><span class="src-sym">(</span><span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id"><a href="class.upload.html#var$image_precrop">image_precrop</a></span><span class="src-sym">)</span></div></li> <li><div class="src-line"><a name="a3253"></a> || <span class="src-sym">!</span><span class="src-key">empty</span><span class="src-sym">(</span><span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id"><a href="class.upload.html#var$image_border">image_border</a></span><span class="src-sym">)</span></div></li> <li><div class="src-line"><a name="a3254"></a> || <span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id"><a href="class.upload.html#var$image_frame">image_frame</a> </span>> <span class="src-num">0</span></div></li> <li><div class="src-line"><a name="a3255"></a> || <span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id"><a href="class.upload.html#var$image_bevel">image_bevel</a> </span>> <span class="src-num">0</span></div></li> <li><div class="src-line"><a name="a3256"></a> || <span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id"><a href="class.upload.html#var$image_reflection_height">image_reflection_height</a></span><span class="src-sym">))</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a3257"></a> </div></li> <li><div class="src-line"><a name="a3258"></a> <span class="src-key">if </span><span class="src-sym">(</span><span class="src-var">$image_manipulation</span><span class="src-sym">) </span><span class="src-sym">{</span></div></li> <li><div class="src-line"><a name="a3259"></a> <span class="src-key">if </span><span class="src-sym">(</span><span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id"><a href="class.upload.html#var$image_convert">image_convert</a></span>==<span class="src-str">''</span><span class="src-sym">) </span><span class="src-sym">{</span></div></li> <li><div class="src-line"><a name="a3260"></a> <span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id"><a href="class.upload.html#var$file_dst_name">file_dst_name</a> </span>= <span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id"><a href="class.upload.html#var$file_dst_name_body">file_dst_name_body</a> </span>. <span class="src-sym">(</span><span class="src-sym">!</span><span class="src-key">empty</span><span class="src-sym">(</span><span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id"><a href="class.upload.html#var$file_dst_name_ext">file_dst_name_ext</a></span><span class="src-sym">) </span>? <span class="src-str">'.' </span>. <span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id"><a href="class.upload.html#var$file_dst_name_ext">file_dst_name_ext</a> </span>: <span class="src-str">''</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a3261"></a> <span class="src-var">$this</span><span class="src-sym">-></span><a href="http://www.php.net/log">log</a> .= <span class="src-str">'- image operation, keep extension<br />'</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a3262"></a> <span class="src-sym">} </span><span class="src-key">else </span><span class="src-sym">{</span></div></li> <li><div class="src-line"><a name="a3263"></a> <span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id"><a href="class.upload.html#var$file_dst_name">file_dst_name</a> </span>= <span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id"><a href="class.upload.html#var$file_dst_name_body">file_dst_name_body</a> </span>. <span class="src-str">'.' </span>. <span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id"><a href="class.upload.html#var$image_convert">image_convert</a></span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a3264"></a> <span class="src-var">$this</span><span class="src-sym">-></span><a href="http://www.php.net/log">log</a> .= <span class="src-str">'- image operation, change extension for conversion type<br />'</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a3265"></a> <span class="src-sym">}</span></div></li> <li><div class="src-line"><a name="a3266"></a> <span class="src-sym">} </span><span class="src-key">else </span><span class="src-sym">{</span></div></li> <li><div class="src-line"><a name="a3267"></a> <span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id"><a href="class.upload.html#var$file_dst_name">file_dst_name</a> </span>= <span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id"><a href="class.upload.html#var$file_dst_name_body">file_dst_name_body</a> </span>. <span class="src-sym">(</span><span class="src-sym">!</span><span class="src-key">empty</span><span class="src-sym">(</span><span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id"><a href="class.upload.html#var$file_dst_name_ext">file_dst_name_ext</a></span><span class="src-sym">) </span>? <span class="src-str">'.' </span>. <span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id"><a href="class.upload.html#var$file_dst_name_ext">file_dst_name_ext</a> </span>: <span class="src-str">''</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a3268"></a> <span class="src-var">$this</span><span class="src-sym">-></span><a href="http://www.php.net/log">log</a> .= <span class="src-str">'- no image operation, keep extension<br />'</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a3269"></a> <span class="src-sym">}</span></div></li> <li><div class="src-line"><a name="a3270"></a> </div></li> <li><div class="src-line"><a name="a3271"></a> <span class="src-key">if </span><span class="src-sym">(</span><span class="src-sym">!</span><span class="src-var">$return_mode</span><span class="src-sym">) </span><span class="src-sym">{</span></div></li> <li><div class="src-line"><a name="a3272"></a> <span class="src-key">if </span><span class="src-sym">(</span><span class="src-sym">!</span><span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id"><a href="class.upload.html#var$file_auto_rename">file_auto_rename</a></span><span class="src-sym">) </span><span class="src-sym">{</span></div></li> <li><div class="src-line"><a name="a3273"></a> <span class="src-var">$this</span><span class="src-sym">-></span><a href="http://www.php.net/log">log</a> .= <span class="src-str">'- no auto_rename if same filename exists<br />'</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a3274"></a> <span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id">file_dst_pathname </span>= <span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id">file_dst_path </span>. <span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id"><a href="class.upload.html#var$file_dst_name">file_dst_name</a></span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a3275"></a> <span class="src-sym">} </span><span class="src-key">else </span><span class="src-sym">{</span></div></li> <li><div class="src-line"><a name="a3276"></a> <span class="src-var">$this</span><span class="src-sym">-></span><a href="http://www.php.net/log">log</a> .= <span class="src-str">'- checking for auto_rename<br />'</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a3277"></a> <span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id">file_dst_pathname </span>= <span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id">file_dst_path </span>. <span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id"><a href="class.upload.html#var$file_dst_name">file_dst_name</a></span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a3278"></a> <span class="src-var">$body </span>= <span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id"><a href="class.upload.html#var$file_dst_name_body">file_dst_name_body</a></span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a3279"></a> <span class="src-var">$cpt </span>= <span class="src-num">1</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a3280"></a> <span class="src-key">while </span><span class="src-sym">(</span><span class="src-sym">@</span><a href="http://www.php.net/file_exists">file_exists</a><span class="src-sym">(</span><span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id">file_dst_pathname</span><span class="src-sym">)) </span><span class="src-sym">{</span></div></li> <li><div class="src-line"><a name="a3281"></a> <span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id"><a href="class.upload.html#var$file_dst_name_body">file_dst_name_body</a> </span>= <span class="src-var">$body </span>. <span class="src-str">'_' </span>. <span class="src-var">$cpt</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a3282"></a> <span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id"><a href="class.upload.html#var$file_dst_name">file_dst_name</a> </span>= <span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id"><a href="class.upload.html#var$file_dst_name_body">file_dst_name_body</a> </span>. <span class="src-sym">(</span><span class="src-sym">!</span><span class="src-key">empty</span><span class="src-sym">(</span><span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id"><a href="class.upload.html#var$file_dst_name_ext">file_dst_name_ext</a></span><span class="src-sym">) </span>? <span class="src-str">'.' </span>. <span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id"><a href="class.upload.html#var$file_dst_name_ext">file_dst_name_ext</a> </span>: <span class="src-str">''</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a3283"></a> <span class="src-var">$cpt</span>++<span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a3284"></a> <span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id">file_dst_pathname </span>= <span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id">file_dst_path </span>. <span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id"><a href="class.upload.html#var$file_dst_name">file_dst_name</a></span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a3285"></a> <span class="src-sym">}</span></div></li> <li><div class="src-line"><a name="a3286"></a> <span class="src-key">if </span><span class="src-sym">(</span><span class="src-var">$cpt</span>><span class="src-num">1</span><span class="src-sym">) </span><span class="src-var">$this</span><span class="src-sym">-></span><a href="http://www.php.net/log">log</a> .= <span class="src-str">'&nbsp;&nbsp;&nbsp;&nbsp;auto_rename to ' </span>. <span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id"><a href="class.upload.html#var$file_dst_name">file_dst_name</a> </span>. <span class="src-str">'<br />'</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a3287"></a> <span class="src-sym">}</span></div></li> <li><div class="src-line"><a name="a3288"></a> </div></li> <li><div class="src-line"><a name="a3289"></a> <span class="src-var">$this</span><span class="src-sym">-></span><a href="http://www.php.net/log">log</a> .= <span class="src-str">'- destination file details<br />'</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a3290"></a> <span class="src-var">$this</span><span class="src-sym">-></span><a href="http://www.php.net/log">log</a> .= <span class="src-str">'&nbsp;&nbsp;&nbsp;&nbsp;file_dst_name : ' </span>. <span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id"><a href="class.upload.html#var$file_dst_name">file_dst_name</a> </span>. <span class="src-str">'<br />'</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a3291"></a> <span class="src-var">$this</span><span class="src-sym">-></span><a href="http://www.php.net/log">log</a> .= <span class="src-str">'&nbsp;&nbsp;&nbsp;&nbsp;file_dst_pathname : ' </span>. <span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id">file_dst_pathname </span>. <span class="src-str">'<br />'</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a3292"></a> </div></li> <li><div class="src-line"><a name="a3293"></a> <span class="src-key">if </span><span class="src-sym">(</span><span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id"><a href="class.upload.html#var$file_overwrite">file_overwrite</a></span><span class="src-sym">) </span><span class="src-sym">{</span></div></li> <li><div class="src-line"><a name="a3294"></a> <span class="src-var">$this</span><span class="src-sym">-></span><a href="http://www.php.net/log">log</a> .= <span class="src-str">'- no overwrite checking<br />'</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a3295"></a> <span class="src-sym">} </span><span class="src-key">else </span><span class="src-sym">{</span></div></li> <li><div class="src-line"><a name="a3296"></a> <span class="src-key">if </span><span class="src-sym">(</span><span class="src-sym">@</span><a href="http://www.php.net/file_exists">file_exists</a><span class="src-sym">(</span><span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id">file_dst_pathname</span><span class="src-sym">)) </span><span class="src-sym">{</span></div></li> <li><div class="src-line"><a name="a3297"></a> <span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id"><a href="class.upload.html#var$processed">processed</a> </span>= <span class="src-id">false</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a3298"></a> <span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id"><a href="class.upload.html#var$error">error</a> </span>= <span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id">translate</span><span class="src-sym">(</span><span class="src-str">'already_exists'</span><span class="src-sym">, </span><span class="src-key">array</span><span class="src-sym">(</span><span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id"><a href="class.upload.html#var$file_dst_name">file_dst_name</a></span><span class="src-sym">))</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a3299"></a> <span class="src-sym">} </span><span class="src-key">else </span><span class="src-sym">{</span></div></li> <li><div class="src-line"><a name="a3300"></a> <span class="src-var">$this</span><span class="src-sym">-></span><a href="http://www.php.net/log">log</a> .= <span class="src-str">'- ' </span>. <span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id"><a href="class.upload.html#var$file_dst_name">file_dst_name</a> </span>. <span class="src-str">' doesn\'t exist already<br />'</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a3301"></a> <span class="src-sym">}</span></div></li> <li><div class="src-line"><a name="a3302"></a> <span class="src-sym">}</span></div></li> <li><div class="src-line"><a name="a3303"></a> <span class="src-sym">}</span></div></li> <li><div class="src-line"><a name="a3304"></a> <span class="src-sym">}</span></div></li> <li><div class="src-line"><a name="a3305"></a> </div></li> <li><div class="src-line"><a name="a3306"></a> <span class="src-key">if </span><span class="src-sym">(</span><span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id"><a href="class.upload.html#var$processed">processed</a></span><span class="src-sym">) </span><span class="src-sym">{</span></div></li> <li><div class="src-line"><a name="a3307"></a> <span class="src-comm">// if we have already moved the uploaded file, we use the temporary copy as source file, and check if it exists</span></div></li> <li><div class="src-line"><a name="a3308"></a> <span class="src-key">if </span><span class="src-sym">(</span><span class="src-sym">!</span><span class="src-key">empty</span><span class="src-sym">(</span><span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id">file_src_temp</span><span class="src-sym">)) </span><span class="src-sym">{</span></div></li> <li><div class="src-line"><a name="a3309"></a> <span class="src-var">$this</span><span class="src-sym">-></span><a href="http://www.php.net/log">log</a> .= <span class="src-str">'- use the temp file instead of the original file since it is a second process<br />'</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a3310"></a> <span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id">file_src_pathname </span>= <span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id">file_src_temp</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a3311"></a> <span class="src-key">if </span><span class="src-sym">(</span><span class="src-sym">!</span><a href="http://www.php.net/file_exists">file_exists</a><span class="src-sym">(</span><span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id">file_src_pathname</span><span class="src-sym">)) </span><span class="src-sym">{</span></div></li> <li><div class="src-line"><a name="a3312"></a> <span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id"><a href="class.upload.html#var$processed">processed</a> </span>= <span class="src-id">false</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a3313"></a> <span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id"><a href="class.upload.html#var$error">error</a> </span>= <span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id">translate</span><span class="src-sym">(</span><span class="src-str">'temp_file_missing'</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a3314"></a> <span class="src-sym">}</span></div></li> <li><div class="src-line"><a name="a3315"></a> <span class="src-comm">// if we haven't a temp file, and that we do check on uploads, we use is_uploaded_file()</span></div></li> <li><div class="src-line"><a name="a3316"></a> <span class="src-sym">} </span><span class="src-key">else </span><span class="src-key">if </span><span class="src-sym">(</span><span class="src-sym">!</span><span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id"><a href="class.upload.html#var$no_upload_check">no_upload_check</a></span><span class="src-sym">) </span><span class="src-sym">{</span></div></li> <li><div class="src-line"><a name="a3317"></a> <span class="src-key">if </span><span class="src-sym">(</span><span class="src-sym">!</span><a href="http://www.php.net/is_uploaded_file">is_uploaded_file</a><span class="src-sym">(</span><span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id">file_src_pathname</span><span class="src-sym">)) </span><span class="src-sym">{</span></div></li> <li><div class="src-line"><a name="a3318"></a> <span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id"><a href="class.upload.html#var$processed">processed</a> </span>= <span class="src-id">false</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a3319"></a> <span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id"><a href="class.upload.html#var$error">error</a> </span>= <span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id">translate</span><span class="src-sym">(</span><span class="src-str">'source_missing'</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a3320"></a> <span class="src-sym">}</span></div></li> <li><div class="src-line"><a name="a3321"></a> <span class="src-comm">// otherwise, if we don't check on uploaded files (local file for instance), we use file_exists()</span></div></li> <li><div class="src-line"><a name="a3322"></a> <span class="src-sym">} </span><span class="src-key">else </span><span class="src-sym">{</span></div></li> <li><div class="src-line"><a name="a3323"></a> <span class="src-key">if </span><span class="src-sym">(</span><span class="src-sym">!</span><a href="http://www.php.net/file_exists">file_exists</a><span class="src-sym">(</span><span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id">file_src_pathname</span><span class="src-sym">)) </span><span class="src-sym">{</span></div></li> <li><div class="src-line"><a name="a3324"></a> <span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id"><a href="class.upload.html#var$processed">processed</a> </span>= <span class="src-id">false</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a3325"></a> <span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id"><a href="class.upload.html#var$error">error</a> </span>= <span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id">translate</span><span class="src-sym">(</span><span class="src-str">'source_missing'</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a3326"></a> <span class="src-sym">}</span></div></li> <li><div class="src-line"><a name="a3327"></a> <span class="src-sym">}</span></div></li> <li><div class="src-line"><a name="a3328"></a> </div></li> <li><div class="src-line"><a name="a3329"></a> <span class="src-comm">// checks if the destination directory exists, and attempt to create it</span></div></li> <li><div class="src-line"><a name="a3330"></a> <span class="src-key">if </span><span class="src-sym">(</span><span class="src-sym">!</span><span class="src-var">$return_mode</span><span class="src-sym">) </span><span class="src-sym">{</span></div></li> <li><div class="src-line"><a name="a3331"></a> <span class="src-key">if </span><span class="src-sym">(</span><span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id"><a href="class.upload.html#var$processed">processed</a> </span>&& <span class="src-sym">!</span><a href="http://www.php.net/file_exists">file_exists</a><span class="src-sym">(</span><span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id">file_dst_path</span><span class="src-sym">)) </span><span class="src-sym">{</span></div></li> <li><div class="src-line"><a name="a3332"></a> <span class="src-key">if </span><span class="src-sym">(</span><span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id"><a href="class.upload.html#var$dir_auto_create">dir_auto_create</a></span><span class="src-sym">) </span><span class="src-sym">{</span></div></li> <li><div class="src-line"><a name="a3333"></a> <span class="src-var">$this</span><span class="src-sym">-></span><a href="http://www.php.net/log">log</a> .= <span class="src-str">'- ' </span>. <span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id">file_dst_path </span>. <span class="src-str">' doesn\'t exist. Attempting creation:'</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a3334"></a> <span class="src-key">if </span><span class="src-sym">(</span><span class="src-sym">!</span><span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id">rmkdir</span><span class="src-sym">(</span><span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id">file_dst_path</span><span class="src-sym">, </span><span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id"><a href="class.upload.html#var$dir_chmod">dir_chmod</a></span><span class="src-sym">)) </span><span class="src-sym">{</span></div></li> <li><div class="src-line"><a name="a3335"></a> <span class="src-var">$this</span><span class="src-sym">-></span><a href="http://www.php.net/log">log</a> .= <span class="src-str">' failed<br />'</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a3336"></a> <span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id"><a href="class.upload.html#var$processed">processed</a> </span>= <span class="src-id">false</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a3337"></a> <span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id"><a href="class.upload.html#var$error">error</a> </span>= <span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id">translate</span><span class="src-sym">(</span><span class="src-str">'destination_dir'</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a3338"></a> <span class="src-sym">} </span><span class="src-key">else </span><span class="src-sym">{</span></div></li> <li><div class="src-line"><a name="a3339"></a> <span class="src-var">$this</span><span class="src-sym">-></span><a href="http://www.php.net/log">log</a> .= <span class="src-str">' success<br />'</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a3340"></a> <span class="src-sym">}</span></div></li> <li><div class="src-line"><a name="a3341"></a> <span class="src-sym">} </span><span class="src-key">else </span><span class="src-sym">{</span></div></li> <li><div class="src-line"><a name="a3342"></a> <span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id"><a href="class.upload.html#var$error">error</a> </span>= <span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id">translate</span><span class="src-sym">(</span><span class="src-str">'destination_dir_missing'</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a3343"></a> <span class="src-sym">}</span></div></li> <li><div class="src-line"><a name="a3344"></a> <span class="src-sym">}</span></div></li> <li><div class="src-line"><a name="a3345"></a> </div></li> <li><div class="src-line"><a name="a3346"></a> <span class="src-key">if </span><span class="src-sym">(</span><span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id"><a href="class.upload.html#var$processed">processed</a> </span>&& <span class="src-sym">!</span><a href="http://www.php.net/is_dir">is_dir</a><span class="src-sym">(</span><span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id">file_dst_path</span><span class="src-sym">)) </span><span class="src-sym">{</span></div></li> <li><div class="src-line"><a name="a3347"></a> <span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id"><a href="class.upload.html#var$processed">processed</a> </span>= <span class="src-id">false</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a3348"></a> <span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id"><a href="class.upload.html#var$error">error</a> </span>= <span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id">translate</span><span class="src-sym">(</span><span class="src-str">'destination_path_not_dir'</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a3349"></a> <span class="src-sym">}</span></div></li> <li><div class="src-line"><a name="a3350"></a> </div></li> <li><div class="src-line"><a name="a3351"></a> <span class="src-comm">// checks if the destination directory is writeable, and attempt to make it writeable</span></div></li> <li><div class="src-line"><a name="a3352"></a> <span class="src-var">$hash </span>= <a href="http://www.php.net/md5">md5</a><span class="src-sym">(</span><span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id"><a href="class.upload.html#var$file_dst_name_body">file_dst_name_body</a> </span>. <a href="http://www.php.net/rand">rand</a><span class="src-sym">(</span><span class="src-num">1</span><span class="src-sym">, </span><span class="src-num">1000</span><span class="src-sym">))</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a3353"></a> <span class="src-key">if </span><span class="src-sym">(</span><span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id"><a href="class.upload.html#var$processed">processed</a> </span>&& <span class="src-sym">!</span><span class="src-sym">(</span><span class="src-var">$f </span>= <span class="src-sym">@</span><a href="http://www.php.net/fopen">fopen</a><span class="src-sym">(</span><span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id">file_dst_path </span>. <span class="src-var">$hash </span>. <span class="src-str">'.' </span>. <span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id"><a href="class.upload.html#var$file_dst_name_ext">file_dst_name_ext</a></span><span class="src-sym">, </span><span class="src-str">'a+'</span><span class="src-sym">))) </span><span class="src-sym">{</span></div></li> <li><div class="src-line"><a name="a3354"></a> <span class="src-key">if </span><span class="src-sym">(</span><span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id"><a href="class.upload.html#var$dir_auto_chmod">dir_auto_chmod</a></span><span class="src-sym">) </span><span class="src-sym">{</span></div></li> <li><div class="src-line"><a name="a3355"></a> <span class="src-var">$this</span><span class="src-sym">-></span><a href="http://www.php.net/log">log</a> .= <span class="src-str">'- ' </span>. <span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id">file_dst_path </span>. <span class="src-str">' is not writeable. Attempting chmod:'</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a3356"></a> <span class="src-key">if </span><span class="src-sym">(</span><span class="src-sym">!</span><span class="src-sym">@</span><a href="http://www.php.net/chmod">chmod</a><span class="src-sym">(</span><span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id">file_dst_path</span><span class="src-sym">, </span><span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id"><a href="class.upload.html#var$dir_chmod">dir_chmod</a></span><span class="src-sym">)) </span><span class="src-sym">{</span></div></li> <li><div class="src-line"><a name="a3357"></a> <span class="src-var">$this</span><span class="src-sym">-></span><a href="http://www.php.net/log">log</a> .= <span class="src-str">' failed<br />'</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a3358"></a> <span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id"><a href="class.upload.html#var$processed">processed</a> </span>= <span class="src-id">false</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a3359"></a> <span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id"><a href="class.upload.html#var$error">error</a> </span>= <span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id">translate</span><span class="src-sym">(</span><span class="src-str">'destination_dir_write'</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a3360"></a> <span class="src-sym">} </span><span class="src-key">else </span><span class="src-sym">{</span></div></li> <li><div class="src-line"><a name="a3361"></a> <span class="src-var">$this</span><span class="src-sym">-></span><a href="http://www.php.net/log">log</a> .= <span class="src-str">' success<br />'</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a3362"></a> <span class="src-key">if </span><span class="src-sym">(</span><span class="src-sym">!</span><span class="src-sym">(</span><span class="src-var">$f </span>= <span class="src-sym">@</span><a href="http://www.php.net/fopen">fopen</a><span class="src-sym">(</span><span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id">file_dst_path </span>. <span class="src-var">$hash </span>. <span class="src-str">'.' </span>. <span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id"><a href="class.upload.html#var$file_dst_name_ext">file_dst_name_ext</a></span><span class="src-sym">, </span><span class="src-str">'a+'</span><span class="src-sym">))) </span><span class="src-sym">{ </span><span class="src-comm">// we re-check</span></div></li> <li><div class="src-line"><a name="a3363"></a> <span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id"><a href="class.upload.html#var$processed">processed</a> </span>= <span class="src-id">false</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a3364"></a> <span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id"><a href="class.upload.html#var$error">error</a> </span>= <span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id">translate</span><span class="src-sym">(</span><span class="src-str">'destination_dir_write'</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a3365"></a> <span class="src-sym">} </span><span class="src-key">else </span><span class="src-sym">{</span></div></li> <li><div class="src-line"><a name="a3366"></a> <span class="src-sym">@</span><a href="http://www.php.net/fclose">fclose</a><span class="src-sym">(</span><span class="src-var">$f</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a3367"></a> <span class="src-sym">}</span></div></li> <li><div class="src-line"><a name="a3368"></a> <span class="src-sym">}</span></div></li> <li><div class="src-line"><a name="a3369"></a> <span class="src-sym">} </span><span class="src-key">else </span><span class="src-sym">{</span></div></li> <li><div class="src-line"><a name="a3370"></a> <span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id"><a href="class.upload.html#var$processed">processed</a> </span>= <span class="src-id">false</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a3371"></a> <span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id"><a href="class.upload.html#var$error">error</a> </span>= <span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id">translate</span><span class="src-sym">(</span><span class="src-str">'destination_path_write'</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a3372"></a> <span class="src-sym">}</span></div></li> <li><div class="src-line"><a name="a3373"></a> <span class="src-sym">} </span><span class="src-key">else </span><span class="src-sym">{</span></div></li> <li><div class="src-line"><a name="a3374"></a> <span class="src-key">if </span><span class="src-sym">(</span><span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id"><a href="class.upload.html#var$processed">processed</a></span><span class="src-sym">) </span><span class="src-sym">@</span><a href="http://www.php.net/fclose">fclose</a><span class="src-sym">(</span><span class="src-var">$f</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a3375"></a> <span class="src-sym">@</span><a href="http://www.php.net/unlink">unlink</a><span class="src-sym">(</span><span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id">file_dst_path </span>. <span class="src-var">$hash </span>. <span class="src-str">'.' </span>. <span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id"><a href="class.upload.html#var$file_dst_name_ext">file_dst_name_ext</a></span><span class="src-sym">)</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a3376"></a> <span class="src-sym">}</span></div></li> <li><div class="src-line"><a name="a3377"></a> </div></li> <li><div class="src-line"><a name="a3378"></a> </div></li> <li><div class="src-line"><a name="a3379"></a> <span class="src-comm">// if we have an uploaded file, and if it is the first process, and if we can't access the file directly (open_basedir restriction)</span></div></li> <li><div class="src-line"><a name="a3380"></a> <span class="src-comm">// then we create a temp file that will be used as the source file in subsequent processes</span></div></li> <li><div class="src-line"><a name="a3381"></a> <span class="src-comm">// the third condition is there to check if the file is not accessible *directly* (it already has positively gone through is_uploaded_file(), so it exists)</span></div></li> <li><div class="src-line"><a name="a3382"></a> <span class="src-key">if </span><span class="src-sym">(</span><span class="src-sym">!</span><span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id"><a href="class.upload.html#var$no_upload_check">no_upload_check</a> </span>&& <span class="src-key">empty</span><span class="src-sym">(</span><span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id">file_src_temp</span><span class="src-sym">) </span>&& <span class="src-sym">!</span><span class="src-sym">@</span><a href="http://www.php.net/file_exists">file_exists</a><span class="src-sym">(</span><span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id">file_src_pathname</span><span class="src-sym">)) </span><span class="src-sym">{</span></div></li> <li><div class="src-line"><a name="a3383"></a> <span class="src-var">$this</span><span class="src-sym">-></span><a href="http://www.php.net/log">log</a> .= <span class="src-str">'- attempting to use a temp file:'</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a3384"></a> <span class="src-var">$hash </span>= <a href="http://www.php.net/md5">md5</a><span class="src-sym">(</span><span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id"><a href="class.upload.html#var$file_dst_name_body">file_dst_name_body</a> </span>. <a href="http://www.php.net/rand">rand</a><span class="src-sym">(</span><span class="src-num">1</span><span class="src-sym">, </span><span class="src-num">1000</span><span class="src-sym">))</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a3385"></a> <span class="src-key">if </span><span class="src-sym">(</span><a href="http://www.php.net/move_uploaded_file">move_uploaded_file</a><span class="src-sym">(</span><span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id">file_src_pathname</span><span class="src-sym">, </span><span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id">file_dst_path </span>. <span class="src-var">$hash </span>. <span class="src-str">'.' </span>. <span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id"><a href="class.upload.html#var$file_dst_name_ext">file_dst_name_ext</a></span><span class="src-sym">)) </span><span class="src-sym">{</span></div></li> <li><div class="src-line"><a name="a3386"></a> <span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id">file_src_pathname </span>= <span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id">file_dst_path </span>. <span class="src-var">$hash </span>. <span class="src-str">'.' </span>. <span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id"><a href="class.upload.html#var$file_dst_name_ext">file_dst_name_ext</a></span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a3387"></a> <span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id">file_src_temp </span>= <span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id">file_src_pathname</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a3388"></a> <span class="src-var">$this</span><span class="src-sym">-></span><a href="http://www.php.net/log">log</a> .= <span class="src-str">' file created<br />'</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a3389"></a> <span class="src-var">$this</span><span class="src-sym">-></span><a href="http://www.php.net/log">log</a> .= <span class="src-str">'&nbsp;&nbsp;&nbsp;&nbsp;temp file is: ' </span>. <span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id">file_src_temp </span>. <span class="src-str">'<br />'</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a3390"></a> <span class="src-sym">} </span><span class="src-key">else </span><span class="src-sym">{</span></div></li> <li><div class="src-line"><a name="a3391"></a> <span class="src-var">$this</span><span class="src-sym">-></span><a href="http://www.php.net/log">log</a> .= <span class="src-str">' failed<br />'</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a3392"></a> <span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id"><a href="class.upload.html#var$processed">processed</a> </span>= <span class="src-id">false</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a3393"></a> <span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id"><a href="class.upload.html#var$error">error</a> </span>= <span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id">translate</span><span class="src-sym">(</span><span class="src-str">'temp_file'</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a3394"></a> <span class="src-sym">}</span></div></li> <li><div class="src-line"><a name="a3395"></a> <span class="src-sym">}</span></div></li> <li><div class="src-line"><a name="a3396"></a> <span class="src-sym">}</span></div></li> <li><div class="src-line"><a name="a3397"></a> <span class="src-sym">}</span></div></li> <li><div class="src-line"><a name="a3398"></a> </div></li> <li><div class="src-line"><a name="a3399"></a> <span class="src-key">if </span><span class="src-sym">(</span><span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id"><a href="class.upload.html#var$processed">processed</a></span><span class="src-sym">) </span><span class="src-sym">{</span></div></li> <li><div class="src-line"><a name="a3400"></a> </div></li> <li><div class="src-line"><a name="a3401"></a> <span class="src-comm">// we do a quick check to ensure the file is really an image</span></div></li> <li><div class="src-line"><a name="a3402"></a> <span class="src-comm">// we can do this only now, as it would have failed before in case of open_basedir</span></div></li> <li><div class="src-line"><a name="a3403"></a> <span class="src-key">if </span><span class="src-sym">(</span><span class="src-var">$image_manipulation </span>&& <span class="src-sym">!</span><span class="src-sym">@</span><a href="http://www.php.net/getimagesize">getimagesize</a><span class="src-sym">(</span><span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id">file_src_pathname</span><span class="src-sym">)) </span><span class="src-sym">{</span></div></li> <li><div class="src-line"><a name="a3404"></a> <span class="src-var">$this</span><span class="src-sym">-></span><a href="http://www.php.net/log">log</a> .= <span class="src-str">'- the file is not an image!<br />'</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a3405"></a> <span class="src-var">$image_manipulation </span>= <span class="src-id">false</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a3406"></a> <span class="src-sym">}</span></div></li> <li><div class="src-line"><a name="a3407"></a> </div></li> <li><div class="src-line"><a name="a3408"></a> <span class="src-key">if </span><span class="src-sym">(</span><span class="src-var">$image_manipulation</span><span class="src-sym">) </span><span class="src-sym">{</span></div></li> <li><div class="src-line"><a name="a3409"></a> </div></li> <li><div class="src-line"><a name="a3410"></a> <span class="src-comm">// checks if the source file is readable</span></div></li> <li><div class="src-line"><a name="a3411"></a> <span class="src-key">if </span><span class="src-sym">(</span><span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id"><a href="class.upload.html#var$processed">processed</a> </span>&& <span class="src-sym">!</span><span class="src-sym">(</span><span class="src-var">$f </span>= <span class="src-sym">@</span><a href="http://www.php.net/fopen">fopen</a><span class="src-sym">(</span><span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id">file_src_pathname</span><span class="src-sym">, </span><span class="src-str">'r'</span><span class="src-sym">))) </span><span class="src-sym">{</span></div></li> <li><div class="src-line"><a name="a3412"></a> <span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id"><a href="class.upload.html#var$processed">processed</a> </span>= <span class="src-id">false</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a3413"></a> <span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id"><a href="class.upload.html#var$error">error</a> </span>= <span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id">translate</span><span class="src-sym">(</span><span class="src-str">'source_not_readable'</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a3414"></a> <span class="src-sym">} </span><span class="src-key">else </span><span class="src-sym">{</span></div></li> <li><div class="src-line"><a name="a3415"></a> <span class="src-sym">@</span><a href="http://www.php.net/fclose">fclose</a><span class="src-sym">(</span><span class="src-var">$f</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a3416"></a> <span class="src-sym">}</span></div></li> <li><div class="src-line"><a name="a3417"></a> </div></li> <li><div class="src-line"><a name="a3418"></a> <span class="src-comm">// we now do all the image manipulations</span></div></li> <li><div class="src-line"><a name="a3419"></a> <span class="src-var">$this</span><span class="src-sym">-></span><a href="http://www.php.net/log">log</a> .= <span class="src-str">'- image resizing or conversion wanted<br />'</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a3420"></a> <span class="src-key">if </span><span class="src-sym">(</span><span class="src-var">$this</span><span class="src-sym">-></span><a href="class.upload.html#methodgdversion">gdversion</a><span class="src-sym">(</span><span class="src-sym">)) </span><span class="src-sym">{</span></div></li> <li><div class="src-line"><a name="a3421"></a> <span class="src-key">switch</span><span class="src-sym">(</span><span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id">image_src_type</span><span class="src-sym">) </span><span class="src-sym">{</span></div></li> <li><div class="src-line"><a name="a3422"></a> <span class="src-key">case </span><span class="src-str">'jpg'</span>:</div></li> <li><div class="src-line"><a name="a3423"></a> <span class="src-key">if </span><span class="src-sym">(</span><span class="src-sym">!</span><a href="http://www.php.net/function_exists">function_exists</a><span class="src-sym">(</span><span class="src-str">'imagecreatefromjpeg'</span><span class="src-sym">)) </span><span class="src-sym">{</span></div></li> <li><div class="src-line"><a name="a3424"></a> <span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id"><a href="class.upload.html#var$processed">processed</a> </span>= <span class="src-id">false</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a3425"></a> <span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id"><a href="class.upload.html#var$error">error</a> </span>= <span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id">translate</span><span class="src-sym">(</span><span class="src-str">'no_create_support'</span><span class="src-sym">, </span><span class="src-key">array</span><span class="src-sym">(</span><span class="src-str">'JPEG'</span><span class="src-sym">))</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a3426"></a> <span class="src-sym">} </span><span class="src-key">else </span><span class="src-sym">{</span></div></li> <li><div class="src-line"><a name="a3427"></a> <span class="src-var">$image_src </span>= <span class="src-sym">@</span><a href="http://www.php.net/imagecreatefromjpeg">imagecreatefromjpeg</a><span class="src-sym">(</span><span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id">file_src_pathname</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a3428"></a> <span class="src-key">if </span><span class="src-sym">(</span><span class="src-sym">!</span><span class="src-var">$image_src</span><span class="src-sym">) </span><span class="src-sym">{</span></div></li> <li><div class="src-line"><a name="a3429"></a> <span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id"><a href="class.upload.html#var$processed">processed</a> </span>= <span class="src-id">false</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a3430"></a> <span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id"><a href="class.upload.html#var$error">error</a> </span>= <span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id">translate</span><span class="src-sym">(</span><span class="src-str">'create_error'</span><span class="src-sym">, </span><span class="src-key">array</span><span class="src-sym">(</span><span class="src-str">'JPEG'</span><span class="src-sym">))</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a3431"></a> <span class="src-sym">} </span><span class="src-key">else </span><span class="src-sym">{</span></div></li> <li><div class="src-line"><a name="a3432"></a> <span class="src-var">$this</span><span class="src-sym">-></span><a href="http://www.php.net/log">log</a> .= <span class="src-str">'- source image is JPEG<br />'</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a3433"></a> <span class="src-sym">}</span></div></li> <li><div class="src-line"><a name="a3434"></a> <span class="src-sym">}</span></div></li> <li><div class="src-line"><a name="a3435"></a> <span class="src-key">break</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a3436"></a> <span class="src-key">case </span><span class="src-str">'png'</span>:</div></li> <li><div class="src-line"><a name="a3437"></a> <span class="src-key">if </span><span class="src-sym">(</span><span class="src-sym">!</span><a href="http://www.php.net/function_exists">function_exists</a><span class="src-sym">(</span><span class="src-str">'imagecreatefrompng'</span><span class="src-sym">)) </span><span class="src-sym">{</span></div></li> <li><div class="src-line"><a name="a3438"></a> <span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id"><a href="class.upload.html#var$processed">processed</a> </span>= <span class="src-id">false</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a3439"></a> <span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id"><a href="class.upload.html#var$error">error</a> </span>= <span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id">translate</span><span class="src-sym">(</span><span class="src-str">'no_create_support'</span><span class="src-sym">, </span><span class="src-key">array</span><span class="src-sym">(</span><span class="src-str">'PNG'</span><span class="src-sym">))</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a3440"></a> <span class="src-sym">} </span><span class="src-key">else </span><span class="src-sym">{</span></div></li> <li><div class="src-line"><a name="a3441"></a> <span class="src-var">$image_src </span>= <span class="src-sym">@</span><a href="http://www.php.net/imagecreatefrompng">imagecreatefrompng</a><span class="src-sym">(</span><span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id">file_src_pathname</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a3442"></a> <span class="src-key">if </span><span class="src-sym">(</span><span class="src-sym">!</span><span class="src-var">$image_src</span><span class="src-sym">) </span><span class="src-sym">{</span></div></li> <li><div class="src-line"><a name="a3443"></a> <span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id"><a href="class.upload.html#var$processed">processed</a> </span>= <span class="src-id">false</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a3444"></a> <span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id"><a href="class.upload.html#var$error">error</a> </span>= <span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id">translate</span><span class="src-sym">(</span><span class="src-str">'create_error'</span><span class="src-sym">, </span><span class="src-key">array</span><span class="src-sym">(</span><span class="src-str">'PNG'</span><span class="src-sym">))</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a3445"></a> <span class="src-sym">} </span><span class="src-key">else </span><span class="src-sym">{</span></div></li> <li><div class="src-line"><a name="a3446"></a> <span class="src-var">$this</span><span class="src-sym">-></span><a href="http://www.php.net/log">log</a> .= <span class="src-str">'- source image is PNG<br />'</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a3447"></a> <span class="src-sym">}</span></div></li> <li><div class="src-line"><a name="a3448"></a> <span class="src-sym">}</span></div></li> <li><div class="src-line"><a name="a3449"></a> <span class="src-key">break</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a3450"></a> <span class="src-key">case </span><span class="src-str">'gif'</span>:</div></li> <li><div class="src-line"><a name="a3451"></a> <span class="src-key">if </span><span class="src-sym">(</span><span class="src-sym">!</span><a href="http://www.php.net/function_exists">function_exists</a><span class="src-sym">(</span><span class="src-str">'imagecreatefromgif'</span><span class="src-sym">)) </span><span class="src-sym">{</span></div></li> <li><div class="src-line"><a name="a3452"></a> <span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id"><a href="class.upload.html#var$processed">processed</a> </span>= <span class="src-id">false</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a3453"></a> <span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id"><a href="class.upload.html#var$error">error</a> </span>= <span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id">translate</span><span class="src-sym">(</span><span class="src-str">'no_create_support'</span><span class="src-sym">, </span><span class="src-key">array</span><span class="src-sym">(</span><span class="src-str">'GIF'</span><span class="src-sym">))</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a3454"></a> <span class="src-sym">} </span><span class="src-key">else </span><span class="src-sym">{</span></div></li> <li><div class="src-line"><a name="a3455"></a> <span class="src-var">$image_src </span>= <span class="src-sym">@</span><a href="http://www.php.net/imagecreatefromgif">imagecreatefromgif</a><span class="src-sym">(</span><span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id">file_src_pathname</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a3456"></a> <span class="src-key">if </span><span class="src-sym">(</span><span class="src-sym">!</span><span class="src-var">$image_src</span><span class="src-sym">) </span><span class="src-sym">{</span></div></li> <li><div class="src-line"><a name="a3457"></a> <span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id"><a href="class.upload.html#var$processed">processed</a> </span>= <span class="src-id">false</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a3458"></a> <span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id"><a href="class.upload.html#var$error">error</a> </span>= <span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id">translate</span><span class="src-sym">(</span><span class="src-str">'create_error'</span><span class="src-sym">, </span><span class="src-key">array</span><span class="src-sym">(</span><span class="src-str">'GIF'</span><span class="src-sym">))</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a3459"></a> <span class="src-sym">} </span><span class="src-key">else </span><span class="src-sym">{</span></div></li> <li><div class="src-line"><a name="a3460"></a> <span class="src-var">$this</span><span class="src-sym">-></span><a href="http://www.php.net/log">log</a> .= <span class="src-str">'- source image is GIF<br />'</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a3461"></a> <span class="src-sym">}</span></div></li> <li><div class="src-line"><a name="a3462"></a> <span class="src-sym">}</span></div></li> <li><div class="src-line"><a name="a3463"></a> <span class="src-key">break</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a3464"></a> <span class="src-key">case </span><span class="src-str">'bmp'</span>:</div></li> <li><div class="src-line"><a name="a3465"></a> <span class="src-key">if </span><span class="src-sym">(</span><span class="src-sym">!</span><a href="http://www.php.net/method_exists">method_exists</a><span class="src-sym">(</span><span class="src-var">$this</span><span class="src-sym">, </span><span class="src-str">'imagecreatefrombmp'</span><span class="src-sym">)) </span><span class="src-sym">{</span></div></li> <li><div class="src-line"><a name="a3466"></a> <span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id"><a href="class.upload.html#var$processed">processed</a> </span>= <span class="src-id">false</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a3467"></a> <span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id"><a href="class.upload.html#var$error">error</a> </span>= <span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id">translate</span><span class="src-sym">(</span><span class="src-str">'no_create_support'</span><span class="src-sym">, </span><span class="src-key">array</span><span class="src-sym">(</span><span class="src-str">'BMP'</span><span class="src-sym">))</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a3468"></a> <span class="src-sym">} </span><span class="src-key">else </span><span class="src-sym">{</span></div></li> <li><div class="src-line"><a name="a3469"></a> <span class="src-var">$image_src </span>= <span class="src-sym">@</span><span class="src-var">$this</span><span class="src-sym">-></span><a href="class.upload.html#methodimagecreatefrombmp">imagecreatefrombmp</a><span class="src-sym">(</span><span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id">file_src_pathname</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a3470"></a> <span class="src-key">if </span><span class="src-sym">(</span><span class="src-sym">!</span><span class="src-var">$image_src</span><span class="src-sym">) </span><span class="src-sym">{</span></div></li> <li><div class="src-line"><a name="a3471"></a> <span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id"><a href="class.upload.html#var$processed">processed</a> </span>= <span class="src-id">false</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a3472"></a> <span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id"><a href="class.upload.html#var$error">error</a> </span>= <span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id">translate</span><span class="src-sym">(</span><span class="src-str">'create_error'</span><span class="src-sym">, </span><span class="src-key">array</span><span class="src-sym">(</span><span class="src-str">'BMP'</span><span class="src-sym">))</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a3473"></a> <span class="src-sym">} </span><span class="src-key">else </span><span class="src-sym">{</span></div></li> <li><div class="src-line"><a name="a3474"></a> <span class="src-var">$this</span><span class="src-sym">-></span><a href="http://www.php.net/log">log</a> .= <span class="src-str">'- source image is BMP<br />'</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a3475"></a> <span class="src-sym">}</span></div></li> <li><div class="src-line"><a name="a3476"></a> <span class="src-sym">}</span></div></li> <li><div class="src-line"><a name="a3477"></a> <span class="src-key">break</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a3478"></a> <span class="src-key">default</span>:</div></li> <li><div class="src-line"><a name="a3479"></a> <span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id"><a href="class.upload.html#var$processed">processed</a> </span>= <span class="src-id">false</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a3480"></a> <span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id"><a href="class.upload.html#var$error">error</a> </span>= <span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id">translate</span><span class="src-sym">(</span><span class="src-str">'source_invalid'</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a3481"></a> <span class="src-sym">}</span></div></li> <li><div class="src-line"><a name="a3482"></a> <span class="src-sym">} </span><span class="src-key">else </span><span class="src-sym">{</span></div></li> <li><div class="src-line"><a name="a3483"></a> <span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id"><a href="class.upload.html#var$processed">processed</a> </span>= <span class="src-id">false</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a3484"></a> <span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id"><a href="class.upload.html#var$error">error</a> </span>= <span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id">translate</span><span class="src-sym">(</span><span class="src-str">'gd_missing'</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a3485"></a> <span class="src-sym">}</span></div></li> <li><div class="src-line"><a name="a3486"></a> </div></li> <li><div class="src-line"><a name="a3487"></a> <span class="src-key">if </span><span class="src-sym">(</span><span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id"><a href="class.upload.html#var$processed">processed</a> </span>&& <span class="src-var">$image_src</span><span class="src-sym">) </span><span class="src-sym">{</span></div></li> <li><div class="src-line"><a name="a3488"></a> </div></li> <li><div class="src-line"><a name="a3489"></a> <span class="src-comm">// we have to set image_convert if it is not already</span></div></li> <li><div class="src-line"><a name="a3490"></a> <span class="src-key">if </span><span class="src-sym">(</span><span class="src-key">empty</span><span class="src-sym">(</span><span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id"><a href="class.upload.html#var$image_convert">image_convert</a></span><span class="src-sym">)) </span><span class="src-sym">{</span></div></li> <li><div class="src-line"><a name="a3491"></a> <span class="src-var">$this</span><span class="src-sym">-></span><a href="http://www.php.net/log">log</a> .= <span class="src-str">'- setting destination file type to ' </span>. <span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id"><a href="class.upload.html#var$file_src_name_ext">file_src_name_ext</a> </span>. <span class="src-str">'<br />'</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a3492"></a> <span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id"><a href="class.upload.html#var$image_convert">image_convert</a> </span>= <span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id"><a href="class.upload.html#var$file_src_name_ext">file_src_name_ext</a></span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a3493"></a> <span class="src-sym">}</span></div></li> <li><div class="src-line"><a name="a3494"></a> </div></li> <li><div class="src-line"><a name="a3495"></a> <span class="src-key">if </span><span class="src-sym">(</span><span class="src-sym">!</span><a href="http://www.php.net/in_array">in_array</a><span class="src-sym">(</span><span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id"><a href="class.upload.html#var$image_convert">image_convert</a></span><span class="src-sym">, </span><span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id">image_supported</span><span class="src-sym">)) </span><span class="src-sym">{</span></div></li> <li><div class="src-line"><a name="a3496"></a> <span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id"><a href="class.upload.html#var$image_convert">image_convert</a> </span>= <span class="src-str">'jpg'</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a3497"></a> <span class="src-sym">}</span></div></li> <li><div class="src-line"><a name="a3498"></a> </div></li> <li><div class="src-line"><a name="a3499"></a> <span class="src-comm">// we set the default color to be the background color if we don't output in a transparent format</span></div></li> <li><div class="src-line"><a name="a3500"></a> <span class="src-key">if </span><span class="src-sym">(</span><span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id"><a href="class.upload.html#var$image_convert">image_convert</a> </span>!= <span class="src-str">'png' </span>&& <span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id"><a href="class.upload.html#var$image_convert">image_convert</a> </span>!= <span class="src-str">'gif' </span>&& <span class="src-sym">!</span><span class="src-key">empty</span><span class="src-sym">(</span><span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id"><a href="class.upload.html#var$image_default_color">image_default_color</a></span><span class="src-sym">) </span>&& <span class="src-key">empty</span><span class="src-sym">(</span><span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id"><a href="class.upload.html#var$image_background_color">image_background_color</a></span><span class="src-sym">)) </span><span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id"><a href="class.upload.html#var$image_background_color">image_background_color</a> </span>= <span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id"><a href="class.upload.html#var$image_default_color">image_default_color</a></span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a3501"></a> <span class="src-key">if </span><span class="src-sym">(</span><span class="src-sym">!</span><span class="src-key">empty</span><span class="src-sym">(</span><span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id"><a href="class.upload.html#var$image_background_color">image_background_color</a></span><span class="src-sym">)) </span><span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id"><a href="class.upload.html#var$image_default_color">image_default_color</a> </span>= <span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id"><a href="class.upload.html#var$image_background_color">image_background_color</a></span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a3502"></a> <span class="src-key">if </span><span class="src-sym">(</span><span class="src-key">empty</span><span class="src-sym">(</span><span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id"><a href="class.upload.html#var$image_default_color">image_default_color</a></span><span class="src-sym">)) </span><span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id"><a href="class.upload.html#var$image_default_color">image_default_color</a> </span>= <span class="src-str">'#FFFFFF'</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a3503"></a> </div></li> <li><div class="src-line"><a name="a3504"></a> <span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id">image_src_x </span>= <a href="http://www.php.net/imagesx">imagesx</a><span class="src-sym">(</span><span class="src-var">$image_src</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a3505"></a> <span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id">image_src_y </span>= <a href="http://www.php.net/imagesy">imagesy</a><span class="src-sym">(</span><span class="src-var">$image_src</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a3506"></a> <span class="src-var">$gd_version </span>= <span class="src-var">$this</span><span class="src-sym">-></span><a href="class.upload.html#methodgdversion">gdversion</a><span class="src-sym">(</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a3507"></a> <span class="src-var">$ratio_crop </span>= <span class="src-id">null</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a3508"></a> </div></li> <li><div class="src-line"><a name="a3509"></a> <span class="src-key">if </span><span class="src-sym">(</span><span class="src-sym">!</span><a href="http://www.php.net/imageistruecolor">imageistruecolor</a><span class="src-sym">(</span><span class="src-var">$image_src</span><span class="src-sym">)) </span><span class="src-sym">{ </span><span class="src-comm">// $this->image_src_type == 'gif'</span></div></li> <li><div class="src-line"><a name="a3510"></a> <span class="src-var">$this</span><span class="src-sym">-></span><a href="http://www.php.net/log">log</a> .= <span class="src-str">'- image is detected as having a palette<br />'</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a3511"></a> <span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id"><a href="class.upload.html#var$image_is_palette">image_is_palette</a> </span>= <span class="src-id">true</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a3512"></a> <span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id"><a href="class.upload.html#var$image_transparent_color">image_transparent_color</a> </span>= <a href="http://www.php.net/imagecolortransparent">imagecolortransparent</a><span class="src-sym">(</span><span class="src-var">$image_src</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a3513"></a> <span class="src-key">if </span><span class="src-sym">(</span><span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id"><a href="class.upload.html#var$image_transparent_color">image_transparent_color</a> </span>>= <span class="src-num">0 </span>&& <a href="http://www.php.net/imagecolorstotal">imagecolorstotal</a><span class="src-sym">(</span><span class="src-var">$image_src</span><span class="src-sym">) </span>> <span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id"><a href="class.upload.html#var$image_transparent_color">image_transparent_color</a></span><span class="src-sym">) </span><span class="src-sym">{</span></div></li> <li><div class="src-line"><a name="a3514"></a> <span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id"><a href="class.upload.html#var$image_is_transparent">image_is_transparent</a> </span>= <span class="src-id">true</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a3515"></a> <span class="src-var">$this</span><span class="src-sym">-></span><a href="http://www.php.net/log">log</a> .= <span class="src-str">'&nbsp;&nbsp;&nbsp;&nbsp;palette image is detected as transparent<br />'</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a3516"></a> <span class="src-sym">}</span></div></li> <li><div class="src-line"><a name="a3517"></a> <span class="src-comm">// if the image has a palette (GIF), we convert it to true color, preserving transparency</span></div></li> <li><div class="src-line"><a name="a3518"></a> <span class="src-var">$this</span><span class="src-sym">-></span><a href="http://www.php.net/log">log</a> .= <span class="src-str">'&nbsp;&nbsp;&nbsp;&nbsp;convert palette image to true color<br />'</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a3519"></a> <span class="src-var">$true_color </span>= <a href="http://www.php.net/imagecreatetruecolor">imagecreatetruecolor</a><span class="src-sym">(</span><span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id">image_src_x</span><span class="src-sym">, </span><span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id">image_src_y</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a3520"></a> <a href="http://www.php.net/imagealphablending">imagealphablending</a><span class="src-sym">(</span><span class="src-var">$true_color</span><span class="src-sym">, </span><span class="src-id">false</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a3521"></a> <a href="http://www.php.net/imagesavealpha">imagesavealpha</a><span class="src-sym">(</span><span class="src-var">$true_color</span><span class="src-sym">, </span><span class="src-id">true</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a3522"></a> <span class="src-key">for </span><span class="src-sym">(</span><span class="src-var">$x </span>= <span class="src-num">0</span><span class="src-sym">; </span><span class="src-var">$x </span>< <span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id">image_src_x</span><span class="src-sym">; </span><span class="src-var">$x</span>++<span class="src-sym">) </span><span class="src-sym">{</span></div></li> <li><div class="src-line"><a name="a3523"></a> <span class="src-key">for </span><span class="src-sym">(</span><span class="src-var">$y </span>= <span class="src-num">0</span><span class="src-sym">; </span><span class="src-var">$y </span>< <span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id">image_src_y</span><span class="src-sym">; </span><span class="src-var">$y</span>++<span class="src-sym">) </span><span class="src-sym">{</span></div></li> <li><div class="src-line"><a name="a3524"></a> <span class="src-key">if </span><span class="src-sym">(</span><span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id"><a href="class.upload.html#var$image_transparent_color">image_transparent_color</a> </span>>= <span class="src-num">0 </span>&& <a href="http://www.php.net/imagecolorat">imagecolorat</a><span class="src-sym">(</span><span class="src-var">$image_src</span><span class="src-sym">, </span><span class="src-var">$x</span><span class="src-sym">, </span><span class="src-var">$y</span><span class="src-sym">) </span>== <span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id"><a href="class.upload.html#var$image_transparent_color">image_transparent_color</a></span><span class="src-sym">) </span><span class="src-sym">{</span></div></li> <li><div class="src-line"><a name="a3525"></a> <a href="http://www.php.net/imagesetpixel">imagesetpixel</a><span class="src-sym">(</span><span class="src-var">$true_color</span><span class="src-sym">, </span><span class="src-var">$x</span><span class="src-sym">, </span><span class="src-var">$y</span><span class="src-sym">, </span><span class="src-num">127 </span><< <span class="src-num">24</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a3526"></a> <span class="src-sym">} </span><span class="src-key">else </span><span class="src-sym">{</span></div></li> <li><div class="src-line"><a name="a3527"></a> <span class="src-var">$rgb </span>= <a href="http://www.php.net/imagecolorsforindex">imagecolorsforindex</a><span class="src-sym">(</span><span class="src-var">$image_src</span><span class="src-sym">, </span><a href="http://www.php.net/imagecolorat">imagecolorat</a><span class="src-sym">(</span><span class="src-var">$image_src</span><span class="src-sym">, </span><span class="src-var">$x</span><span class="src-sym">, </span><span class="src-var">$y</span><span class="src-sym">))</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a3528"></a> <a href="http://www.php.net/imagesetpixel">imagesetpixel</a><span class="src-sym">(</span><span class="src-var">$true_color</span><span class="src-sym">, </span><span class="src-var">$x</span><span class="src-sym">, </span><span class="src-var">$y</span><span class="src-sym">, </span><span class="src-sym">(</span><span class="src-var">$rgb</span><span class="src-sym">[</span><span class="src-str">'alpha'</span><span class="src-sym">] </span><< <span class="src-num">24</span><span class="src-sym">) </span>| <span class="src-sym">(</span><span class="src-var">$rgb</span><span class="src-sym">[</span><span class="src-str">'red'</span><span class="src-sym">] </span><< <span class="src-num">16</span><span class="src-sym">) </span>| <span class="src-sym">(</span><span class="src-var">$rgb</span><span class="src-sym">[</span><span class="src-str">'green'</span><span class="src-sym">] </span><< <span class="src-num">8</span><span class="src-sym">) </span>| <span class="src-var">$rgb</span><span class="src-sym">[</span><span class="src-str">'blue'</span><span class="src-sym">]</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a3529"></a> <span class="src-sym">}</span></div></li> <li><div class="src-line"><a name="a3530"></a> <span class="src-sym">}</span></div></li> <li><div class="src-line"><a name="a3531"></a> <span class="src-sym">}</span></div></li> <li><div class="src-line"><a name="a3532"></a> <span class="src-var">$image_src </span>= <span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id">imagetransfer</span><span class="src-sym">(</span><span class="src-var">$true_color</span><span class="src-sym">, </span><span class="src-var">$image_src</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a3533"></a> <a href="http://www.php.net/imagealphablending">imagealphablending</a><span class="src-sym">(</span><span class="src-var">$image_src</span><span class="src-sym">, </span><span class="src-id">false</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a3534"></a> <a href="http://www.php.net/imagesavealpha">imagesavealpha</a><span class="src-sym">(</span><span class="src-var">$image_src</span><span class="src-sym">, </span><span class="src-id">true</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a3535"></a> <span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id"><a href="class.upload.html#var$image_is_palette">image_is_palette</a> </span>= <span class="src-id">false</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a3536"></a> <span class="src-sym">}</span></div></li> <li><div class="src-line"><a name="a3537"></a> </div></li> <li><div class="src-line"><a name="a3538"></a> </div></li> <li><div class="src-line"><a name="a3539"></a> <span class="src-var">$image_dst </span>= <span class="src-sym">& </span><span class="src-var">$image_src</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a3540"></a> </div></li> <li><div class="src-line"><a name="a3541"></a> <span class="src-comm">// pre-crop image, before resizing</span></div></li> <li><div class="src-line"><a name="a3542"></a> <span class="src-key">if </span><span class="src-sym">((</span><span class="src-sym">!</span><span class="src-key">empty</span><span class="src-sym">(</span><span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id"><a href="class.upload.html#var$image_precrop">image_precrop</a></span><span class="src-sym">))) </span><span class="src-sym">{</span></div></li> <li><div class="src-line"><a name="a3543"></a> <span class="src-key">if </span><span class="src-sym">(</span><a href="http://www.php.net/is_array">is_array</a><span class="src-sym">(</span><span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id"><a href="class.upload.html#var$image_precrop">image_precrop</a></span><span class="src-sym">)) </span><span class="src-sym">{</span></div></li> <li><div class="src-line"><a name="a3544"></a> <span class="src-var">$vars </span>= <span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id"><a href="class.upload.html#var$image_precrop">image_precrop</a></span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a3545"></a> <span class="src-sym">} </span><span class="src-key">else </span><span class="src-sym">{</span></div></li> <li><div class="src-line"><a name="a3546"></a> <span class="src-var">$vars </span>= <a href="http://www.php.net/explode">explode</a><span class="src-sym">(</span><span class="src-str">' '</span><span class="src-sym">, </span><span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id"><a href="class.upload.html#var$image_precrop">image_precrop</a></span><span class="src-sym">)</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a3547"></a> <span class="src-sym">}</span></div></li> <li><div class="src-line"><a name="a3548"></a> <span class="src-key">if </span><span class="src-sym">(</span><a href="http://www.php.net/sizeof">sizeof</a><span class="src-sym">(</span><span class="src-var">$vars</span><span class="src-sym">) </span>== <span class="src-num">4</span><span class="src-sym">) </span><span class="src-sym">{</span></div></li> <li><div class="src-line"><a name="a3549"></a> <span class="src-var">$ct </span>= <span class="src-var">$vars</span><span class="src-sym">[</span><span class="src-num">0</span><span class="src-sym">]</span><span class="src-sym">; </span><span class="src-var">$cr </span>= <span class="src-var">$vars</span><span class="src-sym">[</span><span class="src-num">1</span><span class="src-sym">]</span><span class="src-sym">; </span><span class="src-var">$cb </span>= <span class="src-var">$vars</span><span class="src-sym">[</span><span class="src-num">2</span><span class="src-sym">]</span><span class="src-sym">; </span><span class="src-var">$cl </span>= <span class="src-var">$vars</span><span class="src-sym">[</span><span class="src-num">3</span><span class="src-sym">]</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a3550"></a> <span class="src-sym">} </span><span class="src-key">else </span><span class="src-key">if </span><span class="src-sym">(</span><a href="http://www.php.net/sizeof">sizeof</a><span class="src-sym">(</span><span class="src-var">$vars</span><span class="src-sym">) </span>== <span class="src-num">2</span><span class="src-sym">) </span><span class="src-sym">{</span></div></li> <li><div class="src-line"><a name="a3551"></a> <span class="src-var">$ct </span>= <span class="src-var">$vars</span><span class="src-sym">[</span><span class="src-num">0</span><span class="src-sym">]</span><span class="src-sym">; </span><span class="src-var">$cr </span>= <span class="src-var">$vars</span><span class="src-sym">[</span><span class="src-num">1</span><span class="src-sym">]</span><span class="src-sym">; </span><span class="src-var">$cb </span>= <span class="src-var">$vars</span><span class="src-sym">[</span><span class="src-num">0</span><span class="src-sym">]</span><span class="src-sym">; </span><span class="src-var">$cl </span>= <span class="src-var">$vars</span><span class="src-sym">[</span><span class="src-num">1</span><span class="src-sym">]</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a3552"></a> <span class="src-sym">} </span><span class="src-key">else </span><span class="src-sym">{</span></div></li> <li><div class="src-line"><a name="a3553"></a> <span class="src-var">$ct </span>= <span class="src-var">$vars</span><span class="src-sym">[</span><span class="src-num">0</span><span class="src-sym">]</span><span class="src-sym">; </span><span class="src-var">$cr </span>= <span class="src-var">$vars</span><span class="src-sym">[</span><span class="src-num">0</span><span class="src-sym">]</span><span class="src-sym">; </span><span class="src-var">$cb </span>= <span class="src-var">$vars</span><span class="src-sym">[</span><span class="src-num">0</span><span class="src-sym">]</span><span class="src-sym">; </span><span class="src-var">$cl </span>= <span class="src-var">$vars</span><span class="src-sym">[</span><span class="src-num">0</span><span class="src-sym">]</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a3554"></a> <span class="src-sym">}</span></div></li> <li><div class="src-line"><a name="a3555"></a> <span class="src-key">if </span><span class="src-sym">(</span><a href="http://www.php.net/strpos">strpos</a><span class="src-sym">(</span><span class="src-var">$ct</span><span class="src-sym">, </span><span class="src-str">'%'</span><span class="src-sym">)</span>><span class="src-num">0</span><span class="src-sym">) </span><span class="src-var">$ct </span>= <span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id">image_src_y </span>* <span class="src-sym">(</span><a href="http://www.php.net/str_replace">str_replace</a><span class="src-sym">(</span><span class="src-str">'%'</span><span class="src-sym">,</span><span class="src-str">''</span><span class="src-sym">,</span><span class="src-var">$ct</span><span class="src-sym">) </span>/ <span class="src-num">100</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a3556"></a> <span class="src-key">if </span><span class="src-sym">(</span><a href="http://www.php.net/strpos">strpos</a><span class="src-sym">(</span><span class="src-var">$cr</span><span class="src-sym">, </span><span class="src-str">'%'</span><span class="src-sym">)</span>><span class="src-num">0</span><span class="src-sym">) </span><span class="src-var">$cr </span>= <span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id">image_src_x </span>* <span class="src-sym">(</span><a href="http://www.php.net/str_replace">str_replace</a><span class="src-sym">(</span><span class="src-str">'%'</span><span class="src-sym">,</span><span class="src-str">''</span><span class="src-sym">,</span><span class="src-var">$cr</span><span class="src-sym">) </span>/ <span class="src-num">100</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a3557"></a> <span class="src-key">if </span><span class="src-sym">(</span><a href="http://www.php.net/strpos">strpos</a><span class="src-sym">(</span><span class="src-var">$cb</span><span class="src-sym">, </span><span class="src-str">'%'</span><span class="src-sym">)</span>><span class="src-num">0</span><span class="src-sym">) </span><span class="src-var">$cb </span>= <span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id">image_src_y </span>* <span class="src-sym">(</span><a href="http://www.php.net/str_replace">str_replace</a><span class="src-sym">(</span><span class="src-str">'%'</span><span class="src-sym">,</span><span class="src-str">''</span><span class="src-sym">,</span><span class="src-var">$cb</span><span class="src-sym">) </span>/ <span class="src-num">100</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a3558"></a> <span class="src-key">if </span><span class="src-sym">(</span><a href="http://www.php.net/strpos">strpos</a><span class="src-sym">(</span><span class="src-var">$cl</span><span class="src-sym">, </span><span class="src-str">'%'</span><span class="src-sym">)</span>><span class="src-num">0</span><span class="src-sym">) </span><span class="src-var">$cl </span>= <span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id">image_src_x </span>* <span class="src-sym">(</span><a href="http://www.php.net/str_replace">str_replace</a><span class="src-sym">(</span><span class="src-str">'%'</span><span class="src-sym">,</span><span class="src-str">''</span><span class="src-sym">,</span><span class="src-var">$cl</span><span class="src-sym">) </span>/ <span class="src-num">100</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a3559"></a> <span class="src-key">if </span><span class="src-sym">(</span><a href="http://www.php.net/strpos">strpos</a><span class="src-sym">(</span><span class="src-var">$ct</span><span class="src-sym">, </span><span class="src-str">'px'</span><span class="src-sym">)</span>><span class="src-num">0</span><span class="src-sym">) </span><span class="src-var">$ct </span>= <a href="http://www.php.net/str_replace">str_replace</a><span class="src-sym">(</span><span class="src-str">'px'</span><span class="src-sym">,</span><span class="src-str">''</span><span class="src-sym">,</span><span class="src-var">$ct</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a3560"></a> <span class="src-key">if </span><span class="src-sym">(</span><a href="http://www.php.net/strpos">strpos</a><span class="src-sym">(</span><span class="src-var">$cr</span><span class="src-sym">, </span><span class="src-str">'px'</span><span class="src-sym">)</span>><span class="src-num">0</span><span class="src-sym">) </span><span class="src-var">$cr </span>= <a href="http://www.php.net/str_replace">str_replace</a><span class="src-sym">(</span><span class="src-str">'px'</span><span class="src-sym">,</span><span class="src-str">''</span><span class="src-sym">,</span><span class="src-var">$cr</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a3561"></a> <span class="src-key">if </span><span class="src-sym">(</span><a href="http://www.php.net/strpos">strpos</a><span class="src-sym">(</span><span class="src-var">$cb</span><span class="src-sym">, </span><span class="src-str">'px'</span><span class="src-sym">)</span>><span class="src-num">0</span><span class="src-sym">) </span><span class="src-var">$cb </span>= <a href="http://www.php.net/str_replace">str_replace</a><span class="src-sym">(</span><span class="src-str">'px'</span><span class="src-sym">,</span><span class="src-str">''</span><span class="src-sym">,</span><span class="src-var">$cb</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a3562"></a> <span class="src-key">if </span><span class="src-sym">(</span><a href="http://www.php.net/strpos">strpos</a><span class="src-sym">(</span><span class="src-var">$cl</span><span class="src-sym">, </span><span class="src-str">'px'</span><span class="src-sym">)</span>><span class="src-num">0</span><span class="src-sym">) </span><span class="src-var">$cl </span>= <a href="http://www.php.net/str_replace">str_replace</a><span class="src-sym">(</span><span class="src-str">'px'</span><span class="src-sym">,</span><span class="src-str">''</span><span class="src-sym">,</span><span class="src-var">$cl</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a3563"></a> <span class="src-var">$ct </span>= (int) <span class="src-var">$ct</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a3564"></a> <span class="src-var">$cr </span>= (int) <span class="src-var">$cr</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a3565"></a> <span class="src-var">$cb </span>= (int) <span class="src-var">$cb</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a3566"></a> <span class="src-var">$cl </span>= (int) <span class="src-var">$cl</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a3567"></a> <span class="src-var">$this</span><span class="src-sym">-></span><a href="http://www.php.net/log">log</a> .= <span class="src-str">'- pre-crop image : ' </span>. <span class="src-var">$ct </span>. <span class="src-str">' ' </span>. <span class="src-var">$cr </span>. <span class="src-str">' ' </span>. <span class="src-var">$cb </span>. <span class="src-str">' ' </span>. <span class="src-var">$cl </span>. <span class="src-str">' <br />'</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a3568"></a> <span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id">image_src_x </span>= <span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id">image_src_x </span>- <span class="src-var">$cl </span>- <span class="src-var">$cr</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a3569"></a> <span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id">image_src_y </span>= <span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id">image_src_y </span>- <span class="src-var">$ct </span>- <span class="src-var">$cb</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a3570"></a> <span class="src-key">if </span><span class="src-sym">(</span><span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id">image_src_x </span>< <span class="src-num">1</span><span class="src-sym">) </span><span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id">image_src_x </span>= <span class="src-num">1</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a3571"></a> <span class="src-key">if </span><span class="src-sym">(</span><span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id">image_src_y </span>< <span class="src-num">1</span><span class="src-sym">) </span><span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id">image_src_y </span>= <span class="src-num">1</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a3572"></a> <span class="src-var">$tmp </span>= <span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id">imagecreatenew</span><span class="src-sym">(</span><span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id">image_src_x</span><span class="src-sym">, </span><span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id">image_src_y</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a3573"></a> </div></li> <li><div class="src-line"><a name="a3574"></a> <span class="src-comm">// we copy the image into the recieving image</span></div></li> <li><div class="src-line"><a name="a3575"></a> <a href="http://www.php.net/imagecopy">imagecopy</a><span class="src-sym">(</span><span class="src-var">$tmp</span><span class="src-sym">, </span><span class="src-var">$image_dst</span><span class="src-sym">, </span><span class="src-num">0</span><span class="src-sym">, </span><span class="src-num">0</span><span class="src-sym">, </span><span class="src-var">$cl</span><span class="src-sym">, </span><span class="src-var">$ct</span><span class="src-sym">, </span><span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id">image_src_x</span><span class="src-sym">, </span><span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id">image_src_y</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a3576"></a> </div></li> <li><div class="src-line"><a name="a3577"></a> <span class="src-comm">// if we crop with negative margins, we have to make sure the extra bits are the right color, or transparent</span></div></li> <li><div class="src-line"><a name="a3578"></a> <span class="src-key">if </span><span class="src-sym">(</span><span class="src-var">$ct </span>< <span class="src-num">0 </span>|| <span class="src-var">$cr </span>< <span class="src-num">0 </span>|| <span class="src-var">$cb </span>< <span class="src-num">0 </span>|| <span class="src-var">$cl </span>< <span class="src-num">0 </span><span class="src-sym">) </span><span class="src-sym">{</span></div></li> <li><div class="src-line"><a name="a3579"></a> <span class="src-comm">// use the background color if present</span></div></li> <li><div class="src-line"><a name="a3580"></a> <span class="src-key">if </span><span class="src-sym">(</span><span class="src-sym">!</span><span class="src-key">empty</span><span class="src-sym">(</span><span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id"><a href="class.upload.html#var$image_background_color">image_background_color</a></span><span class="src-sym">)) </span><span class="src-sym">{</span></div></li> <li><div class="src-line"><a name="a3581"></a> list<span class="src-sym">(</span><span class="src-var">$red</span><span class="src-sym">, </span><span class="src-var">$green</span><span class="src-sym">, </span><span class="src-var">$blue</span><span class="src-sym">) </span>= <span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id">getcolors</span><span class="src-sym">(</span><span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id"><a href="class.upload.html#var$image_background_color">image_background_color</a></span><span class="src-sym">)</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a3582"></a> <span class="src-var">$fill </span>= <a href="http://www.php.net/imagecolorallocate">imagecolorallocate</a><span class="src-sym">(</span><span class="src-var">$tmp</span><span class="src-sym">, </span><span class="src-var">$red</span><span class="src-sym">, </span><span class="src-var">$green</span><span class="src-sym">, </span><span class="src-var">$blue</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a3583"></a> <span class="src-sym">} </span><span class="src-key">else </span><span class="src-sym">{</span></div></li> <li><div class="src-line"><a name="a3584"></a> <span class="src-var">$fill </span>= <a href="http://www.php.net/imagecolorallocatealpha">imagecolorallocatealpha</a><span class="src-sym">(</span><span class="src-var">$tmp</span><span class="src-sym">, </span><span class="src-num">0</span><span class="src-sym">, </span><span class="src-num">0</span><span class="src-sym">, </span><span class="src-num">0</span><span class="src-sym">, </span><span class="src-num">127</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a3585"></a> <span class="src-sym">}</span></div></li> <li><div class="src-line"><a name="a3586"></a> <span class="src-comm">// fills eventual negative margins</span></div></li> <li><div class="src-line"><a name="a3587"></a> <span class="src-key">if </span><span class="src-sym">(</span><span class="src-var">$ct </span>< <span class="src-num">0</span><span class="src-sym">) </span><a href="http://www.php.net/imagefilledrectangle">imagefilledrectangle</a><span class="src-sym">(</span><span class="src-var">$tmp</span><span class="src-sym">, </span><span class="src-num">0</span><span class="src-sym">, </span><span class="src-num">0</span><span class="src-sym">, </span><span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id">image_src_x</span><span class="src-sym">, </span>-<span class="src-var">$ct</span><span class="src-sym">, </span><span class="src-var">$fill</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a3588"></a> <span class="src-key">if </span><span class="src-sym">(</span><span class="src-var">$cr </span>< <span class="src-num">0</span><span class="src-sym">) </span><a href="http://www.php.net/imagefilledrectangle">imagefilledrectangle</a><span class="src-sym">(</span><span class="src-var">$tmp</span><span class="src-sym">, </span><span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id">image_src_x </span>+ <span class="src-var">$cr</span><span class="src-sym">, </span><span class="src-num">0</span><span class="src-sym">, </span><span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id">image_src_x</span><span class="src-sym">, </span><span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id">image_src_y</span><span class="src-sym">, </span><span class="src-var">$fill</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a3589"></a> <span class="src-key">if </span><span class="src-sym">(</span><span class="src-var">$cb </span>< <span class="src-num">0</span><span class="src-sym">) </span><a href="http://www.php.net/imagefilledrectangle">imagefilledrectangle</a><span class="src-sym">(</span><span class="src-var">$tmp</span><span class="src-sym">, </span><span class="src-num">0</span><span class="src-sym">, </span><span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id">image_src_y </span>+ <span class="src-var">$cb</span><span class="src-sym">, </span><span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id">image_src_x</span><span class="src-sym">, </span><span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id">image_src_y</span><span class="src-sym">, </span><span class="src-var">$fill</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a3590"></a> <span class="src-key">if </span><span class="src-sym">(</span><span class="src-var">$cl </span>< <span class="src-num">0</span><span class="src-sym">) </span><a href="http://www.php.net/imagefilledrectangle">imagefilledrectangle</a><span class="src-sym">(</span><span class="src-var">$tmp</span><span class="src-sym">, </span><span class="src-num">0</span><span class="src-sym">, </span><span class="src-num">0</span><span class="src-sym">, </span>-<span class="src-var">$cl</span><span class="src-sym">, </span><span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id">image_src_y</span><span class="src-sym">, </span><span class="src-var">$fill</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a3591"></a> <span class="src-sym">}</span></div></li> <li><div class="src-line"><a name="a3592"></a> </div></li> <li><div class="src-line"><a name="a3593"></a> <span class="src-comm">// we transfert tmp into image_dst</span></div></li> <li><div class="src-line"><a name="a3594"></a> <span class="src-var">$image_dst </span>= <span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id">imagetransfer</span><span class="src-sym">(</span><span class="src-var">$tmp</span><span class="src-sym">, </span><span class="src-var">$image_dst</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a3595"></a> <span class="src-sym">}</span></div></li> <li><div class="src-line"><a name="a3596"></a> </div></li> <li><div class="src-line"><a name="a3597"></a> <span class="src-comm">// resize image (and move image_src_x, image_src_y dimensions into image_dst_x, image_dst_y)</span></div></li> <li><div class="src-line"><a name="a3598"></a> <span class="src-key">if </span><span class="src-sym">(</span><span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id"><a href="class.upload.html#var$image_resize">image_resize</a></span><span class="src-sym">) </span><span class="src-sym">{</span></div></li> <li><div class="src-line"><a name="a3599"></a> <span class="src-var">$this</span><span class="src-sym">-></span><a href="http://www.php.net/log">log</a> .= <span class="src-str">'- resizing...<br />'</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a3600"></a> </div></li> <li><div class="src-line"><a name="a3601"></a> <span class="src-key">if </span><span class="src-sym">(</span><span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id"><a href="class.upload.html#var$image_ratio_x">image_ratio_x</a></span><span class="src-sym">) </span><span class="src-sym">{</span></div></li> <li><div class="src-line"><a name="a3602"></a> <span class="src-var">$this</span><span class="src-sym">-></span><a href="http://www.php.net/log">log</a> .= <span class="src-str">'&nbsp;&nbsp;&nbsp;&nbsp;calculate x size<br />'</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a3603"></a> <span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id">image_dst_x </span>= <a href="http://www.php.net/round">round</a><span class="src-sym">((</span><span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id">image_src_x </span>* <span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id"><a href="class.upload.html#var$image_y">image_y</a></span><span class="src-sym">) </span>/ <span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id">image_src_y</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a3604"></a> <span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id">image_dst_y </span>= <span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id"><a href="class.upload.html#var$image_y">image_y</a></span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a3605"></a> <span class="src-sym">} </span><span class="src-key">else </span><span class="src-key">if </span><span class="src-sym">(</span><span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id"><a href="class.upload.html#var$image_ratio_y">image_ratio_y</a></span><span class="src-sym">) </span><span class="src-sym">{</span></div></li> <li><div class="src-line"><a name="a3606"></a> <span class="src-var">$this</span><span class="src-sym">-></span><a href="http://www.php.net/log">log</a> .= <span class="src-str">'&nbsp;&nbsp;&nbsp;&nbsp;calculate y size<br />'</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a3607"></a> <span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id">image_dst_x </span>= <span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id"><a href="class.upload.html#var$image_x">image_x</a></span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a3608"></a> <span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id">image_dst_y </span>= <a href="http://www.php.net/round">round</a><span class="src-sym">((</span><span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id">image_src_y </span>* <span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id"><a href="class.upload.html#var$image_x">image_x</a></span><span class="src-sym">) </span>/ <span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id">image_src_x</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a3609"></a> <span class="src-sym">} </span><span class="src-key">else </span><span class="src-key">if </span><span class="src-sym">(</span><a href="http://www.php.net/is_numeric">is_numeric</a><span class="src-sym">(</span><span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id"><a href="class.upload.html#var$image_ratio_pixels">image_ratio_pixels</a></span><span class="src-sym">)) </span><span class="src-sym">{</span></div></li> <li><div class="src-line"><a name="a3610"></a> <span class="src-var">$this</span><span class="src-sym">-></span><a href="http://www.php.net/log">log</a> .= <span class="src-str">'&nbsp;&nbsp;&nbsp;&nbsp;calculate x/y size to match a number of pixels<br />'</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a3611"></a> <span class="src-var">$pixels </span>= <span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id">image_src_y </span>* <span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id">image_src_x</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a3612"></a> <span class="src-var">$diff </span>= <a href="http://www.php.net/sqrt">sqrt</a><span class="src-sym">(</span><span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id"><a href="class.upload.html#var$image_ratio_pixels">image_ratio_pixels</a> </span>/ <span class="src-var">$pixels</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a3613"></a> <span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id">image_dst_x </span>= <a href="http://www.php.net/round">round</a><span class="src-sym">(</span><span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id">image_src_x </span>* <span class="src-var">$diff</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a3614"></a> <span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id">image_dst_y </span>= <a href="http://www.php.net/round">round</a><span class="src-sym">(</span><span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id">image_src_y </span>* <span class="src-var">$diff</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a3615"></a> <span class="src-sym">} </span><span class="src-key">else </span><span class="src-key">if </span><span class="src-sym">(</span><span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id"><a href="class.upload.html#var$image_ratio">image_ratio</a> </span>|| <span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id"><a href="class.upload.html#var$image_ratio_crop">image_ratio_crop</a> </span>|| <span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id"><a href="class.upload.html#var$image_ratio_fill">image_ratio_fill</a> </span>|| <span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id"><a href="class.upload.html#var$image_ratio_no_zoom_in">image_ratio_no_zoom_in</a> </span>|| <span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id"><a href="class.upload.html#var$image_ratio_no_zoom_out">image_ratio_no_zoom_out</a></span><span class="src-sym">) </span><span class="src-sym">{</span></div></li> <li><div class="src-line"><a name="a3616"></a> <span class="src-var">$this</span><span class="src-sym">-></span><a href="http://www.php.net/log">log</a> .= <span class="src-str">'&nbsp;&nbsp;&nbsp;&nbsp;check x/y sizes<br />'</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a3617"></a> <span class="src-key">if </span><span class="src-sym">((</span><span class="src-sym">!</span><span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id"><a href="class.upload.html#var$image_ratio_no_zoom_in">image_ratio_no_zoom_in</a> </span>&& <span class="src-sym">!</span><span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id"><a href="class.upload.html#var$image_ratio_no_zoom_out">image_ratio_no_zoom_out</a></span><span class="src-sym">)</span></div></li> <li><div class="src-line"><a name="a3618"></a> || <span class="src-sym">(</span><span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id"><a href="class.upload.html#var$image_ratio_no_zoom_in">image_ratio_no_zoom_in</a> </span>&& <span class="src-sym">(</span><span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id">image_src_x </span>> <span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id"><a href="class.upload.html#var$image_x">image_x</a> </span>|| <span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id">image_src_y </span>> <span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id"><a href="class.upload.html#var$image_y">image_y</a></span><span class="src-sym">))</span></div></li> <li><div class="src-line"><a name="a3619"></a> || <span class="src-sym">(</span><span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id"><a href="class.upload.html#var$image_ratio_no_zoom_out">image_ratio_no_zoom_out</a> </span>&& <span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id">image_src_x </span>< <span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id"><a href="class.upload.html#var$image_x">image_x</a> </span>&& <span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id">image_src_y </span>< <span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id"><a href="class.upload.html#var$image_y">image_y</a></span><span class="src-sym">)) </span><span class="src-sym">{</span></div></li> <li><div class="src-line"><a name="a3620"></a> <span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id">image_dst_x </span>= <span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id"><a href="class.upload.html#var$image_x">image_x</a></span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a3621"></a> <span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id">image_dst_y </span>= <span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id"><a href="class.upload.html#var$image_y">image_y</a></span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a3622"></a> <span class="src-key">if </span><span class="src-sym">(</span><span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id"><a href="class.upload.html#var$image_ratio_crop">image_ratio_crop</a></span><span class="src-sym">) </span><span class="src-sym">{</span></div></li> <li><div class="src-line"><a name="a3623"></a> <span class="src-key">if </span><span class="src-sym">(</span><span class="src-sym">!</span><a href="http://www.php.net/is_string">is_string</a><span class="src-sym">(</span><span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id"><a href="class.upload.html#var$image_ratio_crop">image_ratio_crop</a></span><span class="src-sym">)) </span><span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id"><a href="class.upload.html#var$image_ratio_crop">image_ratio_crop</a> </span>= <span class="src-str">''</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a3624"></a> <span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id"><a href="class.upload.html#var$image_ratio_crop">image_ratio_crop</a> </span>= <a href="http://www.php.net/strtolower">strtolower</a><span class="src-sym">(</span><span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id"><a href="class.upload.html#var$image_ratio_crop">image_ratio_crop</a></span><span class="src-sym">)</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a3625"></a> <span class="src-key">if </span><span class="src-sym">((</span><span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id">image_src_x</span>/<span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id"><a href="class.upload.html#var$image_x">image_x</a></span><span class="src-sym">) </span>> <span class="src-sym">(</span><span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id">image_src_y</span>/<span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id"><a href="class.upload.html#var$image_y">image_y</a></span><span class="src-sym">)) </span><span class="src-sym">{</span></div></li> <li><div class="src-line"><a name="a3626"></a> <span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id">image_dst_y </span>= <span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id"><a href="class.upload.html#var$image_y">image_y</a></span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a3627"></a> <span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id">image_dst_x </span>= <a href="http://www.php.net/intval">intval</a><span class="src-sym">(</span><span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id">image_src_x</span>*<span class="src-sym">(</span><span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id"><a href="class.upload.html#var$image_y">image_y</a> </span>/ <span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id">image_src_y</span><span class="src-sym">))</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a3628"></a> <span class="src-var">$ratio_crop </span>= <span class="src-key">array</span><span class="src-sym">(</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a3629"></a> <span class="src-var">$ratio_crop</span><span class="src-sym">[</span><span class="src-str">'x'</span><span class="src-sym">] </span>= <span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id">image_dst_x </span>- <span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id"><a href="class.upload.html#var$image_x">image_x</a></span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a3630"></a> <span class="src-key">if </span><span class="src-sym">(</span><a href="http://www.php.net/strpos">strpos</a><span class="src-sym">(</span><span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id"><a href="class.upload.html#var$image_ratio_crop">image_ratio_crop</a></span><span class="src-sym">, </span><span class="src-str">'l'</span><span class="src-sym">) </span>!== <span class="src-id">false</span><span class="src-sym">) </span><span class="src-sym">{</span></div></li> <li><div class="src-line"><a name="a3631"></a> <span class="src-var">$ratio_crop</span><span class="src-sym">[</span><span class="src-str">'l'</span><span class="src-sym">] </span>= <span class="src-num">0</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a3632"></a> <span class="src-var">$ratio_crop</span><span class="src-sym">[</span><span class="src-str">'r'</span><span class="src-sym">] </span>= <span class="src-var">$ratio_crop</span><span class="src-sym">[</span><span class="src-str">'x'</span><span class="src-sym">]</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a3633"></a> <span class="src-sym">} </span><span class="src-key">else </span><span class="src-key">if </span><span class="src-sym">(</span><a href="http://www.php.net/strpos">strpos</a><span class="src-sym">(</span><span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id"><a href="class.upload.html#var$image_ratio_crop">image_ratio_crop</a></span><span class="src-sym">, </span><span class="src-str">'r'</span><span class="src-sym">) </span>!== <span class="src-id">false</span><span class="src-sym">) </span><span class="src-sym">{</span></div></li> <li><div class="src-line"><a name="a3634"></a> <span class="src-var">$ratio_crop</span><span class="src-sym">[</span><span class="src-str">'l'</span><span class="src-sym">] </span>= <span class="src-var">$ratio_crop</span><span class="src-sym">[</span><span class="src-str">'x'</span><span class="src-sym">]</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a3635"></a> <span class="src-var">$ratio_crop</span><span class="src-sym">[</span><span class="src-str">'r'</span><span class="src-sym">] </span>= <span class="src-num">0</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a3636"></a> <span class="src-sym">} </span><span class="src-key">else </span><span class="src-sym">{</span></div></li> <li><div class="src-line"><a name="a3637"></a> <span class="src-var">$ratio_crop</span><span class="src-sym">[</span><span class="src-str">'l'</span><span class="src-sym">] </span>= <a href="http://www.php.net/round">round</a><span class="src-sym">(</span><span class="src-var">$ratio_crop</span><span class="src-sym">[</span><span class="src-str">'x'</span><span class="src-sym">]</span>/<span class="src-num">2</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a3638"></a> <span class="src-var">$ratio_crop</span><span class="src-sym">[</span><span class="src-str">'r'</span><span class="src-sym">] </span>= <span class="src-var">$ratio_crop</span><span class="src-sym">[</span><span class="src-str">'x'</span><span class="src-sym">] </span>- <span class="src-var">$ratio_crop</span><span class="src-sym">[</span><span class="src-str">'l'</span><span class="src-sym">]</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a3639"></a> <span class="src-sym">}</span></div></li> <li><div class="src-line"><a name="a3640"></a> <span class="src-var">$this</span><span class="src-sym">-></span><a href="http://www.php.net/log">log</a> .= <span class="src-str">'&nbsp;&nbsp;&nbsp;&nbsp;ratio_crop_x : ' </span>. <span class="src-var">$ratio_crop</span><span class="src-sym">[</span><span class="src-str">'x'</span><span class="src-sym">] </span>. <span class="src-str">' (' </span>. <span class="src-var">$ratio_crop</span><span class="src-sym">[</span><span class="src-str">'l'</span><span class="src-sym">] </span>. <span class="src-str">';' </span>. <span class="src-var">$ratio_crop</span><span class="src-sym">[</span><span class="src-str">'r'</span><span class="src-sym">] </span>. <span class="src-str">')<br />'</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a3641"></a> <span class="src-key">if </span><span class="src-sym">(</span><a href="http://www.php.net/is_null">is_null</a><span class="src-sym">(</span><span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id"><a href="class.upload.html#var$image_crop">image_crop</a></span><span class="src-sym">)) </span><span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id"><a href="class.upload.html#var$image_crop">image_crop</a> </span>= <span class="src-key">array</span><span class="src-sym">(</span><span class="src-num">0</span><span class="src-sym">, </span><span class="src-num">0</span><span class="src-sym">, </span><span class="src-num">0</span><span class="src-sym">, </span><span class="src-num">0</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a3642"></a> <span class="src-sym">} </span><span class="src-key">else </span><span class="src-sym">{</span></div></li> <li><div class="src-line"><a name="a3643"></a> <span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id">image_dst_x </span>= <span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id"><a href="class.upload.html#var$image_x">image_x</a></span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a3644"></a> <span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id">image_dst_y </span>= <a href="http://www.php.net/intval">intval</a><span class="src-sym">(</span><span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id">image_src_y</span>*<span class="src-sym">(</span><span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id"><a href="class.upload.html#var$image_x">image_x</a> </span>/ <span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id">image_src_x</span><span class="src-sym">))</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a3645"></a> <span class="src-var">$ratio_crop </span>= <span class="src-key">array</span><span class="src-sym">(</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a3646"></a> <span class="src-var">$ratio_crop</span><span class="src-sym">[</span><span class="src-str">'y'</span><span class="src-sym">] </span>= <span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id">image_dst_y </span>- <span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id"><a href="class.upload.html#var$image_y">image_y</a></span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a3647"></a> <span class="src-key">if </span><span class="src-sym">(</span><a href="http://www.php.net/strpos">strpos</a><span class="src-sym">(</span><span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id"><a href="class.upload.html#var$image_ratio_crop">image_ratio_crop</a></span><span class="src-sym">, </span><span class="src-str">'t'</span><span class="src-sym">) </span>!== <span class="src-id">false</span><span class="src-sym">) </span><span class="src-sym">{</span></div></li> <li><div class="src-line"><a name="a3648"></a> <span class="src-var">$ratio_crop</span><span class="src-sym">[</span><span class="src-str">'t'</span><span class="src-sym">] </span>= <span class="src-num">0</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a3649"></a> <span class="src-var">$ratio_crop</span><span class="src-sym">[</span><span class="src-str">'b'</span><span class="src-sym">] </span>= <span class="src-var">$ratio_crop</span><span class="src-sym">[</span><span class="src-str">'y'</span><span class="src-sym">]</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a3650"></a> <span class="src-sym">} </span><span class="src-key">else </span><span class="src-key">if </span><span class="src-sym">(</span><a href="http://www.php.net/strpos">strpos</a><span class="src-sym">(</span><span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id"><a href="class.upload.html#var$image_ratio_crop">image_ratio_crop</a></span><span class="src-sym">, </span><span class="src-str">'b'</span><span class="src-sym">) </span>!== <span class="src-id">false</span><span class="src-sym">) </span><span class="src-sym">{</span></div></li> <li><div class="src-line"><a name="a3651"></a> <span class="src-var">$ratio_crop</span><span class="src-sym">[</span><span class="src-str">'t'</span><span class="src-sym">] </span>= <span class="src-var">$ratio_crop</span><span class="src-sym">[</span><span class="src-str">'y'</span><span class="src-sym">]</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a3652"></a> <span class="src-var">$ratio_crop</span><span class="src-sym">[</span><span class="src-str">'b'</span><span class="src-sym">] </span>= <span class="src-num">0</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a3653"></a> <span class="src-sym">} </span><span class="src-key">else </span><span class="src-sym">{</span></div></li> <li><div class="src-line"><a name="a3654"></a> <span class="src-var">$ratio_crop</span><span class="src-sym">[</span><span class="src-str">'t'</span><span class="src-sym">] </span>= <a href="http://www.php.net/round">round</a><span class="src-sym">(</span><span class="src-var">$ratio_crop</span><span class="src-sym">[</span><span class="src-str">'y'</span><span class="src-sym">]</span>/<span class="src-num">2</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a3655"></a> <span class="src-var">$ratio_crop</span><span class="src-sym">[</span><span class="src-str">'b'</span><span class="src-sym">] </span>= <span class="src-var">$ratio_crop</span><span class="src-sym">[</span><span class="src-str">'y'</span><span class="src-sym">] </span>- <span class="src-var">$ratio_crop</span><span class="src-sym">[</span><span class="src-str">'t'</span><span class="src-sym">]</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a3656"></a> <span class="src-sym">}</span></div></li> <li><div class="src-line"><a name="a3657"></a> <span class="src-var">$this</span><span class="src-sym">-></span><a href="http://www.php.net/log">log</a> .= <span class="src-str">'&nbsp;&nbsp;&nbsp;&nbsp;ratio_crop_y : ' </span>. <span class="src-var">$ratio_crop</span><span class="src-sym">[</span><span class="src-str">'y'</span><span class="src-sym">] </span>. <span class="src-str">' (' </span>. <span class="src-var">$ratio_crop</span><span class="src-sym">[</span><span class="src-str">'t'</span><span class="src-sym">] </span>. <span class="src-str">';' </span>. <span class="src-var">$ratio_crop</span><span class="src-sym">[</span><span class="src-str">'b'</span><span class="src-sym">] </span>. <span class="src-str">')<br />'</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a3658"></a> <span class="src-key">if </span><span class="src-sym">(</span><a href="http://www.php.net/is_null">is_null</a><span class="src-sym">(</span><span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id"><a href="class.upload.html#var$image_crop">image_crop</a></span><span class="src-sym">)) </span><span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id"><a href="class.upload.html#var$image_crop">image_crop</a> </span>= <span class="src-key">array</span><span class="src-sym">(</span><span class="src-num">0</span><span class="src-sym">, </span><span class="src-num">0</span><span class="src-sym">, </span><span class="src-num">0</span><span class="src-sym">, </span><span class="src-num">0</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a3659"></a> <span class="src-sym">}</span></div></li> <li><div class="src-line"><a name="a3660"></a> <span class="src-sym">} </span><span class="src-key">else </span><span class="src-key">if </span><span class="src-sym">(</span><span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id"><a href="class.upload.html#var$image_ratio_fill">image_ratio_fill</a></span><span class="src-sym">) </span><span class="src-sym">{</span></div></li> <li><div class="src-line"><a name="a3661"></a> <span class="src-key">if </span><span class="src-sym">(</span><span class="src-sym">!</span><a href="http://www.php.net/is_string">is_string</a><span class="src-sym">(</span><span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id"><a href="class.upload.html#var$image_ratio_fill">image_ratio_fill</a></span><span class="src-sym">)) </span><span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id"><a href="class.upload.html#var$image_ratio_fill">image_ratio_fill</a> </span>= <span class="src-str">''</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a3662"></a> <span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id"><a href="class.upload.html#var$image_ratio_fill">image_ratio_fill</a> </span>= <a href="http://www.php.net/strtolower">strtolower</a><span class="src-sym">(</span><span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id"><a href="class.upload.html#var$image_ratio_fill">image_ratio_fill</a></span><span class="src-sym">)</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a3663"></a> <span class="src-key">if </span><span class="src-sym">((</span><span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id">image_src_x</span>/<span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id"><a href="class.upload.html#var$image_x">image_x</a></span><span class="src-sym">) </span>< <span class="src-sym">(</span><span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id">image_src_y</span>/<span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id"><a href="class.upload.html#var$image_y">image_y</a></span><span class="src-sym">)) </span><span class="src-sym">{</span></div></li> <li><div class="src-line"><a name="a3664"></a> <span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id">image_dst_y </span>= <span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id"><a href="class.upload.html#var$image_y">image_y</a></span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a3665"></a> <span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id">image_dst_x </span>= <a href="http://www.php.net/intval">intval</a><span class="src-sym">(</span><span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id">image_src_x</span>*<span class="src-sym">(</span><span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id"><a href="class.upload.html#var$image_y">image_y</a> </span>/ <span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id">image_src_y</span><span class="src-sym">))</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a3666"></a> <span class="src-var">$ratio_crop </span>= <span class="src-key">array</span><span class="src-sym">(</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a3667"></a> <span class="src-var">$ratio_crop</span><span class="src-sym">[</span><span class="src-str">'x'</span><span class="src-sym">] </span>= <span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id">image_dst_x </span>- <span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id"><a href="class.upload.html#var$image_x">image_x</a></span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a3668"></a> <span class="src-key">if </span><span class="src-sym">(</span><a href="http://www.php.net/strpos">strpos</a><span class="src-sym">(</span><span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id"><a href="class.upload.html#var$image_ratio_fill">image_ratio_fill</a></span><span class="src-sym">, </span><span class="src-str">'l'</span><span class="src-sym">) </span>!== <span class="src-id">false</span><span class="src-sym">) </span><span class="src-sym">{</span></div></li> <li><div class="src-line"><a name="a3669"></a> <span class="src-var">$ratio_crop</span><span class="src-sym">[</span><span class="src-str">'l'</span><span class="src-sym">] </span>= <span class="src-num">0</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a3670"></a> <span class="src-var">$ratio_crop</span><span class="src-sym">[</span><span class="src-str">'r'</span><span class="src-sym">] </span>= <span class="src-var">$ratio_crop</span><span class="src-sym">[</span><span class="src-str">'x'</span><span class="src-sym">]</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a3671"></a> <span class="src-sym">} </span><span class="src-key">else </span><span class="src-key">if </span><span class="src-sym">(</span><a href="http://www.php.net/strpos">strpos</a><span class="src-sym">(</span><span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id"><a href="class.upload.html#var$image_ratio_fill">image_ratio_fill</a></span><span class="src-sym">, </span><span class="src-str">'r'</span><span class="src-sym">) </span>!== <span class="src-id">false</span><span class="src-sym">) </span><span class="src-sym">{</span></div></li> <li><div class="src-line"><a name="a3672"></a> <span class="src-var">$ratio_crop</span><span class="src-sym">[</span><span class="src-str">'l'</span><span class="src-sym">] </span>= <span class="src-var">$ratio_crop</span><span class="src-sym">[</span><span class="src-str">'x'</span><span class="src-sym">]</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a3673"></a> <span class="src-var">$ratio_crop</span><span class="src-sym">[</span><span class="src-str">'r'</span><span class="src-sym">] </span>= <span class="src-num">0</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a3674"></a> <span class="src-sym">} </span><span class="src-key">else </span><span class="src-sym">{</span></div></li> <li><div class="src-line"><a name="a3675"></a> <span class="src-var">$ratio_crop</span><span class="src-sym">[</span><span class="src-str">'l'</span><span class="src-sym">] </span>= <a href="http://www.php.net/round">round</a><span class="src-sym">(</span><span class="src-var">$ratio_crop</span><span class="src-sym">[</span><span class="src-str">'x'</span><span class="src-sym">]</span>/<span class="src-num">2</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a3676"></a> <span class="src-var">$ratio_crop</span><span class="src-sym">[</span><span class="src-str">'r'</span><span class="src-sym">] </span>= <span class="src-var">$ratio_crop</span><span class="src-sym">[</span><span class="src-str">'x'</span><span class="src-sym">] </span>- <span class="src-var">$ratio_crop</span><span class="src-sym">[</span><span class="src-str">'l'</span><span class="src-sym">]</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a3677"></a> <span class="src-sym">}</span></div></li> <li><div class="src-line"><a name="a3678"></a> <span class="src-var">$this</span><span class="src-sym">-></span><a href="http://www.php.net/log">log</a> .= <span class="src-str">'&nbsp;&nbsp;&nbsp;&nbsp;ratio_fill_x : ' </span>. <span class="src-var">$ratio_crop</span><span class="src-sym">[</span><span class="src-str">'x'</span><span class="src-sym">] </span>. <span class="src-str">' (' </span>. <span class="src-var">$ratio_crop</span><span class="src-sym">[</span><span class="src-str">'l'</span><span class="src-sym">] </span>. <span class="src-str">';' </span>. <span class="src-var">$ratio_crop</span><span class="src-sym">[</span><span class="src-str">'r'</span><span class="src-sym">] </span>. <span class="src-str">')<br />'</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a3679"></a> <span class="src-key">if </span><span class="src-sym">(</span><a href="http://www.php.net/is_null">is_null</a><span class="src-sym">(</span><span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id"><a href="class.upload.html#var$image_crop">image_crop</a></span><span class="src-sym">)) </span><span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id"><a href="class.upload.html#var$image_crop">image_crop</a> </span>= <span class="src-key">array</span><span class="src-sym">(</span><span class="src-num">0</span><span class="src-sym">, </span><span class="src-num">0</span><span class="src-sym">, </span><span class="src-num">0</span><span class="src-sym">, </span><span class="src-num">0</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a3680"></a> <span class="src-sym">} </span><span class="src-key">else </span><span class="src-sym">{</span></div></li> <li><div class="src-line"><a name="a3681"></a> <span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id">image_dst_x </span>= <span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id"><a href="class.upload.html#var$image_x">image_x</a></span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a3682"></a> <span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id">image_dst_y </span>= <a href="http://www.php.net/intval">intval</a><span class="src-sym">(</span><span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id">image_src_y</span>*<span class="src-sym">(</span><span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id"><a href="class.upload.html#var$image_x">image_x</a> </span>/ <span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id">image_src_x</span><span class="src-sym">))</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a3683"></a> <span class="src-var">$ratio_crop </span>= <span class="src-key">array</span><span class="src-sym">(</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a3684"></a> <span class="src-var">$ratio_crop</span><span class="src-sym">[</span><span class="src-str">'y'</span><span class="src-sym">] </span>= <span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id">image_dst_y </span>- <span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id"><a href="class.upload.html#var$image_y">image_y</a></span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a3685"></a> <span class="src-key">if </span><span class="src-sym">(</span><a href="http://www.php.net/strpos">strpos</a><span class="src-sym">(</span><span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id"><a href="class.upload.html#var$image_ratio_fill">image_ratio_fill</a></span><span class="src-sym">, </span><span class="src-str">'t'</span><span class="src-sym">) </span>!== <span class="src-id">false</span><span class="src-sym">) </span><span class="src-sym">{</span></div></li> <li><div class="src-line"><a name="a3686"></a> <span class="src-var">$ratio_crop</span><span class="src-sym">[</span><span class="src-str">'t'</span><span class="src-sym">] </span>= <span class="src-num">0</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a3687"></a> <span class="src-var">$ratio_crop</span><span class="src-sym">[</span><span class="src-str">'b'</span><span class="src-sym">] </span>= <span class="src-var">$ratio_crop</span><span class="src-sym">[</span><span class="src-str">'y'</span><span class="src-sym">]</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a3688"></a> <span class="src-sym">} </span><span class="src-key">else </span><span class="src-key">if </span><span class="src-sym">(</span><a href="http://www.php.net/strpos">strpos</a><span class="src-sym">(</span><span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id"><a href="class.upload.html#var$image_ratio_fill">image_ratio_fill</a></span><span class="src-sym">, </span><span class="src-str">'b'</span><span class="src-sym">) </span>!== <span class="src-id">false</span><span class="src-sym">) </span><span class="src-sym">{</span></div></li> <li><div class="src-line"><a name="a3689"></a> <span class="src-var">$ratio_crop</span><span class="src-sym">[</span><span class="src-str">'t'</span><span class="src-sym">] </span>= <span class="src-var">$ratio_crop</span><span class="src-sym">[</span><span class="src-str">'y'</span><span class="src-sym">]</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a3690"></a> <span class="src-var">$ratio_crop</span><span class="src-sym">[</span><span class="src-str">'b'</span><span class="src-sym">] </span>= <span class="src-num">0</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a3691"></a> <span class="src-sym">} </span><span class="src-key">else </span><span class="src-sym">{</span></div></li> <li><div class="src-line"><a name="a3692"></a> <span class="src-var">$ratio_crop</span><span class="src-sym">[</span><span class="src-str">'t'</span><span class="src-sym">] </span>= <a href="http://www.php.net/round">round</a><span class="src-sym">(</span><span class="src-var">$ratio_crop</span><span class="src-sym">[</span><span class="src-str">'y'</span><span class="src-sym">]</span>/<span class="src-num">2</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a3693"></a> <span class="src-var">$ratio_crop</span><span class="src-sym">[</span><span class="src-str">'b'</span><span class="src-sym">] </span>= <span class="src-var">$ratio_crop</span><span class="src-sym">[</span><span class="src-str">'y'</span><span class="src-sym">] </span>- <span class="src-var">$ratio_crop</span><span class="src-sym">[</span><span class="src-str">'t'</span><span class="src-sym">]</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a3694"></a> <span class="src-sym">}</span></div></li> <li><div class="src-line"><a name="a3695"></a> <span class="src-var">$this</span><span class="src-sym">-></span><a href="http://www.php.net/log">log</a> .= <span class="src-str">'&nbsp;&nbsp;&nbsp;&nbsp;ratio_fill_y : ' </span>. <span class="src-var">$ratio_crop</span><span class="src-sym">[</span><span class="src-str">'y'</span><span class="src-sym">] </span>. <span class="src-str">' (' </span>. <span class="src-var">$ratio_crop</span><span class="src-sym">[</span><span class="src-str">'t'</span><span class="src-sym">] </span>. <span class="src-str">';' </span>. <span class="src-var">$ratio_crop</span><span class="src-sym">[</span><span class="src-str">'b'</span><span class="src-sym">] </span>. <span class="src-str">')<br />'</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a3696"></a> <span class="src-key">if </span><span class="src-sym">(</span><a href="http://www.php.net/is_null">is_null</a><span class="src-sym">(</span><span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id"><a href="class.upload.html#var$image_crop">image_crop</a></span><span class="src-sym">)) </span><span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id"><a href="class.upload.html#var$image_crop">image_crop</a> </span>= <span class="src-key">array</span><span class="src-sym">(</span><span class="src-num">0</span><span class="src-sym">, </span><span class="src-num">0</span><span class="src-sym">, </span><span class="src-num">0</span><span class="src-sym">, </span><span class="src-num">0</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a3697"></a> <span class="src-sym">}</span></div></li> <li><div class="src-line"><a name="a3698"></a> <span class="src-sym">} </span><span class="src-key">else </span><span class="src-sym">{</span></div></li> <li><div class="src-line"><a name="a3699"></a> <span class="src-key">if </span><span class="src-sym">((</span><span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id">image_src_x</span>/<span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id"><a href="class.upload.html#var$image_x">image_x</a></span><span class="src-sym">) </span>> <span class="src-sym">(</span><span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id">image_src_y</span>/<span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id"><a href="class.upload.html#var$image_y">image_y</a></span><span class="src-sym">)) </span><span class="src-sym">{</span></div></li> <li><div class="src-line"><a name="a3700"></a> <span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id">image_dst_x </span>= <span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id"><a href="class.upload.html#var$image_x">image_x</a></span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a3701"></a> <span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id">image_dst_y </span>= <a href="http://www.php.net/intval">intval</a><span class="src-sym">(</span><span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id">image_src_y</span>*<span class="src-sym">(</span><span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id"><a href="class.upload.html#var$image_x">image_x</a> </span>/ <span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id">image_src_x</span><span class="src-sym">))</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a3702"></a> <span class="src-sym">} </span><span class="src-key">else </span><span class="src-sym">{</span></div></li> <li><div class="src-line"><a name="a3703"></a> <span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id">image_dst_y </span>= <span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id"><a href="class.upload.html#var$image_y">image_y</a></span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a3704"></a> <span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id">image_dst_x </span>= <a href="http://www.php.net/intval">intval</a><span class="src-sym">(</span><span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id">image_src_x</span>*<span class="src-sym">(</span><span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id"><a href="class.upload.html#var$image_y">image_y</a> </span>/ <span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id">image_src_y</span><span class="src-sym">))</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a3705"></a> <span class="src-sym">}</span></div></li> <li><div class="src-line"><a name="a3706"></a> <span class="src-sym">}</span></div></li> <li><div class="src-line"><a name="a3707"></a> <span class="src-sym">} </span><span class="src-key">else </span><span class="src-sym">{</span></div></li> <li><div class="src-line"><a name="a3708"></a> <span class="src-var">$this</span><span class="src-sym">-></span><a href="http://www.php.net/log">log</a> .= <span class="src-str">'&nbsp;&nbsp;&nbsp;&nbsp;doesn\'t calculate x/y sizes<br />'</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a3709"></a> <span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id">image_dst_x </span>= <span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id">image_src_x</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a3710"></a> <span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id">image_dst_y </span>= <span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id">image_src_y</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a3711"></a> <span class="src-sym">}</span></div></li> <li><div class="src-line"><a name="a3712"></a> <span class="src-sym">} </span><span class="src-key">else </span><span class="src-sym">{</span></div></li> <li><div class="src-line"><a name="a3713"></a> <span class="src-var">$this</span><span class="src-sym">-></span><a href="http://www.php.net/log">log</a> .= <span class="src-str">'&nbsp;&nbsp;&nbsp;&nbsp;use plain sizes<br />'</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a3714"></a> <span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id">image_dst_x </span>= <span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id"><a href="class.upload.html#var$image_x">image_x</a></span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a3715"></a> <span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id">image_dst_y </span>= <span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id"><a href="class.upload.html#var$image_y">image_y</a></span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a3716"></a> <span class="src-sym">}</span></div></li> <li><div class="src-line"><a name="a3717"></a> </div></li> <li><div class="src-line"><a name="a3718"></a> <span class="src-key">if </span><span class="src-sym">(</span><span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id">image_dst_x </span>< <span class="src-num">1</span><span class="src-sym">) </span><span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id">image_dst_x </span>= <span class="src-num">1</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a3719"></a> <span class="src-key">if </span><span class="src-sym">(</span><span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id">image_dst_y </span>< <span class="src-num">1</span><span class="src-sym">) </span><span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id">image_dst_y </span>= <span class="src-num">1</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a3720"></a> <span class="src-var">$tmp </span>= <span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id">imagecreatenew</span><span class="src-sym">(</span><span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id">image_dst_x</span><span class="src-sym">, </span><span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id">image_dst_y</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a3721"></a> </div></li> <li><div class="src-line"><a name="a3722"></a> <span class="src-key">if </span><span class="src-sym">(</span><span class="src-var">$gd_version </span>>= <span class="src-num">2</span><span class="src-sym">) </span><span class="src-sym">{</span></div></li> <li><div class="src-line"><a name="a3723"></a> <span class="src-var">$res </span>= <a href="http://www.php.net/imagecopyresampled">imagecopyresampled</a><span class="src-sym">(</span><span class="src-var">$tmp</span><span class="src-sym">, </span><span class="src-var">$image_src</span><span class="src-sym">, </span><span class="src-num">0</span><span class="src-sym">, </span><span class="src-num">0</span><span class="src-sym">, </span><span class="src-num">0</span><span class="src-sym">, </span><span class="src-num">0</span><span class="src-sym">, </span><span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id">image_dst_x</span><span class="src-sym">, </span><span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id">image_dst_y</span><span class="src-sym">, </span><span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id">image_src_x</span><span class="src-sym">, </span><span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id">image_src_y</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a3724"></a> <span class="src-sym">} </span><span class="src-key">else </span><span class="src-sym">{</span></div></li> <li><div class="src-line"><a name="a3725"></a> <span class="src-var">$res </span>= <a href="http://www.php.net/imagecopyresized">imagecopyresized</a><span class="src-sym">(</span><span class="src-var">$tmp</span><span class="src-sym">, </span><span class="src-var">$image_src</span><span class="src-sym">, </span><span class="src-num">0</span><span class="src-sym">, </span><span class="src-num">0</span><span class="src-sym">, </span><span class="src-num">0</span><span class="src-sym">, </span><span class="src-num">0</span><span class="src-sym">, </span><span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id">image_dst_x</span><span class="src-sym">, </span><span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id">image_dst_y</span><span class="src-sym">, </span><span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id">image_src_x</span><span class="src-sym">, </span><span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id">image_src_y</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a3726"></a> <span class="src-sym">}</span></div></li> <li><div class="src-line"><a name="a3727"></a> </div></li> <li><div class="src-line"><a name="a3728"></a> <span class="src-var">$this</span><span class="src-sym">-></span><a href="http://www.php.net/log">log</a> .= <span class="src-str">'&nbsp;&nbsp;&nbsp;&nbsp;resized image object created<br />'</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a3729"></a> <span class="src-var">$this</span><span class="src-sym">-></span><a href="http://www.php.net/log">log</a> .= <span class="src-str">'&nbsp;&nbsp;&nbsp;&nbsp;image_src_x y : ' </span>. <span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id">image_src_x </span>. <span class="src-str">' x ' </span>. <span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id">image_src_y </span>. <span class="src-str">'<br />'</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a3730"></a> <span class="src-var">$this</span><span class="src-sym">-></span><a href="http://www.php.net/log">log</a> .= <span class="src-str">'&nbsp;&nbsp;&nbsp;&nbsp;image_dst_x y : ' </span>. <span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id">image_dst_x </span>. <span class="src-str">' x ' </span>. <span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id">image_dst_y </span>. <span class="src-str">'<br />'</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a3731"></a> <span class="src-comm">// we transfert tmp into image_dst</span></div></li> <li><div class="src-line"><a name="a3732"></a> <span class="src-var">$image_dst </span>= <span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id">imagetransfer</span><span class="src-sym">(</span><span class="src-var">$tmp</span><span class="src-sym">, </span><span class="src-var">$image_dst</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a3733"></a> </div></li> <li><div class="src-line"><a name="a3734"></a> <span class="src-sym">} </span><span class="src-key">else </span><span class="src-sym">{</span></div></li> <li><div class="src-line"><a name="a3735"></a> <span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id">image_dst_x </span>= <span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id">image_src_x</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a3736"></a> <span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id">image_dst_y </span>= <span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id">image_src_y</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a3737"></a> <span class="src-sym">}</span></div></li> <li><div class="src-line"><a name="a3738"></a> </div></li> <li><div class="src-line"><a name="a3739"></a> <span class="src-comm">// crop image (and also crops if image_ratio_crop is used)</span></div></li> <li><div class="src-line"><a name="a3740"></a> <span class="src-key">if </span><span class="src-sym">((</span><span class="src-sym">!</span><span class="src-key">empty</span><span class="src-sym">(</span><span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id"><a href="class.upload.html#var$image_crop">image_crop</a></span><span class="src-sym">) </span>|| <span class="src-sym">!</span><a href="http://www.php.net/is_null">is_null</a><span class="src-sym">(</span><span class="src-var">$ratio_crop</span><span class="src-sym">))) </span><span class="src-sym">{</span></div></li> <li><div class="src-line"><a name="a3741"></a> <span class="src-key">if </span><span class="src-sym">(</span><a href="http://www.php.net/is_array">is_array</a><span class="src-sym">(</span><span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id"><a href="class.upload.html#var$image_crop">image_crop</a></span><span class="src-sym">)) </span><span class="src-sym">{</span></div></li> <li><div class="src-line"><a name="a3742"></a> <span class="src-var">$vars </span>= <span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id"><a href="class.upload.html#var$image_crop">image_crop</a></span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a3743"></a> <span class="src-sym">} </span><span class="src-key">else </span><span class="src-sym">{</span></div></li> <li><div class="src-line"><a name="a3744"></a> <span class="src-var">$vars </span>= <a href="http://www.php.net/explode">explode</a><span class="src-sym">(</span><span class="src-str">' '</span><span class="src-sym">, </span><span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id"><a href="class.upload.html#var$image_crop">image_crop</a></span><span class="src-sym">)</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a3745"></a> <span class="src-sym">}</span></div></li> <li><div class="src-line"><a name="a3746"></a> <span class="src-key">if </span><span class="src-sym">(</span><a href="http://www.php.net/sizeof">sizeof</a><span class="src-sym">(</span><span class="src-var">$vars</span><span class="src-sym">) </span>== <span class="src-num">4</span><span class="src-sym">) </span><span class="src-sym">{</span></div></li> <li><div class="src-line"><a name="a3747"></a> <span class="src-var">$ct </span>= <span class="src-var">$vars</span><span class="src-sym">[</span><span class="src-num">0</span><span class="src-sym">]</span><span class="src-sym">; </span><span class="src-var">$cr </span>= <span class="src-var">$vars</span><span class="src-sym">[</span><span class="src-num">1</span><span class="src-sym">]</span><span class="src-sym">; </span><span class="src-var">$cb </span>= <span class="src-var">$vars</span><span class="src-sym">[</span><span class="src-num">2</span><span class="src-sym">]</span><span class="src-sym">; </span><span class="src-var">$cl </span>= <span class="src-var">$vars</span><span class="src-sym">[</span><span class="src-num">3</span><span class="src-sym">]</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a3748"></a> <span class="src-sym">} </span><span class="src-key">else </span><span class="src-key">if </span><span class="src-sym">(</span><a href="http://www.php.net/sizeof">sizeof</a><span class="src-sym">(</span><span class="src-var">$vars</span><span class="src-sym">) </span>== <span class="src-num">2</span><span class="src-sym">) </span><span class="src-sym">{</span></div></li> <li><div class="src-line"><a name="a3749"></a> <span class="src-var">$ct </span>= <span class="src-var">$vars</span><span class="src-sym">[</span><span class="src-num">0</span><span class="src-sym">]</span><span class="src-sym">; </span><span class="src-var">$cr </span>= <span class="src-var">$vars</span><span class="src-sym">[</span><span class="src-num">1</span><span class="src-sym">]</span><span class="src-sym">; </span><span class="src-var">$cb </span>= <span class="src-var">$vars</span><span class="src-sym">[</span><span class="src-num">0</span><span class="src-sym">]</span><span class="src-sym">; </span><span class="src-var">$cl </span>= <span class="src-var">$vars</span><span class="src-sym">[</span><span class="src-num">1</span><span class="src-sym">]</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a3750"></a> <span class="src-sym">} </span><span class="src-key">else </span><span class="src-sym">{</span></div></li> <li><div class="src-line"><a name="a3751"></a> <span class="src-var">$ct </span>= <span class="src-var">$vars</span><span class="src-sym">[</span><span class="src-num">0</span><span class="src-sym">]</span><span class="src-sym">; </span><span class="src-var">$cr </span>= <span class="src-var">$vars</span><span class="src-sym">[</span><span class="src-num">0</span><span class="src-sym">]</span><span class="src-sym">; </span><span class="src-var">$cb </span>= <span class="src-var">$vars</span><span class="src-sym">[</span><span class="src-num">0</span><span class="src-sym">]</span><span class="src-sym">; </span><span class="src-var">$cl </span>= <span class="src-var">$vars</span><span class="src-sym">[</span><span class="src-num">0</span><span class="src-sym">]</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a3752"></a> <span class="src-sym">}</span></div></li> <li><div class="src-line"><a name="a3753"></a> <span class="src-key">if </span><span class="src-sym">(</span><a href="http://www.php.net/strpos">strpos</a><span class="src-sym">(</span><span class="src-var">$ct</span><span class="src-sym">, </span><span class="src-str">'%'</span><span class="src-sym">)</span>><span class="src-num">0</span><span class="src-sym">) </span><span class="src-var">$ct </span>= <span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id">image_dst_y </span>* <span class="src-sym">(</span><a href="http://www.php.net/str_replace">str_replace</a><span class="src-sym">(</span><span class="src-str">'%'</span><span class="src-sym">,</span><span class="src-str">''</span><span class="src-sym">,</span><span class="src-var">$ct</span><span class="src-sym">) </span>/ <span class="src-num">100</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a3754"></a> <span class="src-key">if </span><span class="src-sym">(</span><a href="http://www.php.net/strpos">strpos</a><span class="src-sym">(</span><span class="src-var">$cr</span><span class="src-sym">, </span><span class="src-str">'%'</span><span class="src-sym">)</span>><span class="src-num">0</span><span class="src-sym">) </span><span class="src-var">$cr </span>= <span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id">image_dst_x </span>* <span class="src-sym">(</span><a href="http://www.php.net/str_replace">str_replace</a><span class="src-sym">(</span><span class="src-str">'%'</span><span class="src-sym">,</span><span class="src-str">''</span><span class="src-sym">,</span><span class="src-var">$cr</span><span class="src-sym">) </span>/ <span class="src-num">100</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a3755"></a> <span class="src-key">if </span><span class="src-sym">(</span><a href="http://www.php.net/strpos">strpos</a><span class="src-sym">(</span><span class="src-var">$cb</span><span class="src-sym">, </span><span class="src-str">'%'</span><span class="src-sym">)</span>><span class="src-num">0</span><span class="src-sym">) </span><span class="src-var">$cb </span>= <span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id">image_dst_y </span>* <span class="src-sym">(</span><a href="http://www.php.net/str_replace">str_replace</a><span class="src-sym">(</span><span class="src-str">'%'</span><span class="src-sym">,</span><span class="src-str">''</span><span class="src-sym">,</span><span class="src-var">$cb</span><span class="src-sym">) </span>/ <span class="src-num">100</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a3756"></a> <span class="src-key">if </span><span class="src-sym">(</span><a href="http://www.php.net/strpos">strpos</a><span class="src-sym">(</span><span class="src-var">$cl</span><span class="src-sym">, </span><span class="src-str">'%'</span><span class="src-sym">)</span>><span class="src-num">0</span><span class="src-sym">) </span><span class="src-var">$cl </span>= <span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id">image_dst_x </span>* <span class="src-sym">(</span><a href="http://www.php.net/str_replace">str_replace</a><span class="src-sym">(</span><span class="src-str">'%'</span><span class="src-sym">,</span><span class="src-str">''</span><span class="src-sym">,</span><span class="src-var">$cl</span><span class="src-sym">) </span>/ <span class="src-num">100</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a3757"></a> <span class="src-key">if </span><span class="src-sym">(</span><a href="http://www.php.net/strpos">strpos</a><span class="src-sym">(</span><span class="src-var">$ct</span><span class="src-sym">, </span><span class="src-str">'px'</span><span class="src-sym">)</span>><span class="src-num">0</span><span class="src-sym">) </span><span class="src-var">$ct </span>= <a href="http://www.php.net/str_replace">str_replace</a><span class="src-sym">(</span><span class="src-str">'px'</span><span class="src-sym">,</span><span class="src-str">''</span><span class="src-sym">,</span><span class="src-var">$ct</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a3758"></a> <span class="src-key">if </span><span class="src-sym">(</span><a href="http://www.php.net/strpos">strpos</a><span class="src-sym">(</span><span class="src-var">$cr</span><span class="src-sym">, </span><span class="src-str">'px'</span><span class="src-sym">)</span>><span class="src-num">0</span><span class="src-sym">) </span><span class="src-var">$cr </span>= <a href="http://www.php.net/str_replace">str_replace</a><span class="src-sym">(</span><span class="src-str">'px'</span><span class="src-sym">,</span><span class="src-str">''</span><span class="src-sym">,</span><span class="src-var">$cr</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a3759"></a> <span class="src-key">if </span><span class="src-sym">(</span><a href="http://www.php.net/strpos">strpos</a><span class="src-sym">(</span><span class="src-var">$cb</span><span class="src-sym">, </span><span class="src-str">'px'</span><span class="src-sym">)</span>><span class="src-num">0</span><span class="src-sym">) </span><span class="src-var">$cb </span>= <a href="http://www.php.net/str_replace">str_replace</a><span class="src-sym">(</span><span class="src-str">'px'</span><span class="src-sym">,</span><span class="src-str">''</span><span class="src-sym">,</span><span class="src-var">$cb</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a3760"></a> <span class="src-key">if </span><span class="src-sym">(</span><a href="http://www.php.net/strpos">strpos</a><span class="src-sym">(</span><span class="src-var">$cl</span><span class="src-sym">, </span><span class="src-str">'px'</span><span class="src-sym">)</span>><span class="src-num">0</span><span class="src-sym">) </span><span class="src-var">$cl </span>= <a href="http://www.php.net/str_replace">str_replace</a><span class="src-sym">(</span><span class="src-str">'px'</span><span class="src-sym">,</span><span class="src-str">''</span><span class="src-sym">,</span><span class="src-var">$cl</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a3761"></a> <span class="src-var">$ct </span>= (int) <span class="src-var">$ct</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a3762"></a> <span class="src-var">$cr </span>= (int) <span class="src-var">$cr</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a3763"></a> <span class="src-var">$cb </span>= (int) <span class="src-var">$cb</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a3764"></a> <span class="src-var">$cl </span>= (int) <span class="src-var">$cl</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a3765"></a> <span class="src-comm">// we adjust the cropping if we use image_ratio_crop</span></div></li> <li><div class="src-line"><a name="a3766"></a> <span class="src-key">if </span><span class="src-sym">(</span><span class="src-sym">!</span><a href="http://www.php.net/is_null">is_null</a><span class="src-sym">(</span><span class="src-var">$ratio_crop</span><span class="src-sym">)) </span><span class="src-sym">{</span></div></li> <li><div class="src-line"><a name="a3767"></a> <span class="src-key">if </span><span class="src-sym">(</span><a href="http://www.php.net/array_key_exists">array_key_exists</a><span class="src-sym">(</span><span class="src-str">'t'</span><span class="src-sym">, </span><span class="src-var">$ratio_crop</span><span class="src-sym">)) </span><span class="src-var">$ct </span>+= <span class="src-var">$ratio_crop</span><span class="src-sym">[</span><span class="src-str">'t'</span><span class="src-sym">]</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a3768"></a> <span class="src-key">if </span><span class="src-sym">(</span><a href="http://www.php.net/array_key_exists">array_key_exists</a><span class="src-sym">(</span><span class="src-str">'r'</span><span class="src-sym">, </span><span class="src-var">$ratio_crop</span><span class="src-sym">)) </span><span class="src-var">$cr </span>+= <span class="src-var">$ratio_crop</span><span class="src-sym">[</span><span class="src-str">'r'</span><span class="src-sym">]</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a3769"></a> <span class="src-key">if </span><span class="src-sym">(</span><a href="http://www.php.net/array_key_exists">array_key_exists</a><span class="src-sym">(</span><span class="src-str">'b'</span><span class="src-sym">, </span><span class="src-var">$ratio_crop</span><span class="src-sym">)) </span><span class="src-var">$cb </span>+= <span class="src-var">$ratio_crop</span><span class="src-sym">[</span><span class="src-str">'b'</span><span class="src-sym">]</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a3770"></a> <span class="src-key">if </span><span class="src-sym">(</span><a href="http://www.php.net/array_key_exists">array_key_exists</a><span class="src-sym">(</span><span class="src-str">'l'</span><span class="src-sym">, </span><span class="src-var">$ratio_crop</span><span class="src-sym">)) </span><span class="src-var">$cl </span>+= <span class="src-var">$ratio_crop</span><span class="src-sym">[</span><span class="src-str">'l'</span><span class="src-sym">]</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a3771"></a> <span class="src-sym">}</span></div></li> <li><div class="src-line"><a name="a3772"></a> <span class="src-var">$this</span><span class="src-sym">-></span><a href="http://www.php.net/log">log</a> .= <span class="src-str">'- crop image : ' </span>. <span class="src-var">$ct </span>. <span class="src-str">' ' </span>. <span class="src-var">$cr </span>. <span class="src-str">' ' </span>. <span class="src-var">$cb </span>. <span class="src-str">' ' </span>. <span class="src-var">$cl </span>. <span class="src-str">' <br />'</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a3773"></a> <span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id">image_dst_x </span>= <span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id">image_dst_x </span>- <span class="src-var">$cl </span>- <span class="src-var">$cr</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a3774"></a> <span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id">image_dst_y </span>= <span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id">image_dst_y </span>- <span class="src-var">$ct </span>- <span class="src-var">$cb</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a3775"></a> <span class="src-key">if </span><span class="src-sym">(</span><span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id">image_dst_x </span>< <span class="src-num">1</span><span class="src-sym">) </span><span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id">image_dst_x </span>= <span class="src-num">1</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a3776"></a> <span class="src-key">if </span><span class="src-sym">(</span><span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id">image_dst_y </span>< <span class="src-num">1</span><span class="src-sym">) </span><span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id">image_dst_y </span>= <span class="src-num">1</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a3777"></a> <span class="src-var">$tmp </span>= <span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id">imagecreatenew</span><span class="src-sym">(</span><span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id">image_dst_x</span><span class="src-sym">, </span><span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id">image_dst_y</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a3778"></a> </div></li> <li><div class="src-line"><a name="a3779"></a> <span class="src-comm">// we copy the image into the recieving image</span></div></li> <li><div class="src-line"><a name="a3780"></a> <a href="http://www.php.net/imagecopy">imagecopy</a><span class="src-sym">(</span><span class="src-var">$tmp</span><span class="src-sym">, </span><span class="src-var">$image_dst</span><span class="src-sym">, </span><span class="src-num">0</span><span class="src-sym">, </span><span class="src-num">0</span><span class="src-sym">, </span><span class="src-var">$cl</span><span class="src-sym">, </span><span class="src-var">$ct</span><span class="src-sym">, </span><span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id">image_dst_x</span><span class="src-sym">, </span><span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id">image_dst_y</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a3781"></a> </div></li> <li><div class="src-line"><a name="a3782"></a> <span class="src-comm">// if we crop with negative margins, we have to make sure the extra bits are the right color, or transparent</span></div></li> <li><div class="src-line"><a name="a3783"></a> <span class="src-key">if </span><span class="src-sym">(</span><span class="src-var">$ct </span>< <span class="src-num">0 </span>|| <span class="src-var">$cr </span>< <span class="src-num">0 </span>|| <span class="src-var">$cb </span>< <span class="src-num">0 </span>|| <span class="src-var">$cl </span>< <span class="src-num">0 </span><span class="src-sym">) </span><span class="src-sym">{</span></div></li> <li><div class="src-line"><a name="a3784"></a> <span class="src-comm">// use the background color if present</span></div></li> <li><div class="src-line"><a name="a3785"></a> <span class="src-key">if </span><span class="src-sym">(</span><span class="src-sym">!</span><span class="src-key">empty</span><span class="src-sym">(</span><span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id"><a href="class.upload.html#var$image_background_color">image_background_color</a></span><span class="src-sym">)) </span><span class="src-sym">{</span></div></li> <li><div class="src-line"><a name="a3786"></a> list<span class="src-sym">(</span><span class="src-var">$red</span><span class="src-sym">, </span><span class="src-var">$green</span><span class="src-sym">, </span><span class="src-var">$blue</span><span class="src-sym">) </span>= <span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id">getcolors</span><span class="src-sym">(</span><span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id"><a href="class.upload.html#var$image_background_color">image_background_color</a></span><span class="src-sym">)</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a3787"></a> <span class="src-var">$fill </span>= <a href="http://www.php.net/imagecolorallocate">imagecolorallocate</a><span class="src-sym">(</span><span class="src-var">$tmp</span><span class="src-sym">, </span><span class="src-var">$red</span><span class="src-sym">, </span><span class="src-var">$green</span><span class="src-sym">, </span><span class="src-var">$blue</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a3788"></a> <span class="src-sym">} </span><span class="src-key">else </span><span class="src-sym">{</span></div></li> <li><div class="src-line"><a name="a3789"></a> <span class="src-var">$fill </span>= <a href="http://www.php.net/imagecolorallocatealpha">imagecolorallocatealpha</a><span class="src-sym">(</span><span class="src-var">$tmp</span><span class="src-sym">, </span><span class="src-num">0</span><span class="src-sym">, </span><span class="src-num">0</span><span class="src-sym">, </span><span class="src-num">0</span><span class="src-sym">, </span><span class="src-num">127</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a3790"></a> <span class="src-sym">}</span></div></li> <li><div class="src-line"><a name="a3791"></a> <span class="src-comm">// fills eventual negative margins</span></div></li> <li><div class="src-line"><a name="a3792"></a> <span class="src-key">if </span><span class="src-sym">(</span><span class="src-var">$ct </span>< <span class="src-num">0</span><span class="src-sym">) </span><a href="http://www.php.net/imagefilledrectangle">imagefilledrectangle</a><span class="src-sym">(</span><span class="src-var">$tmp</span><span class="src-sym">, </span><span class="src-num">0</span><span class="src-sym">, </span><span class="src-num">0</span><span class="src-sym">, </span><span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id">image_dst_x</span><span class="src-sym">, </span>-<span class="src-var">$ct</span><span class="src-sym">, </span><span class="src-var">$fill</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a3793"></a> <span class="src-key">if </span><span class="src-sym">(</span><span class="src-var">$cr </span>< <span class="src-num">0</span><span class="src-sym">) </span><a href="http://www.php.net/imagefilledrectangle">imagefilledrectangle</a><span class="src-sym">(</span><span class="src-var">$tmp</span><span class="src-sym">, </span><span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id">image_dst_x </span>+ <span class="src-var">$cr</span><span class="src-sym">, </span><span class="src-num">0</span><span class="src-sym">, </span><span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id">image_dst_x</span><span class="src-sym">, </span><span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id">image_dst_y</span><span class="src-sym">, </span><span class="src-var">$fill</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a3794"></a> <span class="src-key">if </span><span class="src-sym">(</span><span class="src-var">$cb </span>< <span class="src-num">0</span><span class="src-sym">) </span><a href="http://www.php.net/imagefilledrectangle">imagefilledrectangle</a><span class="src-sym">(</span><span class="src-var">$tmp</span><span class="src-sym">, </span><span class="src-num">0</span><span class="src-sym">, </span><span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id">image_dst_y </span>+ <span class="src-var">$cb</span><span class="src-sym">, </span><span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id">image_dst_x</span><span class="src-sym">, </span><span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id">image_dst_y</span><span class="src-sym">, </span><span class="src-var">$fill</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a3795"></a> <span class="src-key">if </span><span class="src-sym">(</span><span class="src-var">$cl </span>< <span class="src-num">0</span><span class="src-sym">) </span><a href="http://www.php.net/imagefilledrectangle">imagefilledrectangle</a><span class="src-sym">(</span><span class="src-var">$tmp</span><span class="src-sym">, </span><span class="src-num">0</span><span class="src-sym">, </span><span class="src-num">0</span><span class="src-sym">, </span>-<span class="src-var">$cl</span><span class="src-sym">, </span><span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id">image_dst_y</span><span class="src-sym">, </span><span class="src-var">$fill</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a3796"></a> <span class="src-sym">}</span></div></li> <li><div class="src-line"><a name="a3797"></a> </div></li> <li><div class="src-line"><a name="a3798"></a> <span class="src-comm">// we transfert tmp into image_dst</span></div></li> <li><div class="src-line"><a name="a3799"></a> <span class="src-var">$image_dst </span>= <span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id">imagetransfer</span><span class="src-sym">(</span><span class="src-var">$tmp</span><span class="src-sym">, </span><span class="src-var">$image_dst</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a3800"></a> <span class="src-sym">}</span></div></li> <li><div class="src-line"><a name="a3801"></a> </div></li> <li><div class="src-line"><a name="a3802"></a> <span class="src-comm">// flip image</span></div></li> <li><div class="src-line"><a name="a3803"></a> <span class="src-key">if </span><span class="src-sym">(</span><span class="src-var">$gd_version </span>>= <span class="src-num">2 </span>&& <span class="src-sym">!</span><span class="src-key">empty</span><span class="src-sym">(</span><span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id"><a href="class.upload.html#var$image_flip">image_flip</a></span><span class="src-sym">)) </span><span class="src-sym">{</span></div></li> <li><div class="src-line"><a name="a3804"></a> <span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id"><a href="class.upload.html#var$image_flip">image_flip</a> </span>= <a href="http://www.php.net/strtolower">strtolower</a><span class="src-sym">(</span><span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id"><a href="class.upload.html#var$image_flip">image_flip</a></span><span class="src-sym">)</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a3805"></a> <span class="src-var">$this</span><span class="src-sym">-></span><a href="http://www.php.net/log">log</a> .= <span class="src-str">'- flip image : ' </span>. <span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id"><a href="class.upload.html#var$image_flip">image_flip</a> </span>. <span class="src-str">'<br />'</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a3806"></a> <span class="src-var">$tmp </span>= <span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id">imagecreatenew</span><span class="src-sym">(</span><span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id">image_dst_x</span><span class="src-sym">, </span><span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id">image_dst_y</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a3807"></a> <span class="src-key">for </span><span class="src-sym">(</span><span class="src-var">$x </span>= <span class="src-num">0</span><span class="src-sym">; </span><span class="src-var">$x </span>< <span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id">image_dst_x</span><span class="src-sym">; </span><span class="src-var">$x</span>++<span class="src-sym">) </span><span class="src-sym">{</span></div></li> <li><div class="src-line"><a name="a3808"></a> <span class="src-key">for </span><span class="src-sym">(</span><span class="src-var">$y </span>= <span class="src-num">0</span><span class="src-sym">; </span><span class="src-var">$y </span>< <span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id">image_dst_y</span><span class="src-sym">; </span><span class="src-var">$y</span>++<span class="src-sym">)</span><span class="src-sym">{</span></div></li> <li><div class="src-line"><a name="a3809"></a> <span class="src-key">if </span><span class="src-sym">(</span><a href="http://www.php.net/strpos">strpos</a><span class="src-sym">(</span><span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id"><a href="class.upload.html#var$image_flip">image_flip</a></span><span class="src-sym">, </span><span class="src-str">'v'</span><span class="src-sym">) </span>!== <span class="src-id">false</span><span class="src-sym">) </span><span class="src-sym">{</span></div></li> <li><div class="src-line"><a name="a3810"></a> <a href="http://www.php.net/imagecopy">imagecopy</a><span class="src-sym">(</span><span class="src-var">$tmp</span><span class="src-sym">, </span><span class="src-var">$image_dst</span><span class="src-sym">, </span><span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id">image_dst_x </span>- <span class="src-var">$x </span>- <span class="src-num">1</span><span class="src-sym">, </span><span class="src-var">$y</span><span class="src-sym">, </span><span class="src-var">$x</span><span class="src-sym">, </span><span class="src-var">$y</span><span class="src-sym">, </span><span class="src-num">1</span><span class="src-sym">, </span><span class="src-num">1</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a3811"></a> <span class="src-sym">} </span><span class="src-key">else </span><span class="src-sym">{</span></div></li> <li><div class="src-line"><a name="a3812"></a> <a href="http://www.php.net/imagecopy">imagecopy</a><span class="src-sym">(</span><span class="src-var">$tmp</span><span class="src-sym">, </span><span class="src-var">$image_dst</span><span class="src-sym">, </span><span class="src-var">$x</span><span class="src-sym">, </span><span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id">image_dst_y </span>- <span class="src-var">$y </span>- <span class="src-num">1</span><span class="src-sym">, </span><span class="src-var">$x</span><span class="src-sym">, </span><span class="src-var">$y</span><span class="src-sym">, </span><span class="src-num">1</span><span class="src-sym">, </span><span class="src-num">1</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a3813"></a> <span class="src-sym">}</span></div></li> <li><div class="src-line"><a name="a3814"></a> <span class="src-sym">}</span></div></li> <li><div class="src-line"><a name="a3815"></a> <span class="src-sym">}</span></div></li> <li><div class="src-line"><a name="a3816"></a> <span class="src-comm">// we transfert tmp into image_dst</span></div></li> <li><div class="src-line"><a name="a3817"></a> <span class="src-var">$image_dst </span>= <span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id">imagetransfer</span><span class="src-sym">(</span><span class="src-var">$tmp</span><span class="src-sym">, </span><span class="src-var">$image_dst</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a3818"></a> <span class="src-sym">}</span></div></li> <li><div class="src-line"><a name="a3819"></a> </div></li> <li><div class="src-line"><a name="a3820"></a> <span class="src-comm">// rotate image</span></div></li> <li><div class="src-line"><a name="a3821"></a> <span class="src-key">if </span><span class="src-sym">(</span><span class="src-var">$gd_version </span>>= <span class="src-num">2 </span>&& <a href="http://www.php.net/is_numeric">is_numeric</a><span class="src-sym">(</span><span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id"><a href="class.upload.html#var$image_rotate">image_rotate</a></span><span class="src-sym">)) </span><span class="src-sym">{</span></div></li> <li><div class="src-line"><a name="a3822"></a> <span class="src-key">if </span><span class="src-sym">(</span><span class="src-sym">!</span><a href="http://www.php.net/in_array">in_array</a><span class="src-sym">(</span><span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id"><a href="class.upload.html#var$image_rotate">image_rotate</a></span><span class="src-sym">, </span><span class="src-key">array</span><span class="src-sym">(</span><span class="src-num">0</span><span class="src-sym">, </span><span class="src-num">90</span><span class="src-sym">, </span><span class="src-num">180</span><span class="src-sym">, </span><span class="src-num">270</span><span class="src-sym">))) </span><span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id"><a href="class.upload.html#var$image_rotate">image_rotate</a> </span>= <span class="src-num">0</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a3823"></a> <span class="src-key">if </span><span class="src-sym">(</span><span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id"><a href="class.upload.html#var$image_rotate">image_rotate</a> </span>!= <span class="src-num">0</span><span class="src-sym">) </span><span class="src-sym">{</span></div></li> <li><div class="src-line"><a name="a3824"></a> <span class="src-key">if </span><span class="src-sym">(</span><span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id"><a href="class.upload.html#var$image_rotate">image_rotate</a> </span>== <span class="src-num">90 </span>|| <span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id"><a href="class.upload.html#var$image_rotate">image_rotate</a> </span>== <span class="src-num">270</span><span class="src-sym">) </span><span class="src-sym">{</span></div></li> <li><div class="src-line"><a name="a3825"></a> <span class="src-var">$tmp </span>= <span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id">imagecreatenew</span><span class="src-sym">(</span><span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id">image_dst_y</span><span class="src-sym">, </span><span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id">image_dst_x</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a3826"></a> <span class="src-sym">} </span><span class="src-key">else </span><span class="src-sym">{</span></div></li> <li><div class="src-line"><a name="a3827"></a> <span class="src-var">$tmp </span>= <span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id">imagecreatenew</span><span class="src-sym">(</span><span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id">image_dst_x</span><span class="src-sym">, </span><span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id">image_dst_y</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a3828"></a> <span class="src-sym">}</span></div></li> <li><div class="src-line"><a name="a3829"></a> <span class="src-var">$this</span><span class="src-sym">-></span><a href="http://www.php.net/log">log</a> .= <span class="src-str">'- rotate image : ' </span>. <span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id"><a href="class.upload.html#var$image_rotate">image_rotate</a> </span>. <span class="src-str">'<br />'</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a3830"></a> <span class="src-key">for </span><span class="src-sym">(</span><span class="src-var">$x </span>= <span class="src-num">0</span><span class="src-sym">; </span><span class="src-var">$x </span>< <span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id">image_dst_x</span><span class="src-sym">; </span><span class="src-var">$x</span>++<span class="src-sym">) </span><span class="src-sym">{</span></div></li> <li><div class="src-line"><a name="a3831"></a> <span class="src-key">for </span><span class="src-sym">(</span><span class="src-var">$y </span>= <span class="src-num">0</span><span class="src-sym">; </span><span class="src-var">$y </span>< <span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id">image_dst_y</span><span class="src-sym">; </span><span class="src-var">$y</span>++<span class="src-sym">)</span><span class="src-sym">{</span></div></li> <li><div class="src-line"><a name="a3832"></a> <span class="src-key">if </span><span class="src-sym">(</span><span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id"><a href="class.upload.html#var$image_rotate">image_rotate</a> </span>== <span class="src-num">90</span><span class="src-sym">) </span><span class="src-sym">{</span></div></li> <li><div class="src-line"><a name="a3833"></a> <a href="http://www.php.net/imagecopy">imagecopy</a><span class="src-sym">(</span><span class="src-var">$tmp</span><span class="src-sym">, </span><span class="src-var">$image_dst</span><span class="src-sym">, </span><span class="src-var">$y</span><span class="src-sym">, </span><span class="src-var">$x</span><span class="src-sym">, </span><span class="src-var">$x</span><span class="src-sym">, </span><span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id">image_dst_y </span>- <span class="src-var">$y </span>- <span class="src-num">1</span><span class="src-sym">, </span><span class="src-num">1</span><span class="src-sym">, </span><span class="src-num">1</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a3834"></a> <span class="src-sym">} </span><span class="src-key">else </span><span class="src-key">if </span><span class="src-sym">(</span><span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id"><a href="class.upload.html#var$image_rotate">image_rotate</a> </span>== <span class="src-num">180</span><span class="src-sym">) </span><span class="src-sym">{</span></div></li> <li><div class="src-line"><a name="a3835"></a> <a href="http://www.php.net/imagecopy">imagecopy</a><span class="src-sym">(</span><span class="src-var">$tmp</span><span class="src-sym">, </span><span class="src-var">$image_dst</span><span class="src-sym">, </span><span class="src-var">$x</span><span class="src-sym">, </span><span class="src-var">$y</span><span class="src-sym">, </span><span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id">image_dst_x </span>- <span class="src-var">$x </span>- <span class="src-num">1</span><span class="src-sym">, </span><span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id">image_dst_y </span>- <span class="src-var">$y </span>- <span class="src-num">1</span><span class="src-sym">, </span><span class="src-num">1</span><span class="src-sym">, </span><span class="src-num">1</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a3836"></a> <span class="src-sym">} </span><span class="src-key">else </span><span class="src-key">if </span><span class="src-sym">(</span><span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id"><a href="class.upload.html#var$image_rotate">image_rotate</a> </span>== <span class="src-num">270</span><span class="src-sym">) </span><span class="src-sym">{</span></div></li> <li><div class="src-line"><a name="a3837"></a> <a href="http://www.php.net/imagecopy">imagecopy</a><span class="src-sym">(</span><span class="src-var">$tmp</span><span class="src-sym">, </span><span class="src-var">$image_dst</span><span class="src-sym">, </span><span class="src-var">$y</span><span class="src-sym">, </span><span class="src-var">$x</span><span class="src-sym">, </span><span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id">image_dst_x </span>- <span class="src-var">$x </span>- <span class="src-num">1</span><span class="src-sym">, </span><span class="src-var">$y</span><span class="src-sym">, </span><span class="src-num">1</span><span class="src-sym">, </span><span class="src-num">1</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a3838"></a> <span class="src-sym">} </span><span class="src-key">else </span><span class="src-sym">{</span></div></li> <li><div class="src-line"><a name="a3839"></a> <a href="http://www.php.net/imagecopy">imagecopy</a><span class="src-sym">(</span><span class="src-var">$tmp</span><span class="src-sym">, </span><span class="src-var">$image_dst</span><span class="src-sym">, </span><span class="src-var">$x</span><span class="src-sym">, </span><span class="src-var">$y</span><span class="src-sym">, </span><span class="src-var">$x</span><span class="src-sym">, </span><span class="src-var">$y</span><span class="src-sym">, </span><span class="src-num">1</span><span class="src-sym">, </span><span class="src-num">1</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a3840"></a> <span class="src-sym">}</span></div></li> <li><div class="src-line"><a name="a3841"></a> <span class="src-sym">}</span></div></li> <li><div class="src-line"><a name="a3842"></a> <span class="src-sym">}</span></div></li> <li><div class="src-line"><a name="a3843"></a> <span class="src-key">if </span><span class="src-sym">(</span><span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id"><a href="class.upload.html#var$image_rotate">image_rotate</a> </span>== <span class="src-num">90 </span>|| <span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id"><a href="class.upload.html#var$image_rotate">image_rotate</a> </span>== <span class="src-num">270</span><span class="src-sym">) </span><span class="src-sym">{</span></div></li> <li><div class="src-line"><a name="a3844"></a> <span class="src-var">$t </span>= <span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id">image_dst_y</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a3845"></a> <span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id">image_dst_y </span>= <span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id">image_dst_x</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a3846"></a> <span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id">image_dst_x </span>= <span class="src-var">$t</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a3847"></a> <span class="src-sym">}</span></div></li> <li><div class="src-line"><a name="a3848"></a> <span class="src-comm">// we transfert tmp into image_dst</span></div></li> <li><div class="src-line"><a name="a3849"></a> <span class="src-var">$image_dst </span>= <span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id">imagetransfer</span><span class="src-sym">(</span><span class="src-var">$tmp</span><span class="src-sym">, </span><span class="src-var">$image_dst</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a3850"></a> <span class="src-sym">}</span></div></li> <li><div class="src-line"><a name="a3851"></a> <span class="src-sym">}</span></div></li> <li><div class="src-line"><a name="a3852"></a> </div></li> <li><div class="src-line"><a name="a3853"></a> <span class="src-comm">// add color overlay</span></div></li> <li><div class="src-line"><a name="a3854"></a> <span class="src-key">if </span><span class="src-sym">(</span><span class="src-var">$gd_version </span>>= <span class="src-num">2 </span>&& <span class="src-sym">(</span><a href="http://www.php.net/is_numeric">is_numeric</a><span class="src-sym">(</span><span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id"><a href="class.upload.html#var$image_overlay_percent">image_overlay_percent</a></span><span class="src-sym">) </span>&& <span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id"><a href="class.upload.html#var$image_overlay_percent">image_overlay_percent</a> </span>> <span class="src-num">0 </span>&& <span class="src-sym">!</span><span class="src-key">empty</span><span class="src-sym">(</span><span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id"><a href="class.upload.html#var$image_overlay_color">image_overlay_color</a></span><span class="src-sym">))) </span><span class="src-sym">{</span></div></li> <li><div class="src-line"><a name="a3855"></a> <span class="src-var">$this</span><span class="src-sym">-></span><a href="http://www.php.net/log">log</a> .= <span class="src-str">'- apply color overlay<br />'</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a3856"></a> list<span class="src-sym">(</span><span class="src-var">$red</span><span class="src-sym">, </span><span class="src-var">$green</span><span class="src-sym">, </span><span class="src-var">$blue</span><span class="src-sym">) </span>= <span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id">getcolors</span><span class="src-sym">(</span><span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id"><a href="class.upload.html#var$image_overlay_color">image_overlay_color</a></span><span class="src-sym">)</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a3857"></a> <span class="src-var">$filter </span>= <a href="http://www.php.net/imagecreatetruecolor">imagecreatetruecolor</a><span class="src-sym">(</span><span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id">image_dst_x</span><span class="src-sym">, </span><span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id">image_dst_y</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a3858"></a> <span class="src-var">$color </span>= <a href="http://www.php.net/imagecolorallocate">imagecolorallocate</a><span class="src-sym">(</span><span class="src-var">$filter</span><span class="src-sym">, </span><span class="src-var">$red</span><span class="src-sym">, </span><span class="src-var">$green</span><span class="src-sym">, </span><span class="src-var">$blue</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a3859"></a> <a href="http://www.php.net/imagefilledrectangle">imagefilledrectangle</a><span class="src-sym">(</span><span class="src-var">$filter</span><span class="src-sym">, </span><span class="src-num">0</span><span class="src-sym">, </span><span class="src-num">0</span><span class="src-sym">, </span><span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id">image_dst_x</span><span class="src-sym">, </span><span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id">image_dst_y</span><span class="src-sym">, </span><span class="src-var">$color</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a3860"></a> <span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id">imagecopymergealpha</span><span class="src-sym">(</span><span class="src-var">$image_dst</span><span class="src-sym">, </span><span class="src-var">$filter</span><span class="src-sym">, </span><span class="src-num">0</span><span class="src-sym">, </span><span class="src-num">0</span><span class="src-sym">, </span><span class="src-num">0</span><span class="src-sym">, </span><span class="src-num">0</span><span class="src-sym">, </span><span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id">image_dst_x</span><span class="src-sym">, </span><span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id">image_dst_y</span><span class="src-sym">, </span><span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id"><a href="class.upload.html#var$image_overlay_percent">image_overlay_percent</a></span><span class="src-sym">)</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a3861"></a> <a href="http://www.php.net/imagedestroy">imagedestroy</a><span class="src-sym">(</span><span class="src-var">$filter</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a3862"></a> <span class="src-sym">}</span></div></li> <li><div class="src-line"><a name="a3863"></a> </div></li> <li><div class="src-line"><a name="a3864"></a> <span class="src-comm">// add brightness, contrast and tint, turns to greyscale and inverts colors</span></div></li> <li><div class="src-line"><a name="a3865"></a> <span class="src-key">if </span><span class="src-sym">(</span><span class="src-var">$gd_version </span>>= <span class="src-num">2 </span>&& <span class="src-sym">(</span><span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id"><a href="class.upload.html#var$image_negative">image_negative</a> </span>|| <span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id"><a href="class.upload.html#var$image_greyscale">image_greyscale</a> </span>|| <a href="http://www.php.net/is_numeric">is_numeric</a><span class="src-sym">(</span><span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id"><a href="class.upload.html#var$image_threshold">image_threshold</a></span><span class="src-sym">)</span>|| <a href="http://www.php.net/is_numeric">is_numeric</a><span class="src-sym">(</span><span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id"><a href="class.upload.html#var$image_brightness">image_brightness</a></span><span class="src-sym">) </span>|| <a href="http://www.php.net/is_numeric">is_numeric</a><span class="src-sym">(</span><span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id"><a href="class.upload.html#var$image_contrast">image_contrast</a></span><span class="src-sym">) </span>|| <span class="src-sym">!</span><span class="src-key">empty</span><span class="src-sym">(</span><span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id"><a href="class.upload.html#var$image_tint_color">image_tint_color</a></span><span class="src-sym">))) </span><span class="src-sym">{</span></div></li> <li><div class="src-line"><a name="a3866"></a> <span class="src-var">$this</span><span class="src-sym">-></span><a href="http://www.php.net/log">log</a> .= <span class="src-str">'- apply tint, light, contrast correction, negative, greyscale and threshold<br />'</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a3867"></a> <span class="src-key">if </span><span class="src-sym">(</span><span class="src-sym">!</span><span class="src-key">empty</span><span class="src-sym">(</span><span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id"><a href="class.upload.html#var$image_tint_color">image_tint_color</a></span><span class="src-sym">)) </span>list<span class="src-sym">(</span><span class="src-var">$tint_red</span><span class="src-sym">, </span><span class="src-var">$tint_green</span><span class="src-sym">, </span><span class="src-var">$tint_blue</span><span class="src-sym">) </span>= <span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id">getcolors</span><span class="src-sym">(</span><span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id"><a href="class.upload.html#var$image_tint_color">image_tint_color</a></span><span class="src-sym">)</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a3868"></a> <a href="http://www.php.net/imagealphablending">imagealphablending</a><span class="src-sym">(</span><span class="src-var">$image_dst</span><span class="src-sym">, </span><span class="src-id">true</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a3869"></a> <span class="src-key">for</span><span class="src-sym">(</span><span class="src-var">$y</span>=<span class="src-num">0</span><span class="src-sym">; </span><span class="src-var">$y </span>< <span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id">image_dst_y</span><span class="src-sym">; </span><span class="src-var">$y</span>++<span class="src-sym">) </span><span class="src-sym">{</span></div></li> <li><div class="src-line"><a name="a3870"></a> <span class="src-key">for</span><span class="src-sym">(</span><span class="src-var">$x</span>=<span class="src-num">0</span><span class="src-sym">; </span><span class="src-var">$x </span>< <span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id">image_dst_x</span><span class="src-sym">; </span><span class="src-var">$x</span>++<span class="src-sym">) </span><span class="src-sym">{</span></div></li> <li><div class="src-line"><a name="a3871"></a> <span class="src-key">if </span><span class="src-sym">(</span><span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id"><a href="class.upload.html#var$image_greyscale">image_greyscale</a></span><span class="src-sym">) </span><span class="src-sym">{</span></div></li> <li><div class="src-line"><a name="a3872"></a> <span class="src-var">$pixel </span>= <a href="http://www.php.net/imagecolorsforindex">imagecolorsforindex</a><span class="src-sym">(</span><span class="src-var">$image_dst</span><span class="src-sym">, </span><a href="http://www.php.net/imagecolorat">imagecolorat</a><span class="src-sym">(</span><span class="src-var">$image_dst</span><span class="src-sym">, </span><span class="src-var">$x</span><span class="src-sym">, </span><span class="src-var">$y</span><span class="src-sym">))</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a3873"></a> <span class="src-var">$r </span>= <span class="src-var">$g </span>= <span class="src-var">$b </span>= <a href="http://www.php.net/round">round</a><span class="src-sym">((</span><span class="src-num">0.2125 </span>* <span class="src-var">$pixel</span><span class="src-sym">[</span><span class="src-str">'red'</span><span class="src-sym">]</span><span class="src-sym">) </span>+ <span class="src-sym">(</span><span class="src-num">0.7154 </span>* <span class="src-var">$pixel</span><span class="src-sym">[</span><span class="src-str">'green'</span><span class="src-sym">]</span><span class="src-sym">) </span>+ <span class="src-sym">(</span><span class="src-num">0.0721 </span>* <span class="src-var">$pixel</span><span class="src-sym">[</span><span class="src-str">'blue'</span><span class="src-sym">]</span><span class="src-sym">))</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a3874"></a> <span class="src-var">$color </span>= <a href="http://www.php.net/imagecolorallocatealpha">imagecolorallocatealpha</a><span class="src-sym">(</span><span class="src-var">$image_dst</span><span class="src-sym">, </span><span class="src-var">$r</span><span class="src-sym">, </span><span class="src-var">$g</span><span class="src-sym">, </span><span class="src-var">$b</span><span class="src-sym">, </span><span class="src-var">$pixel</span><span class="src-sym">[</span><span class="src-str">'alpha'</span><span class="src-sym">]</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a3875"></a> <a href="http://www.php.net/imagesetpixel">imagesetpixel</a><span class="src-sym">(</span><span class="src-var">$image_dst</span><span class="src-sym">, </span><span class="src-var">$x</span><span class="src-sym">, </span><span class="src-var">$y</span><span class="src-sym">, </span><span class="src-var">$color</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a3876"></a> <span class="src-sym">}</span></div></li> <li><div class="src-line"><a name="a3877"></a> <span class="src-key">if </span><span class="src-sym">(</span><a href="http://www.php.net/is_numeric">is_numeric</a><span class="src-sym">(</span><span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id"><a href="class.upload.html#var$image_threshold">image_threshold</a></span><span class="src-sym">)) </span><span class="src-sym">{</span></div></li> <li><div class="src-line"><a name="a3878"></a> <span class="src-var">$pixel </span>= <a href="http://www.php.net/imagecolorsforindex">imagecolorsforindex</a><span class="src-sym">(</span><span class="src-var">$image_dst</span><span class="src-sym">, </span><a href="http://www.php.net/imagecolorat">imagecolorat</a><span class="src-sym">(</span><span class="src-var">$image_dst</span><span class="src-sym">, </span><span class="src-var">$x</span><span class="src-sym">, </span><span class="src-var">$y</span><span class="src-sym">))</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a3879"></a> <span class="src-var">$c </span>= <span class="src-sym">(</span><a href="http://www.php.net/round">round</a><span class="src-sym">(</span><span class="src-var">$pixel</span><span class="src-sym">[</span><span class="src-str">'red'</span><span class="src-sym">] </span>+ <span class="src-var">$pixel</span><span class="src-sym">[</span><span class="src-str">'green'</span><span class="src-sym">] </span>+ <span class="src-var">$pixel</span><span class="src-sym">[</span><span class="src-str">'blue'</span><span class="src-sym">]</span><span class="src-sym">) </span>/ <span class="src-num">3</span><span class="src-sym">) </span>- <span class="src-num">127</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a3880"></a> <span class="src-var">$r </span>= <span class="src-var">$g </span>= <span class="src-var">$b </span>= <span class="src-sym">(</span><span class="src-var">$c </span>> <span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id"><a href="class.upload.html#var$image_threshold">image_threshold</a> </span>? <span class="src-num">255 </span>: <span class="src-num">0</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a3881"></a> <span class="src-var">$color </span>= <a href="http://www.php.net/imagecolorallocatealpha">imagecolorallocatealpha</a><span class="src-sym">(</span><span class="src-var">$image_dst</span><span class="src-sym">, </span><span class="src-var">$r</span><span class="src-sym">, </span><span class="src-var">$g</span><span class="src-sym">, </span><span class="src-var">$b</span><span class="src-sym">, </span><span class="src-var">$pixel</span><span class="src-sym">[</span><span class="src-str">'alpha'</span><span class="src-sym">]</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a3882"></a> <a href="http://www.php.net/imagesetpixel">imagesetpixel</a><span class="src-sym">(</span><span class="src-var">$image_dst</span><span class="src-sym">, </span><span class="src-var">$x</span><span class="src-sym">, </span><span class="src-var">$y</span><span class="src-sym">, </span><span class="src-var">$color</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a3883"></a> <span class="src-sym">}</span></div></li> <li><div class="src-line"><a name="a3884"></a> <span class="src-key">if </span><span class="src-sym">(</span><a href="http://www.php.net/is_numeric">is_numeric</a><span class="src-sym">(</span><span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id"><a href="class.upload.html#var$image_brightness">image_brightness</a></span><span class="src-sym">)) </span><span class="src-sym">{</span></div></li> <li><div class="src-line"><a name="a3885"></a> <span class="src-var">$pixel </span>= <a href="http://www.php.net/imagecolorsforindex">imagecolorsforindex</a><span class="src-sym">(</span><span class="src-var">$image_dst</span><span class="src-sym">, </span><a href="http://www.php.net/imagecolorat">imagecolorat</a><span class="src-sym">(</span><span class="src-var">$image_dst</span><span class="src-sym">, </span><span class="src-var">$x</span><span class="src-sym">, </span><span class="src-var">$y</span><span class="src-sym">))</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a3886"></a> <span class="src-var">$r </span>= <a href="http://www.php.net/max">max</a><span class="src-sym">(</span><a href="http://www.php.net/min">min</a><span class="src-sym">(</span><a href="http://www.php.net/round">round</a><span class="src-sym">(</span><span class="src-var">$pixel</span><span class="src-sym">[</span><span class="src-str">'red'</span><span class="src-sym">] </span>+ <span class="src-sym">((</span><span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id"><a href="class.upload.html#var$image_brightness">image_brightness</a> </span>* <span class="src-num">2</span><span class="src-sym">)))</span><span class="src-sym">, </span><span class="src-num">255</span><span class="src-sym">)</span><span class="src-sym">, </span><span class="src-num">0</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a3887"></a> <span class="src-var">$g </span>= <a href="http://www.php.net/max">max</a><span class="src-sym">(</span><a href="http://www.php.net/min">min</a><span class="src-sym">(</span><a href="http://www.php.net/round">round</a><span class="src-sym">(</span><span class="src-var">$pixel</span><span class="src-sym">[</span><span class="src-str">'green'</span><span class="src-sym">] </span>+ <span class="src-sym">((</span><span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id"><a href="class.upload.html#var$image_brightness">image_brightness</a> </span>* <span class="src-num">2</span><span class="src-sym">)))</span><span class="src-sym">, </span><span class="src-num">255</span><span class="src-sym">)</span><span class="src-sym">, </span><span class="src-num">0</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a3888"></a> <span class="src-var">$b </span>= <a href="http://www.php.net/max">max</a><span class="src-sym">(</span><a href="http://www.php.net/min">min</a><span class="src-sym">(</span><a href="http://www.php.net/round">round</a><span class="src-sym">(</span><span class="src-var">$pixel</span><span class="src-sym">[</span><span class="src-str">'blue'</span><span class="src-sym">] </span>+ <span class="src-sym">((</span><span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id"><a href="class.upload.html#var$image_brightness">image_brightness</a> </span>* <span class="src-num">2</span><span class="src-sym">)))</span><span class="src-sym">, </span><span class="src-num">255</span><span class="src-sym">)</span><span class="src-sym">, </span><span class="src-num">0</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a3889"></a> <span class="src-var">$color </span>= <a href="http://www.php.net/imagecolorallocatealpha">imagecolorallocatealpha</a><span class="src-sym">(</span><span class="src-var">$image_dst</span><span class="src-sym">, </span><span class="src-var">$r</span><span class="src-sym">, </span><span class="src-var">$g</span><span class="src-sym">, </span><span class="src-var">$b</span><span class="src-sym">, </span><span class="src-var">$pixel</span><span class="src-sym">[</span><span class="src-str">'alpha'</span><span class="src-sym">]</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a3890"></a> <a href="http://www.php.net/imagesetpixel">imagesetpixel</a><span class="src-sym">(</span><span class="src-var">$image_dst</span><span class="src-sym">, </span><span class="src-var">$x</span><span class="src-sym">, </span><span class="src-var">$y</span><span class="src-sym">, </span><span class="src-var">$color</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a3891"></a> <span class="src-sym">}</span></div></li> <li><div class="src-line"><a name="a3892"></a> <span class="src-key">if </span><span class="src-sym">(</span><a href="http://www.php.net/is_numeric">is_numeric</a><span class="src-sym">(</span><span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id"><a href="class.upload.html#var$image_contrast">image_contrast</a></span><span class="src-sym">)) </span><span class="src-sym">{</span></div></li> <li><div class="src-line"><a name="a3893"></a> <span class="src-var">$pixel </span>= <a href="http://www.php.net/imagecolorsforindex">imagecolorsforindex</a><span class="src-sym">(</span><span class="src-var">$image_dst</span><span class="src-sym">, </span><a href="http://www.php.net/imagecolorat">imagecolorat</a><span class="src-sym">(</span><span class="src-var">$image_dst</span><span class="src-sym">, </span><span class="src-var">$x</span><span class="src-sym">, </span><span class="src-var">$y</span><span class="src-sym">))</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a3894"></a> <span class="src-var">$r </span>= <a href="http://www.php.net/max">max</a><span class="src-sym">(</span><a href="http://www.php.net/min">min</a><span class="src-sym">(</span><a href="http://www.php.net/round">round</a><span class="src-sym">((</span><span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id"><a href="class.upload.html#var$image_contrast">image_contrast</a> </span>+ <span class="src-num">128</span><span class="src-sym">) </span>* <span class="src-var">$pixel</span><span class="src-sym">[</span><span class="src-str">'red'</span><span class="src-sym">] </span>/ <span class="src-num">128</span><span class="src-sym">)</span><span class="src-sym">, </span><span class="src-num">255</span><span class="src-sym">)</span><span class="src-sym">, </span><span class="src-num">0</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a3895"></a> <span class="src-var">$g </span>= <a href="http://www.php.net/max">max</a><span class="src-sym">(</span><a href="http://www.php.net/min">min</a><span class="src-sym">(</span><a href="http://www.php.net/round">round</a><span class="src-sym">((</span><span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id"><a href="class.upload.html#var$image_contrast">image_contrast</a> </span>+ <span class="src-num">128</span><span class="src-sym">) </span>* <span class="src-var">$pixel</span><span class="src-sym">[</span><span class="src-str">'green'</span><span class="src-sym">] </span>/ <span class="src-num">128</span><span class="src-sym">)</span><span class="src-sym">, </span><span class="src-num">255</span><span class="src-sym">)</span><span class="src-sym">, </span><span class="src-num">0</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a3896"></a> <span class="src-var">$b </span>= <a href="http://www.php.net/max">max</a><span class="src-sym">(</span><a href="http://www.php.net/min">min</a><span class="src-sym">(</span><a href="http://www.php.net/round">round</a><span class="src-sym">((</span><span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id"><a href="class.upload.html#var$image_contrast">image_contrast</a> </span>+ <span class="src-num">128</span><span class="src-sym">) </span>* <span class="src-var">$pixel</span><span class="src-sym">[</span><span class="src-str">'blue'</span><span class="src-sym">] </span>/ <span class="src-num">128</span><span class="src-sym">)</span><span class="src-sym">, </span><span class="src-num">255</span><span class="src-sym">)</span><span class="src-sym">, </span><span class="src-num">0</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a3897"></a> <span class="src-var">$color </span>= <a href="http://www.php.net/imagecolorallocatealpha">imagecolorallocatealpha</a><span class="src-sym">(</span><span class="src-var">$image_dst</span><span class="src-sym">, </span><span class="src-var">$r</span><span class="src-sym">, </span><span class="src-var">$g</span><span class="src-sym">, </span><span class="src-var">$b</span><span class="src-sym">, </span><span class="src-var">$pixel</span><span class="src-sym">[</span><span class="src-str">'alpha'</span><span class="src-sym">]</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a3898"></a> <a href="http://www.php.net/imagesetpixel">imagesetpixel</a><span class="src-sym">(</span><span class="src-var">$image_dst</span><span class="src-sym">, </span><span class="src-var">$x</span><span class="src-sym">, </span><span class="src-var">$y</span><span class="src-sym">, </span><span class="src-var">$color</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a3899"></a> <span class="src-sym">}</span></div></li> <li><div class="src-line"><a name="a3900"></a> <span class="src-key">if </span><span class="src-sym">(</span><span class="src-sym">!</span><span class="src-key">empty</span><span class="src-sym">(</span><span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id"><a href="class.upload.html#var$image_tint_color">image_tint_color</a></span><span class="src-sym">)) </span><span class="src-sym">{</span></div></li> <li><div class="src-line"><a name="a3901"></a> <span class="src-var">$pixel </span>= <a href="http://www.php.net/imagecolorsforindex">imagecolorsforindex</a><span class="src-sym">(</span><span class="src-var">$image_dst</span><span class="src-sym">, </span><a href="http://www.php.net/imagecolorat">imagecolorat</a><span class="src-sym">(</span><span class="src-var">$image_dst</span><span class="src-sym">, </span><span class="src-var">$x</span><span class="src-sym">, </span><span class="src-var">$y</span><span class="src-sym">))</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a3902"></a> <span class="src-var">$r </span>= <a href="http://www.php.net/min">min</a><span class="src-sym">(</span><a href="http://www.php.net/round">round</a><span class="src-sym">(</span><span class="src-var">$tint_red </span>* <span class="src-var">$pixel</span><span class="src-sym">[</span><span class="src-str">'red'</span><span class="src-sym">] </span>/ <span class="src-num">169</span><span class="src-sym">)</span><span class="src-sym">, </span><span class="src-num">255</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a3903"></a> <span class="src-var">$g </span>= <a href="http://www.php.net/min">min</a><span class="src-sym">(</span><a href="http://www.php.net/round">round</a><span class="src-sym">(</span><span class="src-var">$tint_green </span>* <span class="src-var">$pixel</span><span class="src-sym">[</span><span class="src-str">'green'</span><span class="src-sym">] </span>/ <span class="src-num">169</span><span class="src-sym">)</span><span class="src-sym">, </span><span class="src-num">255</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a3904"></a> <span class="src-var">$b </span>= <a href="http://www.php.net/min">min</a><span class="src-sym">(</span><a href="http://www.php.net/round">round</a><span class="src-sym">(</span><span class="src-var">$tint_blue </span>* <span class="src-var">$pixel</span><span class="src-sym">[</span><span class="src-str">'blue'</span><span class="src-sym">] </span>/ <span class="src-num">169</span><span class="src-sym">)</span><span class="src-sym">, </span><span class="src-num">255</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a3905"></a> <span class="src-var">$color </span>= <a href="http://www.php.net/imagecolorallocatealpha">imagecolorallocatealpha</a><span class="src-sym">(</span><span class="src-var">$image_dst</span><span class="src-sym">, </span><span class="src-var">$r</span><span class="src-sym">, </span><span class="src-var">$g</span><span class="src-sym">, </span><span class="src-var">$b</span><span class="src-sym">, </span><span class="src-var">$pixel</span><span class="src-sym">[</span><span class="src-str">'alpha'</span><span class="src-sym">]</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a3906"></a> <a href="http://www.php.net/imagesetpixel">imagesetpixel</a><span class="src-sym">(</span><span class="src-var">$image_dst</span><span class="src-sym">, </span><span class="src-var">$x</span><span class="src-sym">, </span><span class="src-var">$y</span><span class="src-sym">, </span><span class="src-var">$color</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a3907"></a> <span class="src-sym">}</span></div></li> <li><div class="src-line"><a name="a3908"></a> <span class="src-key">if </span><span class="src-sym">(</span><span class="src-sym">!</span><span class="src-key">empty</span><span class="src-sym">(</span><span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id"><a href="class.upload.html#var$image_negative">image_negative</a></span><span class="src-sym">)) </span><span class="src-sym">{</span></div></li> <li><div class="src-line"><a name="a3909"></a> <span class="src-var">$pixel </span>= <a href="http://www.php.net/imagecolorsforindex">imagecolorsforindex</a><span class="src-sym">(</span><span class="src-var">$image_dst</span><span class="src-sym">, </span><a href="http://www.php.net/imagecolorat">imagecolorat</a><span class="src-sym">(</span><span class="src-var">$image_dst</span><span class="src-sym">, </span><span class="src-var">$x</span><span class="src-sym">, </span><span class="src-var">$y</span><span class="src-sym">))</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a3910"></a> <span class="src-var">$r </span>= <a href="http://www.php.net/round">round</a><span class="src-sym">(</span><span class="src-num">255 </span>- <span class="src-var">$pixel</span><span class="src-sym">[</span><span class="src-str">'red'</span><span class="src-sym">]</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a3911"></a> <span class="src-var">$g </span>= <a href="http://www.php.net/round">round</a><span class="src-sym">(</span><span class="src-num">255 </span>- <span class="src-var">$pixel</span><span class="src-sym">[</span><span class="src-str">'green'</span><span class="src-sym">]</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a3912"></a> <span class="src-var">$b </span>= <a href="http://www.php.net/round">round</a><span class="src-sym">(</span><span class="src-num">255 </span>- <span class="src-var">$pixel</span><span class="src-sym">[</span><span class="src-str">'blue'</span><span class="src-sym">]</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a3913"></a> <span class="src-var">$color </span>= <a href="http://www.php.net/imagecolorallocatealpha">imagecolorallocatealpha</a><span class="src-sym">(</span><span class="src-var">$image_dst</span><span class="src-sym">, </span><span class="src-var">$r</span><span class="src-sym">, </span><span class="src-var">$g</span><span class="src-sym">, </span><span class="src-var">$b</span><span class="src-sym">, </span><span class="src-var">$pixel</span><span class="src-sym">[</span><span class="src-str">'alpha'</span><span class="src-sym">]</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a3914"></a> <a href="http://www.php.net/imagesetpixel">imagesetpixel</a><span class="src-sym">(</span><span class="src-var">$image_dst</span><span class="src-sym">, </span><span class="src-var">$x</span><span class="src-sym">, </span><span class="src-var">$y</span><span class="src-sym">, </span><span class="src-var">$color</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a3915"></a> <span class="src-sym">}</span></div></li> <li><div class="src-line"><a name="a3916"></a> <span class="src-sym">}</span></div></li> <li><div class="src-line"><a name="a3917"></a> <span class="src-sym">}</span></div></li> <li><div class="src-line"><a name="a3918"></a> <span class="src-sym">}</span></div></li> <li><div class="src-line"><a name="a3919"></a> </div></li> <li><div class="src-line"><a name="a3920"></a> <span class="src-comm">// adds a border</span></div></li> <li><div class="src-line"><a name="a3921"></a> <span class="src-key">if </span><span class="src-sym">(</span><span class="src-var">$gd_version </span>>= <span class="src-num">2 </span>&& <span class="src-sym">!</span><span class="src-key">empty</span><span class="src-sym">(</span><span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id"><a href="class.upload.html#var$image_border">image_border</a></span><span class="src-sym">)) </span><span class="src-sym">{</span></div></li> <li><div class="src-line"><a name="a3922"></a> <span class="src-key">if </span><span class="src-sym">(</span><a href="http://www.php.net/is_array">is_array</a><span class="src-sym">(</span><span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id"><a href="class.upload.html#var$image_border">image_border</a></span><span class="src-sym">)) </span><span class="src-sym">{</span></div></li> <li><div class="src-line"><a name="a3923"></a> <span class="src-var">$vars </span>= <span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id"><a href="class.upload.html#var$image_border">image_border</a></span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a3924"></a> <span class="src-var">$this</span><span class="src-sym">-></span><a href="http://www.php.net/log">log</a> .= <span class="src-str">'- add border : ' </span>. <a href="http://www.php.net/implode">implode</a><span class="src-sym">(</span><span class="src-str">' '</span><span class="src-sym">, </span><span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id"><a href="class.upload.html#var$image_border">image_border</a></span><span class="src-sym">) </span>. <span class="src-str">'<br />'</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a3925"></a> <span class="src-sym">} </span><span class="src-key">else </span><span class="src-sym">{</span></div></li> <li><div class="src-line"><a name="a3926"></a> <span class="src-var">$this</span><span class="src-sym">-></span><a href="http://www.php.net/log">log</a> .= <span class="src-str">'- add border : ' </span>. <span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id"><a href="class.upload.html#var$image_border">image_border</a> </span>. <span class="src-str">'<br />'</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a3927"></a> <span class="src-var">$vars </span>= <a href="http://www.php.net/explode">explode</a><span class="src-sym">(</span><span class="src-str">' '</span><span class="src-sym">, </span><span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id"><a href="class.upload.html#var$image_border">image_border</a></span><span class="src-sym">)</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a3928"></a> <span class="src-sym">}</span></div></li> <li><div class="src-line"><a name="a3929"></a> <span class="src-key">if </span><span class="src-sym">(</span><a href="http://www.php.net/sizeof">sizeof</a><span class="src-sym">(</span><span class="src-var">$vars</span><span class="src-sym">) </span>== <span class="src-num">4</span><span class="src-sym">) </span><span class="src-sym">{</span></div></li> <li><div class="src-line"><a name="a3930"></a> <span class="src-var">$ct </span>= <span class="src-var">$vars</span><span class="src-sym">[</span><span class="src-num">0</span><span class="src-sym">]</span><span class="src-sym">; </span><span class="src-var">$cr </span>= <span class="src-var">$vars</span><span class="src-sym">[</span><span class="src-num">1</span><span class="src-sym">]</span><span class="src-sym">; </span><span class="src-var">$cb </span>= <span class="src-var">$vars</span><span class="src-sym">[</span><span class="src-num">2</span><span class="src-sym">]</span><span class="src-sym">; </span><span class="src-var">$cl </span>= <span class="src-var">$vars</span><span class="src-sym">[</span><span class="src-num">3</span><span class="src-sym">]</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a3931"></a> <span class="src-sym">} </span><span class="src-key">else </span><span class="src-key">if </span><span class="src-sym">(</span><a href="http://www.php.net/sizeof">sizeof</a><span class="src-sym">(</span><span class="src-var">$vars</span><span class="src-sym">) </span>== <span class="src-num">2</span><span class="src-sym">) </span><span class="src-sym">{</span></div></li> <li><div class="src-line"><a name="a3932"></a> <span class="src-var">$ct </span>= <span class="src-var">$vars</span><span class="src-sym">[</span><span class="src-num">0</span><span class="src-sym">]</span><span class="src-sym">; </span><span class="src-var">$cr </span>= <span class="src-var">$vars</span><span class="src-sym">[</span><span class="src-num">1</span><span class="src-sym">]</span><span class="src-sym">; </span><span class="src-var">$cb </span>= <span class="src-var">$vars</span><span class="src-sym">[</span><span class="src-num">0</span><span class="src-sym">]</span><span class="src-sym">; </span><span class="src-var">$cl </span>= <span class="src-var">$vars</span><span class="src-sym">[</span><span class="src-num">1</span><span class="src-sym">]</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a3933"></a> <span class="src-sym">} </span><span class="src-key">else </span><span class="src-sym">{</span></div></li> <li><div class="src-line"><a name="a3934"></a> <span class="src-var">$ct </span>= <span class="src-var">$vars</span><span class="src-sym">[</span><span class="src-num">0</span><span class="src-sym">]</span><span class="src-sym">; </span><span class="src-var">$cr </span>= <span class="src-var">$vars</span><span class="src-sym">[</span><span class="src-num">0</span><span class="src-sym">]</span><span class="src-sym">; </span><span class="src-var">$cb </span>= <span class="src-var">$vars</span><span class="src-sym">[</span><span class="src-num">0</span><span class="src-sym">]</span><span class="src-sym">; </span><span class="src-var">$cl </span>= <span class="src-var">$vars</span><span class="src-sym">[</span><span class="src-num">0</span><span class="src-sym">]</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a3935"></a> <span class="src-sym">}</span></div></li> <li><div class="src-line"><a name="a3936"></a> <span class="src-key">if </span><span class="src-sym">(</span><a href="http://www.php.net/strpos">strpos</a><span class="src-sym">(</span><span class="src-var">$ct</span><span class="src-sym">, </span><span class="src-str">'%'</span><span class="src-sym">)</span>><span class="src-num">0</span><span class="src-sym">) </span><span class="src-var">$ct </span>= <span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id">image_dst_y </span>* <span class="src-sym">(</span><a href="http://www.php.net/str_replace">str_replace</a><span class="src-sym">(</span><span class="src-str">'%'</span><span class="src-sym">,</span><span class="src-str">''</span><span class="src-sym">,</span><span class="src-var">$ct</span><span class="src-sym">) </span>/ <span class="src-num">100</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a3937"></a> <span class="src-key">if </span><span class="src-sym">(</span><a href="http://www.php.net/strpos">strpos</a><span class="src-sym">(</span><span class="src-var">$cr</span><span class="src-sym">, </span><span class="src-str">'%'</span><span class="src-sym">)</span>><span class="src-num">0</span><span class="src-sym">) </span><span class="src-var">$cr </span>= <span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id">image_dst_x </span>* <span class="src-sym">(</span><a href="http://www.php.net/str_replace">str_replace</a><span class="src-sym">(</span><span class="src-str">'%'</span><span class="src-sym">,</span><span class="src-str">''</span><span class="src-sym">,</span><span class="src-var">$cr</span><span class="src-sym">) </span>/ <span class="src-num">100</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a3938"></a> <span class="src-key">if </span><span class="src-sym">(</span><a href="http://www.php.net/strpos">strpos</a><span class="src-sym">(</span><span class="src-var">$cb</span><span class="src-sym">, </span><span class="src-str">'%'</span><span class="src-sym">)</span>><span class="src-num">0</span><span class="src-sym">) </span><span class="src-var">$cb </span>= <span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id">image_dst_y </span>* <span class="src-sym">(</span><a href="http://www.php.net/str_replace">str_replace</a><span class="src-sym">(</span><span class="src-str">'%'</span><span class="src-sym">,</span><span class="src-str">''</span><span class="src-sym">,</span><span class="src-var">$cb</span><span class="src-sym">) </span>/ <span class="src-num">100</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a3939"></a> <span class="src-key">if </span><span class="src-sym">(</span><a href="http://www.php.net/strpos">strpos</a><span class="src-sym">(</span><span class="src-var">$cl</span><span class="src-sym">, </span><span class="src-str">'%'</span><span class="src-sym">)</span>><span class="src-num">0</span><span class="src-sym">) </span><span class="src-var">$cl </span>= <span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id">image_dst_x </span>* <span class="src-sym">(</span><a href="http://www.php.net/str_replace">str_replace</a><span class="src-sym">(</span><span class="src-str">'%'</span><span class="src-sym">,</span><span class="src-str">''</span><span class="src-sym">,</span><span class="src-var">$cl</span><span class="src-sym">) </span>/ <span class="src-num">100</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a3940"></a> <span class="src-key">if </span><span class="src-sym">(</span><a href="http://www.php.net/strpos">strpos</a><span class="src-sym">(</span><span class="src-var">$ct</span><span class="src-sym">, </span><span class="src-str">'px'</span><span class="src-sym">)</span>><span class="src-num">0</span><span class="src-sym">) </span><span class="src-var">$ct </span>= <a href="http://www.php.net/str_replace">str_replace</a><span class="src-sym">(</span><span class="src-str">'px'</span><span class="src-sym">,</span><span class="src-str">''</span><span class="src-sym">,</span><span class="src-var">$ct</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a3941"></a> <span class="src-key">if </span><span class="src-sym">(</span><a href="http://www.php.net/strpos">strpos</a><span class="src-sym">(</span><span class="src-var">$cr</span><span class="src-sym">, </span><span class="src-str">'px'</span><span class="src-sym">)</span>><span class="src-num">0</span><span class="src-sym">) </span><span class="src-var">$cr </span>= <a href="http://www.php.net/str_replace">str_replace</a><span class="src-sym">(</span><span class="src-str">'px'</span><span class="src-sym">,</span><span class="src-str">''</span><span class="src-sym">,</span><span class="src-var">$cr</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a3942"></a> <span class="src-key">if </span><span class="src-sym">(</span><a href="http://www.php.net/strpos">strpos</a><span class="src-sym">(</span><span class="src-var">$cb</span><span class="src-sym">, </span><span class="src-str">'px'</span><span class="src-sym">)</span>><span class="src-num">0</span><span class="src-sym">) </span><span class="src-var">$cb </span>= <a href="http://www.php.net/str_replace">str_replace</a><span class="src-sym">(</span><span class="src-str">'px'</span><span class="src-sym">,</span><span class="src-str">''</span><span class="src-sym">,</span><span class="src-var">$cb</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a3943"></a> <span class="src-key">if </span><span class="src-sym">(</span><a href="http://www.php.net/strpos">strpos</a><span class="src-sym">(</span><span class="src-var">$cl</span><span class="src-sym">, </span><span class="src-str">'px'</span><span class="src-sym">)</span>><span class="src-num">0</span><span class="src-sym">) </span><span class="src-var">$cl </span>= <a href="http://www.php.net/str_replace">str_replace</a><span class="src-sym">(</span><span class="src-str">'px'</span><span class="src-sym">,</span><span class="src-str">''</span><span class="src-sym">,</span><span class="src-var">$cl</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a3944"></a> <span class="src-var">$ct </span>= (int) <span class="src-var">$ct</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a3945"></a> <span class="src-var">$cr </span>= (int) <span class="src-var">$cr</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a3946"></a> <span class="src-var">$cb </span>= (int) <span class="src-var">$cb</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a3947"></a> <span class="src-var">$cl </span>= (int) <span class="src-var">$cl</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a3948"></a> <span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id">image_dst_x </span>= <span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id">image_dst_x </span>+ <span class="src-var">$cl </span>+ <span class="src-var">$cr</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a3949"></a> <span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id">image_dst_y </span>= <span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id">image_dst_y </span>+ <span class="src-var">$ct </span>+ <span class="src-var">$cb</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a3950"></a> <span class="src-key">if </span><span class="src-sym">(</span><span class="src-sym">!</span><span class="src-key">empty</span><span class="src-sym">(</span><span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id"><a href="class.upload.html#var$image_border_color">image_border_color</a></span><span class="src-sym">)) </span>list<span class="src-sym">(</span><span class="src-var">$red</span><span class="src-sym">, </span><span class="src-var">$green</span><span class="src-sym">, </span><span class="src-var">$blue</span><span class="src-sym">) </span>= <span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id">getcolors</span><span class="src-sym">(</span><span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id"><a href="class.upload.html#var$image_border_color">image_border_color</a></span><span class="src-sym">)</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a3951"></a> <span class="src-comm">// we now create an image, that we fill with the border color</span></div></li> <li><div class="src-line"><a name="a3952"></a> <span class="src-var">$tmp </span>= <span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id">imagecreatenew</span><span class="src-sym">(</span><span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id">image_dst_x</span><span class="src-sym">, </span><span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id">image_dst_y</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a3953"></a> <span class="src-var">$background </span>= <a href="http://www.php.net/imagecolorallocatealpha">imagecolorallocatealpha</a><span class="src-sym">(</span><span class="src-var">$tmp</span><span class="src-sym">, </span><span class="src-var">$red</span><span class="src-sym">, </span><span class="src-var">$green</span><span class="src-sym">, </span><span class="src-var">$blue</span><span class="src-sym">, </span><span class="src-num">0</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a3954"></a> <a href="http://www.php.net/imagefilledrectangle">imagefilledrectangle</a><span class="src-sym">(</span><span class="src-var">$tmp</span><span class="src-sym">, </span><span class="src-num">0</span><span class="src-sym">, </span><span class="src-num">0</span><span class="src-sym">, </span><span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id">image_dst_x</span><span class="src-sym">, </span><span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id">image_dst_y</span><span class="src-sym">, </span><span class="src-var">$background</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a3955"></a> <span class="src-comm">// we then copy the source image into the new image, without merging so that only the border is actually kept</span></div></li> <li><div class="src-line"><a name="a3956"></a> <a href="http://www.php.net/imagecopy">imagecopy</a><span class="src-sym">(</span><span class="src-var">$tmp</span><span class="src-sym">, </span><span class="src-var">$image_dst</span><span class="src-sym">, </span><span class="src-var">$cl</span><span class="src-sym">, </span><span class="src-var">$ct</span><span class="src-sym">, </span><span class="src-num">0</span><span class="src-sym">, </span><span class="src-num">0</span><span class="src-sym">, </span><span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id">image_dst_x </span>- <span class="src-var">$cr </span>- <span class="src-var">$cl</span><span class="src-sym">, </span><span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id">image_dst_y </span>- <span class="src-var">$cb </span>- <span class="src-var">$ct</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a3957"></a> <span class="src-comm">// we transfert tmp into image_dst</span></div></li> <li><div class="src-line"><a name="a3958"></a> <span class="src-var">$image_dst </span>= <span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id">imagetransfer</span><span class="src-sym">(</span><span class="src-var">$tmp</span><span class="src-sym">, </span><span class="src-var">$image_dst</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a3959"></a> <span class="src-sym">}</span></div></li> <li><div class="src-line"><a name="a3960"></a> </div></li> <li><div class="src-line"><a name="a3961"></a> <span class="src-comm">// add frame border</span></div></li> <li><div class="src-line"><a name="a3962"></a> <span class="src-key">if </span><span class="src-sym">(</span><a href="http://www.php.net/is_numeric">is_numeric</a><span class="src-sym">(</span><span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id"><a href="class.upload.html#var$image_frame">image_frame</a></span><span class="src-sym">)) </span><span class="src-sym">{</span></div></li> <li><div class="src-line"><a name="a3963"></a> <span class="src-key">if </span><span class="src-sym">(</span><a href="http://www.php.net/is_array">is_array</a><span class="src-sym">(</span><span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id"><a href="class.upload.html#var$image_frame_colors">image_frame_colors</a></span><span class="src-sym">)) </span><span class="src-sym">{</span></div></li> <li><div class="src-line"><a name="a3964"></a> <span class="src-var">$vars </span>= <span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id"><a href="class.upload.html#var$image_frame_colors">image_frame_colors</a></span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a3965"></a> <span class="src-var">$this</span><span class="src-sym">-></span><a href="http://www.php.net/log">log</a> .= <span class="src-str">'- add frame : ' </span>. <a href="http://www.php.net/implode">implode</a><span class="src-sym">(</span><span class="src-str">' '</span><span class="src-sym">, </span><span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id"><a href="class.upload.html#var$image_frame_colors">image_frame_colors</a></span><span class="src-sym">) </span>. <span class="src-str">'<br />'</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a3966"></a> <span class="src-sym">} </span><span class="src-key">else </span><span class="src-sym">{</span></div></li> <li><div class="src-line"><a name="a3967"></a> <span class="src-var">$this</span><span class="src-sym">-></span><a href="http://www.php.net/log">log</a> .= <span class="src-str">'- add frame : ' </span>. <span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id"><a href="class.upload.html#var$image_frame_colors">image_frame_colors</a> </span>. <span class="src-str">'<br />'</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a3968"></a> <span class="src-var">$vars </span>= <a href="http://www.php.net/explode">explode</a><span class="src-sym">(</span><span class="src-str">' '</span><span class="src-sym">, </span><span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id"><a href="class.upload.html#var$image_frame_colors">image_frame_colors</a></span><span class="src-sym">)</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a3969"></a> <span class="src-sym">}</span></div></li> <li><div class="src-line"><a name="a3970"></a> <span class="src-var">$nb </span>= <a href="http://www.php.net/sizeof">sizeof</a><span class="src-sym">(</span><span class="src-var">$vars</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a3971"></a> <span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id">image_dst_x </span>= <span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id">image_dst_x </span>+ <span class="src-sym">(</span><span class="src-var">$nb </span>* <span class="src-num">2</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a3972"></a> <span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id">image_dst_y </span>= <span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id">image_dst_y </span>+ <span class="src-sym">(</span><span class="src-var">$nb </span>* <span class="src-num">2</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a3973"></a> <span class="src-var">$tmp </span>= <span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id">imagecreatenew</span><span class="src-sym">(</span><span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id">image_dst_x</span><span class="src-sym">, </span><span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id">image_dst_y</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a3974"></a> <a href="http://www.php.net/imagecopy">imagecopy</a><span class="src-sym">(</span><span class="src-var">$tmp</span><span class="src-sym">, </span><span class="src-var">$image_dst</span><span class="src-sym">, </span><span class="src-var">$nb</span><span class="src-sym">, </span><span class="src-var">$nb</span><span class="src-sym">, </span><span class="src-num">0</span><span class="src-sym">, </span><span class="src-num">0</span><span class="src-sym">, </span><span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id">image_dst_x </span>- <span class="src-sym">(</span><span class="src-var">$nb </span>* <span class="src-num">2</span><span class="src-sym">)</span><span class="src-sym">, </span><span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id">image_dst_y </span>- <span class="src-sym">(</span><span class="src-var">$nb </span>* <span class="src-num">2</span><span class="src-sym">))</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a3975"></a> <span class="src-key">for </span><span class="src-sym">(</span><span class="src-var">$i</span>=<span class="src-num">0</span><span class="src-sym">; </span><span class="src-var">$i</span><<span class="src-var">$nb</span><span class="src-sym">; </span><span class="src-var">$i</span>++<span class="src-sym">) </span><span class="src-sym">{</span></div></li> <li><div class="src-line"><a name="a3976"></a> list<span class="src-sym">(</span><span class="src-var">$red</span><span class="src-sym">, </span><span class="src-var">$green</span><span class="src-sym">, </span><span class="src-var">$blue</span><span class="src-sym">) </span>= <span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id">getcolors</span><span class="src-sym">(</span><span class="src-var">$vars</span><span class="src-sym">[</span><span class="src-var">$i</span><span class="src-sym">]</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a3977"></a> <span class="src-var">$c </span>= <a href="http://www.php.net/imagecolorallocate">imagecolorallocate</a><span class="src-sym">(</span><span class="src-var">$tmp</span><span class="src-sym">, </span><span class="src-var">$red</span><span class="src-sym">, </span><span class="src-var">$green</span><span class="src-sym">, </span><span class="src-var">$blue</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a3978"></a> <span class="src-key">if </span><span class="src-sym">(</span><span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id"><a href="class.upload.html#var$image_frame">image_frame</a> </span>== <span class="src-num">1</span><span class="src-sym">) </span><span class="src-sym">{</span></div></li> <li><div class="src-line"><a name="a3979"></a> <a href="http://www.php.net/imageline">imageline</a><span class="src-sym">(</span><span class="src-var">$tmp</span><span class="src-sym">, </span><span class="src-var">$i</span><span class="src-sym">, </span><span class="src-var">$i</span><span class="src-sym">, </span><span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id">image_dst_x </span>- <span class="src-var">$i </span>-<span class="src-num">1</span><span class="src-sym">, </span><span class="src-var">$i</span><span class="src-sym">, </span><span class="src-var">$c</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a3980"></a> <a href="http://www.php.net/imageline">imageline</a><span class="src-sym">(</span><span class="src-var">$tmp</span><span class="src-sym">, </span><span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id">image_dst_x </span>- <span class="src-var">$i </span>-<span class="src-num">1</span><span class="src-sym">, </span><span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id">image_dst_y </span>- <span class="src-var">$i </span>-<span class="src-num">1</span><span class="src-sym">, </span><span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id">image_dst_x </span>- <span class="src-var">$i </span>-<span class="src-num">1</span><span class="src-sym">, </span><span class="src-var">$i</span><span class="src-sym">, </span><span class="src-var">$c</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a3981"></a> <a href="http://www.php.net/imageline">imageline</a><span class="src-sym">(</span><span class="src-var">$tmp</span><span class="src-sym">, </span><span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id">image_dst_x </span>- <span class="src-var">$i </span>-<span class="src-num">1</span><span class="src-sym">, </span><span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id">image_dst_y </span>- <span class="src-var">$i </span>-<span class="src-num">1</span><span class="src-sym">, </span><span class="src-var">$i</span><span class="src-sym">, </span><span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id">image_dst_y </span>- <span class="src-var">$i </span>-<span class="src-num">1</span><span class="src-sym">, </span><span class="src-var">$c</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a3982"></a> <a href="http://www.php.net/imageline">imageline</a><span class="src-sym">(</span><span class="src-var">$tmp</span><span class="src-sym">, </span><span class="src-var">$i</span><span class="src-sym">, </span><span class="src-var">$i</span><span class="src-sym">, </span><span class="src-var">$i</span><span class="src-sym">, </span><span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id">image_dst_y </span>- <span class="src-var">$i </span>-<span class="src-num">1</span><span class="src-sym">, </span><span class="src-var">$c</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a3983"></a> <span class="src-sym">} </span><span class="src-key">else </span><span class="src-sym">{</span></div></li> <li><div class="src-line"><a name="a3984"></a> <a href="http://www.php.net/imageline">imageline</a><span class="src-sym">(</span><span class="src-var">$tmp</span><span class="src-sym">, </span><span class="src-var">$i</span><span class="src-sym">, </span><span class="src-var">$i</span><span class="src-sym">, </span><span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id">image_dst_x </span>- <span class="src-var">$i </span>-<span class="src-num">1</span><span class="src-sym">, </span><span class="src-var">$i</span><span class="src-sym">, </span><span class="src-var">$c</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a3985"></a> <a href="http://www.php.net/imageline">imageline</a><span class="src-sym">(</span><span class="src-var">$tmp</span><span class="src-sym">, </span><span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id">image_dst_x </span>- <span class="src-var">$nb </span>+ <span class="src-var">$i</span><span class="src-sym">, </span><span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id">image_dst_y </span>- <span class="src-var">$nb </span>+ <span class="src-var">$i</span><span class="src-sym">, </span><span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id">image_dst_x </span>- <span class="src-var">$nb </span>+ <span class="src-var">$i</span><span class="src-sym">, </span><span class="src-var">$nb </span>- <span class="src-var">$i</span><span class="src-sym">, </span><span class="src-var">$c</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a3986"></a> <a href="http://www.php.net/imageline">imageline</a><span class="src-sym">(</span><span class="src-var">$tmp</span><span class="src-sym">, </span><span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id">image_dst_x </span>- <span class="src-var">$nb </span>+ <span class="src-var">$i</span><span class="src-sym">, </span><span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id">image_dst_y </span>- <span class="src-var">$nb </span>+ <span class="src-var">$i</span><span class="src-sym">, </span><span class="src-var">$nb </span>- <span class="src-var">$i</span><span class="src-sym">, </span><span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id">image_dst_y </span>- <span class="src-var">$nb </span>+ <span class="src-var">$i</span><span class="src-sym">, </span><span class="src-var">$c</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a3987"></a> <a href="http://www.php.net/imageline">imageline</a><span class="src-sym">(</span><span class="src-var">$tmp</span><span class="src-sym">, </span><span class="src-var">$i</span><span class="src-sym">, </span><span class="src-var">$i</span><span class="src-sym">, </span><span class="src-var">$i</span><span class="src-sym">, </span><span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id">image_dst_y </span>- <span class="src-var">$i </span>-<span class="src-num">1</span><span class="src-sym">, </span><span class="src-var">$c</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a3988"></a> <span class="src-sym">}</span></div></li> <li><div class="src-line"><a name="a3989"></a> <span class="src-sym">}</span></div></li> <li><div class="src-line"><a name="a3990"></a> <span class="src-comm">// we transfert tmp into image_dst</span></div></li> <li><div class="src-line"><a name="a3991"></a> <span class="src-var">$image_dst </span>= <span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id">imagetransfer</span><span class="src-sym">(</span><span class="src-var">$tmp</span><span class="src-sym">, </span><span class="src-var">$image_dst</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a3992"></a> <span class="src-sym">}</span></div></li> <li><div class="src-line"><a name="a3993"></a> </div></li> <li><div class="src-line"><a name="a3994"></a> <span class="src-comm">// add bevel border</span></div></li> <li><div class="src-line"><a name="a3995"></a> <span class="src-key">if </span><span class="src-sym">(</span><span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id"><a href="class.upload.html#var$image_bevel">image_bevel</a> </span>> <span class="src-num">0</span><span class="src-sym">) </span><span class="src-sym">{</span></div></li> <li><div class="src-line"><a name="a3996"></a> <span class="src-key">if </span><span class="src-sym">(</span><span class="src-key">empty</span><span class="src-sym">(</span><span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id"><a href="class.upload.html#var$image_bevel_color1">image_bevel_color1</a></span><span class="src-sym">)) </span><span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id"><a href="class.upload.html#var$image_bevel_color1">image_bevel_color1</a> </span>= <span class="src-str">'#FFFFFF'</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a3997"></a> <span class="src-key">if </span><span class="src-sym">(</span><span class="src-key">empty</span><span class="src-sym">(</span><span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id"><a href="class.upload.html#var$image_bevel_color2">image_bevel_color2</a></span><span class="src-sym">)) </span><span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id"><a href="class.upload.html#var$image_bevel_color2">image_bevel_color2</a> </span>= <span class="src-str">'#000000'</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a3998"></a> list<span class="src-sym">(</span><span class="src-var">$red1</span><span class="src-sym">, </span><span class="src-var">$green1</span><span class="src-sym">, </span><span class="src-var">$blue1</span><span class="src-sym">) </span>= <span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id">getcolors</span><span class="src-sym">(</span><span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id"><a href="class.upload.html#var$image_bevel_color1">image_bevel_color1</a></span><span class="src-sym">)</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a3999"></a> list<span class="src-sym">(</span><span class="src-var">$red2</span><span class="src-sym">, </span><span class="src-var">$green2</span><span class="src-sym">, </span><span class="src-var">$blue2</span><span class="src-sym">) </span>= <span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id">getcolors</span><span class="src-sym">(</span><span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id"><a href="class.upload.html#var$image_bevel_color2">image_bevel_color2</a></span><span class="src-sym">)</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a4000"></a> <span class="src-var">$tmp </span>= <span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id">imagecreatenew</span><span class="src-sym">(</span><span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id">image_dst_x</span><span class="src-sym">, </span><span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id">image_dst_y</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a4001"></a> <a href="http://www.php.net/imagecopy">imagecopy</a><span class="src-sym">(</span><span class="src-var">$tmp</span><span class="src-sym">, </span><span class="src-var">$image_dst</span><span class="src-sym">, </span><span class="src-num">0</span><span class="src-sym">, </span><span class="src-num">0</span><span class="src-sym">, </span><span class="src-num">0</span><span class="src-sym">, </span><span class="src-num">0</span><span class="src-sym">, </span><span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id">image_dst_x</span><span class="src-sym">, </span><span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id">image_dst_y</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a4002"></a> <a href="http://www.php.net/imagealphablending">imagealphablending</a><span class="src-sym">(</span><span class="src-var">$tmp</span><span class="src-sym">, </span><span class="src-id">true</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a4003"></a> <span class="src-key">for </span><span class="src-sym">(</span><span class="src-var">$i</span>=<span class="src-num">0</span><span class="src-sym">; </span><span class="src-var">$i</span><<span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id"><a href="class.upload.html#var$image_bevel">image_bevel</a></span><span class="src-sym">; </span><span class="src-var">$i</span>++<span class="src-sym">) </span><span class="src-sym">{</span></div></li> <li><div class="src-line"><a name="a4004"></a> <span class="src-var">$alpha </span>= <a href="http://www.php.net/round">round</a><span class="src-sym">((</span><span class="src-var">$i </span>/ <span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id"><a href="class.upload.html#var$image_bevel">image_bevel</a></span><span class="src-sym">) </span>* <span class="src-num">127</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a4005"></a> <span class="src-var">$c1 </span>= <a href="http://www.php.net/imagecolorallocatealpha">imagecolorallocatealpha</a><span class="src-sym">(</span><span class="src-var">$tmp</span><span class="src-sym">, </span><span class="src-var">$red1</span><span class="src-sym">, </span><span class="src-var">$green1</span><span class="src-sym">, </span><span class="src-var">$blue1</span><span class="src-sym">, </span><span class="src-var">$alpha</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a4006"></a> <span class="src-var">$c2 </span>= <a href="http://www.php.net/imagecolorallocatealpha">imagecolorallocatealpha</a><span class="src-sym">(</span><span class="src-var">$tmp</span><span class="src-sym">, </span><span class="src-var">$red2</span><span class="src-sym">, </span><span class="src-var">$green2</span><span class="src-sym">, </span><span class="src-var">$blue2</span><span class="src-sym">, </span><span class="src-var">$alpha</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a4007"></a> <a href="http://www.php.net/imageline">imageline</a><span class="src-sym">(</span><span class="src-var">$tmp</span><span class="src-sym">, </span><span class="src-var">$i</span><span class="src-sym">, </span><span class="src-var">$i</span><span class="src-sym">, </span><span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id">image_dst_x </span>- <span class="src-var">$i </span>-<span class="src-num">1</span><span class="src-sym">, </span><span class="src-var">$i</span><span class="src-sym">, </span><span class="src-var">$c1</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a4008"></a> <a href="http://www.php.net/imageline">imageline</a><span class="src-sym">(</span><span class="src-var">$tmp</span><span class="src-sym">, </span><span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id">image_dst_x </span>- <span class="src-var">$i </span>-<span class="src-num">1</span><span class="src-sym">, </span><span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id">image_dst_y </span>- <span class="src-var">$i</span><span class="src-sym">, </span><span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id">image_dst_x </span>- <span class="src-var">$i </span>-<span class="src-num">1</span><span class="src-sym">, </span><span class="src-var">$i</span><span class="src-sym">, </span><span class="src-var">$c2</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a4009"></a> <a href="http://www.php.net/imageline">imageline</a><span class="src-sym">(</span><span class="src-var">$tmp</span><span class="src-sym">, </span><span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id">image_dst_x </span>- <span class="src-var">$i </span>-<span class="src-num">1</span><span class="src-sym">, </span><span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id">image_dst_y </span>- <span class="src-var">$i </span>-<span class="src-num">1</span><span class="src-sym">, </span><span class="src-var">$i</span><span class="src-sym">, </span><span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id">image_dst_y </span>- <span class="src-var">$i </span>-<span class="src-num">1</span><span class="src-sym">, </span><span class="src-var">$c2</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a4010"></a> <a href="http://www.php.net/imageline">imageline</a><span class="src-sym">(</span><span class="src-var">$tmp</span><span class="src-sym">, </span><span class="src-var">$i</span><span class="src-sym">, </span><span class="src-var">$i</span><span class="src-sym">, </span><span class="src-var">$i</span><span class="src-sym">, </span><span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id">image_dst_y </span>- <span class="src-var">$i </span>-<span class="src-num">1</span><span class="src-sym">, </span><span class="src-var">$c1</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a4011"></a> <span class="src-sym">}</span></div></li> <li><div class="src-line"><a name="a4012"></a> <span class="src-comm">// we transfert tmp into image_dst</span></div></li> <li><div class="src-line"><a name="a4013"></a> <span class="src-var">$image_dst </span>= <span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id">imagetransfer</span><span class="src-sym">(</span><span class="src-var">$tmp</span><span class="src-sym">, </span><span class="src-var">$image_dst</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a4014"></a> <span class="src-sym">}</span></div></li> <li><div class="src-line"><a name="a4015"></a> </div></li> <li><div class="src-line"><a name="a4016"></a> <span class="src-comm">// add watermark image</span></div></li> <li><div class="src-line"><a name="a4017"></a> <span class="src-key">if </span><span class="src-sym">(</span><span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id"><a href="class.upload.html#var$image_watermark">image_watermark</a></span>!=<span class="src-str">'' </span>&& <a href="http://www.php.net/file_exists">file_exists</a><span class="src-sym">(</span><span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id"><a href="class.upload.html#var$image_watermark">image_watermark</a></span><span class="src-sym">)) </span><span class="src-sym">{</span></div></li> <li><div class="src-line"><a name="a4018"></a> <span class="src-var">$this</span><span class="src-sym">-></span><a href="http://www.php.net/log">log</a> .= <span class="src-str">'- add watermark<br />'</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a4019"></a> <span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id"><a href="class.upload.html#var$image_watermark_position">image_watermark_position</a> </span>= <a href="http://www.php.net/strtolower">strtolower</a><span class="src-sym">(</span><span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id"><a href="class.upload.html#var$image_watermark_position">image_watermark_position</a></span><span class="src-sym">)</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a4020"></a> <span class="src-var">$watermark_info </span>= <a href="http://www.php.net/getimagesize">getimagesize</a><span class="src-sym">(</span><span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id"><a href="class.upload.html#var$image_watermark">image_watermark</a></span><span class="src-sym">)</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a4021"></a> <span class="src-var">$watermark_type </span>= <span class="src-sym">(</span><a href="http://www.php.net/array_key_exists">array_key_exists</a><span class="src-sym">(</span><span class="src-num">2</span><span class="src-sym">, </span><span class="src-var">$watermark_info</span><span class="src-sym">) </span>? <span class="src-var">$watermark_info</span><span class="src-sym">[</span><span class="src-num">2</span><span class="src-sym">] </span>: <span class="src-id">null</span><span class="src-sym">)</span><span class="src-sym">; </span><span class="src-comm">// 1 = GIF, 2 = JPG, 3 = PNG</span></div></li> <li><div class="src-line"><a name="a4022"></a> <span class="src-var">$watermark_checked </span>= <span class="src-id">false</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a4023"></a> <span class="src-key">if </span><span class="src-sym">(</span><span class="src-var">$watermark_type </span>== <span class="src-id">IMAGETYPE_GIF</span><span class="src-sym">) </span><span class="src-sym">{</span></div></li> <li><div class="src-line"><a name="a4024"></a> <span class="src-key">if </span><span class="src-sym">(</span><span class="src-sym">!</span><a href="http://www.php.net/function_exists">function_exists</a><span class="src-sym">(</span><span class="src-str">'imagecreatefromgif'</span><span class="src-sym">)) </span><span class="src-sym">{</span></div></li> <li><div class="src-line"><a name="a4025"></a> <span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id"><a href="class.upload.html#var$error">error</a> </span>= <span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id">translate</span><span class="src-sym">(</span><span class="src-str">'watermark_no_create_support'</span><span class="src-sym">, </span><span class="src-key">array</span><span class="src-sym">(</span><span class="src-str">'GIF'</span><span class="src-sym">))</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a4026"></a> <span class="src-sym">} </span><span class="src-key">else </span><span class="src-sym">{</span></div></li> <li><div class="src-line"><a name="a4027"></a> <span class="src-var">$filter </span>= <span class="src-sym">@</span><a href="http://www.php.net/imagecreatefromgif">imagecreatefromgif</a><span class="src-sym">(</span><span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id"><a href="class.upload.html#var$image_watermark">image_watermark</a></span><span class="src-sym">)</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a4028"></a> <span class="src-key">if </span><span class="src-sym">(</span><span class="src-sym">!</span><span class="src-var">$filter</span><span class="src-sym">) </span><span class="src-sym">{</span></div></li> <li><div class="src-line"><a name="a4029"></a> <span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id"><a href="class.upload.html#var$error">error</a> </span>= <span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id">translate</span><span class="src-sym">(</span><span class="src-str">'watermark_create_error'</span><span class="src-sym">, </span><span class="src-key">array</span><span class="src-sym">(</span><span class="src-str">'GIF'</span><span class="src-sym">))</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a4030"></a> <span class="src-sym">} </span><span class="src-key">else </span><span class="src-sym">{</span></div></li> <li><div class="src-line"><a name="a4031"></a> <span class="src-var">$this</span><span class="src-sym">-></span><a href="http://www.php.net/log">log</a> .= <span class="src-str">'&nbsp;&nbsp;&nbsp;&nbsp;watermark source image is GIF<br />'</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a4032"></a> <span class="src-var">$watermark_checked </span>= <span class="src-id">true</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a4033"></a> <span class="src-sym">}</span></div></li> <li><div class="src-line"><a name="a4034"></a> <span class="src-sym">}</span></div></li> <li><div class="src-line"><a name="a4035"></a> <span class="src-sym">} </span><span class="src-key">else </span><span class="src-key">if </span><span class="src-sym">(</span><span class="src-var">$watermark_type </span>== <span class="src-id">IMAGETYPE_JPEG</span><span class="src-sym">) </span><span class="src-sym">{</span></div></li> <li><div class="src-line"><a name="a4036"></a> <span class="src-key">if </span><span class="src-sym">(</span><span class="src-sym">!</span><a href="http://www.php.net/function_exists">function_exists</a><span class="src-sym">(</span><span class="src-str">'imagecreatefromjpeg'</span><span class="src-sym">)) </span><span class="src-sym">{</span></div></li> <li><div class="src-line"><a name="a4037"></a> <span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id"><a href="class.upload.html#var$error">error</a> </span>= <span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id">translate</span><span class="src-sym">(</span><span class="src-str">'watermark_no_create_support'</span><span class="src-sym">, </span><span class="src-key">array</span><span class="src-sym">(</span><span class="src-str">'JPEG'</span><span class="src-sym">))</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a4038"></a> <span class="src-sym">} </span><span class="src-key">else </span><span class="src-sym">{</span></div></li> <li><div class="src-line"><a name="a4039"></a> <span class="src-var">$filter </span>= <span class="src-sym">@</span><a href="http://www.php.net/imagecreatefromjpeg">imagecreatefromjpeg</a><span class="src-sym">(</span><span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id"><a href="class.upload.html#var$image_watermark">image_watermark</a></span><span class="src-sym">)</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a4040"></a> <span class="src-key">if </span><span class="src-sym">(</span><span class="src-sym">!</span><span class="src-var">$filter</span><span class="src-sym">) </span><span class="src-sym">{</span></div></li> <li><div class="src-line"><a name="a4041"></a> <span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id"><a href="class.upload.html#var$error">error</a> </span>= <span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id">translate</span><span class="src-sym">(</span><span class="src-str">'watermark_create_error'</span><span class="src-sym">, </span><span class="src-key">array</span><span class="src-sym">(</span><span class="src-str">'JPEG'</span><span class="src-sym">))</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a4042"></a> <span class="src-sym">} </span><span class="src-key">else </span><span class="src-sym">{</span></div></li> <li><div class="src-line"><a name="a4043"></a> <span class="src-var">$this</span><span class="src-sym">-></span><a href="http://www.php.net/log">log</a> .= <span class="src-str">'&nbsp;&nbsp;&nbsp;&nbsp;watermark source image is JPEG<br />'</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a4044"></a> <span class="src-var">$watermark_checked </span>= <span class="src-id">true</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a4045"></a> <span class="src-sym">}</span></div></li> <li><div class="src-line"><a name="a4046"></a> <span class="src-sym">}</span></div></li> <li><div class="src-line"><a name="a4047"></a> <span class="src-sym">} </span><span class="src-key">else </span><span class="src-key">if </span><span class="src-sym">(</span><span class="src-var">$watermark_type </span>== <span class="src-id">IMAGETYPE_PNG</span><span class="src-sym">) </span><span class="src-sym">{</span></div></li> <li><div class="src-line"><a name="a4048"></a> <span class="src-key">if </span><span class="src-sym">(</span><span class="src-sym">!</span><a href="http://www.php.net/function_exists">function_exists</a><span class="src-sym">(</span><span class="src-str">'imagecreatefrompng'</span><span class="src-sym">)) </span><span class="src-sym">{</span></div></li> <li><div class="src-line"><a name="a4049"></a> <span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id"><a href="class.upload.html#var$error">error</a> </span>= <span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id">translate</span><span class="src-sym">(</span><span class="src-str">'watermark_no_create_support'</span><span class="src-sym">, </span><span class="src-key">array</span><span class="src-sym">(</span><span class="src-str">'PNG'</span><span class="src-sym">))</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a4050"></a> <span class="src-sym">} </span><span class="src-key">else </span><span class="src-sym">{</span></div></li> <li><div class="src-line"><a name="a4051"></a> <span class="src-var">$filter </span>= <span class="src-sym">@</span><a href="http://www.php.net/imagecreatefrompng">imagecreatefrompng</a><span class="src-sym">(</span><span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id"><a href="class.upload.html#var$image_watermark">image_watermark</a></span><span class="src-sym">)</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a4052"></a> <span class="src-key">if </span><span class="src-sym">(</span><span class="src-sym">!</span><span class="src-var">$filter</span><span class="src-sym">) </span><span class="src-sym">{</span></div></li> <li><div class="src-line"><a name="a4053"></a> <span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id"><a href="class.upload.html#var$error">error</a> </span>= <span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id">translate</span><span class="src-sym">(</span><span class="src-str">'watermark_create_error'</span><span class="src-sym">, </span><span class="src-key">array</span><span class="src-sym">(</span><span class="src-str">'PNG'</span><span class="src-sym">))</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a4054"></a> <span class="src-sym">} </span><span class="src-key">else </span><span class="src-sym">{</span></div></li> <li><div class="src-line"><a name="a4055"></a> <span class="src-var">$this</span><span class="src-sym">-></span><a href="http://www.php.net/log">log</a> .= <span class="src-str">'&nbsp;&nbsp;&nbsp;&nbsp;watermark source image is PNG<br />'</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a4056"></a> <span class="src-var">$watermark_checked </span>= <span class="src-id">true</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a4057"></a> <span class="src-sym">}</span></div></li> <li><div class="src-line"><a name="a4058"></a> <span class="src-sym">}</span></div></li> <li><div class="src-line"><a name="a4059"></a> <span class="src-sym">} </span><span class="src-key">else </span><span class="src-key">if </span><span class="src-sym">(</span><span class="src-var">$watermark_type </span>== <span class="src-id">IMAGETYPE_BMP</span><span class="src-sym">) </span><span class="src-sym">{</span></div></li> <li><div class="src-line"><a name="a4060"></a> <span class="src-key">if </span><span class="src-sym">(</span><span class="src-sym">!</span><a href="http://www.php.net/method_exists">method_exists</a><span class="src-sym">(</span><span class="src-var">$this</span><span class="src-sym">, </span><span class="src-str">'imagecreatefrombmp'</span><span class="src-sym">)) </span><span class="src-sym">{</span></div></li> <li><div class="src-line"><a name="a4061"></a> <span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id"><a href="class.upload.html#var$error">error</a> </span>= <span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id">translate</span><span class="src-sym">(</span><span class="src-str">'watermark_no_create_support'</span><span class="src-sym">, </span><span class="src-key">array</span><span class="src-sym">(</span><span class="src-str">'BMP'</span><span class="src-sym">))</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a4062"></a> <span class="src-sym">} </span><span class="src-key">else </span><span class="src-sym">{</span></div></li> <li><div class="src-line"><a name="a4063"></a> <span class="src-var">$filter </span>= <span class="src-sym">@</span><span class="src-var">$this</span><span class="src-sym">-></span><a href="class.upload.html#methodimagecreatefrombmp">imagecreatefrombmp</a><span class="src-sym">(</span><span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id"><a href="class.upload.html#var$image_watermark">image_watermark</a></span><span class="src-sym">)</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a4064"></a> <span class="src-key">if </span><span class="src-sym">(</span><span class="src-sym">!</span><span class="src-var">$filter</span><span class="src-sym">) </span><span class="src-sym">{</span></div></li> <li><div class="src-line"><a name="a4065"></a> <span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id"><a href="class.upload.html#var$error">error</a> </span>= <span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id">translate</span><span class="src-sym">(</span><span class="src-str">'watermark_create_error'</span><span class="src-sym">, </span><span class="src-key">array</span><span class="src-sym">(</span><span class="src-str">'BMP'</span><span class="src-sym">))</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a4066"></a> <span class="src-sym">} </span><span class="src-key">else </span><span class="src-sym">{</span></div></li> <li><div class="src-line"><a name="a4067"></a> <span class="src-var">$this</span><span class="src-sym">-></span><a href="http://www.php.net/log">log</a> .= <span class="src-str">'&nbsp;&nbsp;&nbsp;&nbsp;watermark source image is BMP<br />'</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a4068"></a> <span class="src-var">$watermark_checked </span>= <span class="src-id">true</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a4069"></a> <span class="src-sym">}</span></div></li> <li><div class="src-line"><a name="a4070"></a> <span class="src-sym">}</span></div></li> <li><div class="src-line"><a name="a4071"></a> <span class="src-sym">} </span><span class="src-key">else </span><span class="src-sym">{</span></div></li> <li><div class="src-line"><a name="a4072"></a> <span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id"><a href="class.upload.html#var$error">error</a> </span>= <span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id">translate</span><span class="src-sym">(</span><span class="src-str">'watermark_invalid'</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a4073"></a> <span class="src-sym">}</span></div></li> <li><div class="src-line"><a name="a4074"></a> <span class="src-key">if </span><span class="src-sym">(</span><span class="src-var">$watermark_checked</span><span class="src-sym">) </span><span class="src-sym">{</span></div></li> <li><div class="src-line"><a name="a4075"></a> <span class="src-var">$watermark_width </span>= <a href="http://www.php.net/imagesx">imagesx</a><span class="src-sym">(</span><span class="src-var">$filter</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a4076"></a> <span class="src-var">$watermark_height </span>= <a href="http://www.php.net/imagesy">imagesy</a><span class="src-sym">(</span><span class="src-var">$filter</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a4077"></a> <span class="src-var">$watermark_x </span>= <span class="src-num">0</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a4078"></a> <span class="src-var">$watermark_y </span>= <span class="src-num">0</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a4079"></a> <span class="src-key">if </span><span class="src-sym">(</span><a href="http://www.php.net/is_numeric">is_numeric</a><span class="src-sym">(</span><span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id"><a href="class.upload.html#var$image_watermark_x">image_watermark_x</a></span><span class="src-sym">)) </span><span class="src-sym">{</span></div></li> <li><div class="src-line"><a name="a4080"></a> <span class="src-key">if </span><span class="src-sym">(</span><span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id"><a href="class.upload.html#var$image_watermark_x">image_watermark_x</a> </span>< <span class="src-num">0</span><span class="src-sym">) </span><span class="src-sym">{</span></div></li> <li><div class="src-line"><a name="a4081"></a> <span class="src-var">$watermark_x </span>= <span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id">image_dst_x </span>- <span class="src-var">$watermark_width </span>+ <span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id"><a href="class.upload.html#var$image_watermark_x">image_watermark_x</a></span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a4082"></a> <span class="src-sym">} </span><span class="src-key">else </span><span class="src-sym">{</span></div></li> <li><div class="src-line"><a name="a4083"></a> <span class="src-var">$watermark_x </span>= <span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id"><a href="class.upload.html#var$image_watermark_x">image_watermark_x</a></span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a4084"></a> <span class="src-sym">}</span></div></li> <li><div class="src-line"><a name="a4085"></a> <span class="src-sym">} </span><span class="src-key">else </span><span class="src-sym">{</span></div></li> <li><div class="src-line"><a name="a4086"></a> <span class="src-key">if </span><span class="src-sym">(</span><a href="http://www.php.net/strpos">strpos</a><span class="src-sym">(</span><span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id"><a href="class.upload.html#var$image_watermark_position">image_watermark_position</a></span><span class="src-sym">, </span><span class="src-str">'r'</span><span class="src-sym">) </span>!== <span class="src-id">false</span><span class="src-sym">) </span><span class="src-sym">{</span></div></li> <li><div class="src-line"><a name="a4087"></a> <span class="src-var">$watermark_x </span>= <span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id">image_dst_x </span>- <span class="src-var">$watermark_width</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a4088"></a> <span class="src-sym">} </span><span class="src-key">else </span><span class="src-key">if </span><span class="src-sym">(</span><a href="http://www.php.net/strpos">strpos</a><span class="src-sym">(</span><span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id"><a href="class.upload.html#var$image_watermark_position">image_watermark_position</a></span><span class="src-sym">, </span><span class="src-str">'l'</span><span class="src-sym">) </span>!== <span class="src-id">false</span><span class="src-sym">) </span><span class="src-sym">{</span></div></li> <li><div class="src-line"><a name="a4089"></a> <span class="src-var">$watermark_x </span>= <span class="src-num">0</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a4090"></a> <span class="src-sym">} </span><span class="src-key">else </span><span class="src-sym">{</span></div></li> <li><div class="src-line"><a name="a4091"></a> <span class="src-var">$watermark_x </span>= <span class="src-sym">(</span><span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id">image_dst_x </span>- <span class="src-var">$watermark_width</span><span class="src-sym">) </span>/ <span class="src-num">2</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a4092"></a> <span class="src-sym">}</span></div></li> <li><div class="src-line"><a name="a4093"></a> <span class="src-sym">}</span></div></li> <li><div class="src-line"><a name="a4094"></a> <span class="src-key">if </span><span class="src-sym">(</span><a href="http://www.php.net/is_numeric">is_numeric</a><span class="src-sym">(</span><span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id"><a href="class.upload.html#var$image_watermark_y">image_watermark_y</a></span><span class="src-sym">)) </span><span class="src-sym">{</span></div></li> <li><div class="src-line"><a name="a4095"></a> <span class="src-key">if </span><span class="src-sym">(</span><span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id"><a href="class.upload.html#var$image_watermark_y">image_watermark_y</a> </span>< <span class="src-num">0</span><span class="src-sym">) </span><span class="src-sym">{</span></div></li> <li><div class="src-line"><a name="a4096"></a> <span class="src-var">$watermark_y </span>= <span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id">image_dst_y </span>- <span class="src-var">$watermark_height </span>+ <span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id"><a href="class.upload.html#var$image_watermark_y">image_watermark_y</a></span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a4097"></a> <span class="src-sym">} </span><span class="src-key">else </span><span class="src-sym">{</span></div></li> <li><div class="src-line"><a name="a4098"></a> <span class="src-var">$watermark_y </span>= <span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id"><a href="class.upload.html#var$image_watermark_y">image_watermark_y</a></span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a4099"></a> <span class="src-sym">}</span></div></li> <li><div class="src-line"><a name="a4100"></a> <span class="src-sym">} </span><span class="src-key">else </span><span class="src-sym">{</span></div></li> <li><div class="src-line"><a name="a4101"></a> <span class="src-key">if </span><span class="src-sym">(</span><a href="http://www.php.net/strpos">strpos</a><span class="src-sym">(</span><span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id"><a href="class.upload.html#var$image_watermark_position">image_watermark_position</a></span><span class="src-sym">, </span><span class="src-str">'b'</span><span class="src-sym">) </span>!== <span class="src-id">false</span><span class="src-sym">) </span><span class="src-sym">{</span></div></li> <li><div class="src-line"><a name="a4102"></a> <span class="src-var">$watermark_y </span>= <span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id">image_dst_y </span>- <span class="src-var">$watermark_height</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a4103"></a> <span class="src-sym">} </span><span class="src-key">else </span><span class="src-key">if </span><span class="src-sym">(</span><a href="http://www.php.net/strpos">strpos</a><span class="src-sym">(</span><span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id"><a href="class.upload.html#var$image_watermark_position">image_watermark_position</a></span><span class="src-sym">, </span><span class="src-str">'t'</span><span class="src-sym">) </span>!== <span class="src-id">false</span><span class="src-sym">) </span><span class="src-sym">{</span></div></li> <li><div class="src-line"><a name="a4104"></a> <span class="src-var">$watermark_y </span>= <span class="src-num">0</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a4105"></a> <span class="src-sym">} </span><span class="src-key">else </span><span class="src-sym">{</span></div></li> <li><div class="src-line"><a name="a4106"></a> <span class="src-var">$watermark_y </span>= <span class="src-sym">(</span><span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id">image_dst_y </span>- <span class="src-var">$watermark_height</span><span class="src-sym">) </span>/ <span class="src-num">2</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a4107"></a> <span class="src-sym">}</span></div></li> <li><div class="src-line"><a name="a4108"></a> <span class="src-sym">}</span></div></li> <li><div class="src-line"><a name="a4109"></a> <a href="http://www.php.net/imagecopyresampled">imagecopyresampled</a> <span class="src-sym">(</span><span class="src-var">$image_dst</span><span class="src-sym">, </span><span class="src-var">$filter</span><span class="src-sym">, </span><span class="src-var">$watermark_x</span><span class="src-sym">, </span><span class="src-var">$watermark_y</span><span class="src-sym">, </span><span class="src-num">0</span><span class="src-sym">, </span><span class="src-num">0</span><span class="src-sym">, </span><span class="src-var">$watermark_width</span><span class="src-sym">, </span><span class="src-var">$watermark_height</span><span class="src-sym">, </span><span class="src-var">$watermark_width</span><span class="src-sym">, </span><span class="src-var">$watermark_height</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a4110"></a> <span class="src-sym">} </span><span class="src-key">else </span><span class="src-sym">{</span></div></li> <li><div class="src-line"><a name="a4111"></a> <span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id"><a href="class.upload.html#var$error">error</a> </span>= <span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id">translate</span><span class="src-sym">(</span><span class="src-str">'watermark_invalid'</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a4112"></a> <span class="src-sym">}</span></div></li> <li><div class="src-line"><a name="a4113"></a> <span class="src-sym">}</span></div></li> <li><div class="src-line"><a name="a4114"></a> </div></li> <li><div class="src-line"><a name="a4115"></a> <span class="src-comm">// add text</span></div></li> <li><div class="src-line"><a name="a4116"></a> <span class="src-key">if </span><span class="src-sym">(</span><span class="src-sym">!</span><span class="src-key">empty</span><span class="src-sym">(</span><span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id"><a href="class.upload.html#var$image_text">image_text</a></span><span class="src-sym">)) </span><span class="src-sym">{</span></div></li> <li><div class="src-line"><a name="a4117"></a> <span class="src-var">$this</span><span class="src-sym">-></span><a href="http://www.php.net/log">log</a> .= <span class="src-str">'- add text<br />'</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a4118"></a> </div></li> <li><div class="src-line"><a name="a4119"></a> <span class="src-comm">// calculate sizes in human readable format</span></div></li> <li><div class="src-line"><a name="a4120"></a> <span class="src-var">$src_size </span>= <span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id"><a href="class.upload.html#var$file_src_size">file_src_size</a> </span>/ <span class="src-num">1024</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a4121"></a> <span class="src-var">$src_size_mb </span>= <a href="http://www.php.net/number_format">number_format</a><span class="src-sym">(</span><span class="src-var">$src_size </span>/ <span class="src-num">1024</span><span class="src-sym">, </span><span class="src-num">1</span><span class="src-sym">, </span><span class="src-str">"."</span><span class="src-sym">, </span><span class="src-str">" "</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a4122"></a> <span class="src-var">$src_size_kb </span>= <a href="http://www.php.net/number_format">number_format</a><span class="src-sym">(</span><span class="src-var">$src_size</span><span class="src-sym">, </span><span class="src-num">1</span><span class="src-sym">, </span><span class="src-str">"."</span><span class="src-sym">, </span><span class="src-str">" "</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a4123"></a> <span class="src-var">$src_size_human </span>= <span class="src-sym">(</span><span class="src-var">$src_size </span>> <span class="src-num">1024 </span>? <span class="src-var">$src_size_mb </span>. <span class="src-str">" MB" </span>: <span class="src-var">$src_size_kb </span>. <span class="src-str">" kb"</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a4124"></a> </div></li> <li><div class="src-line"><a name="a4125"></a> <span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id"><a href="class.upload.html#var$image_text">image_text</a> </span>= <a href="http://www.php.net/str_replace">str_replace</a><span class="src-sym">(</span></div></li> <li><div class="src-line"><a name="a4126"></a> <span class="src-key">array</span><span class="src-sym">(</span><span class="src-str">'[src_name]'</span><span class="src-sym">,</span></div></li> <li><div class="src-line"><a name="a4127"></a> <span class="src-str">'[src_name_body]'</span><span class="src-sym">,</span></div></li> <li><div class="src-line"><a name="a4128"></a> <span class="src-str">'[src_name_ext]'</span><span class="src-sym">,</span></div></li> <li><div class="src-line"><a name="a4129"></a> <span class="src-str">'[src_pathname]'</span><span class="src-sym">,</span></div></li> <li><div class="src-line"><a name="a4130"></a> <span class="src-str">'[src_mime]'</span><span class="src-sym">,</span></div></li> <li><div class="src-line"><a name="a4131"></a> <span class="src-str">'[src_size]'</span><span class="src-sym">,</span></div></li> <li><div class="src-line"><a name="a4132"></a> <span class="src-str">'[src_size_kb]'</span><span class="src-sym">,</span></div></li> <li><div class="src-line"><a name="a4133"></a> <span class="src-str">'[src_size_mb]'</span><span class="src-sym">,</span></div></li> <li><div class="src-line"><a name="a4134"></a> <span class="src-str">'[src_size_human]'</span><span class="src-sym">,</span></div></li> <li><div class="src-line"><a name="a4135"></a> <span class="src-str">'[src_x]'</span><span class="src-sym">,</span></div></li> <li><div class="src-line"><a name="a4136"></a> <span class="src-str">'[src_y]'</span><span class="src-sym">,</span></div></li> <li><div class="src-line"><a name="a4137"></a> <span class="src-str">'[src_pixels]'</span><span class="src-sym">,</span></div></li> <li><div class="src-line"><a name="a4138"></a> <span class="src-str">'[src_type]'</span><span class="src-sym">,</span></div></li> <li><div class="src-line"><a name="a4139"></a> <span class="src-str">'[src_bits]'</span><span class="src-sym">,</span></div></li> <li><div class="src-line"><a name="a4140"></a> <span class="src-str">'[dst_path]'</span><span class="src-sym">,</span></div></li> <li><div class="src-line"><a name="a4141"></a> <span class="src-str">'[dst_name_body]'</span><span class="src-sym">,</span></div></li> <li><div class="src-line"><a name="a4142"></a> <span class="src-str">'[dst_name_ext]'</span><span class="src-sym">,</span></div></li> <li><div class="src-line"><a name="a4143"></a> <span class="src-str">'[dst_name]'</span><span class="src-sym">,</span></div></li> <li><div class="src-line"><a name="a4144"></a> <span class="src-str">'[dst_pathname]'</span><span class="src-sym">,</span></div></li> <li><div class="src-line"><a name="a4145"></a> <span class="src-str">'[dst_x]'</span><span class="src-sym">,</span></div></li> <li><div class="src-line"><a name="a4146"></a> <span class="src-str">'[dst_y]'</span><span class="src-sym">,</span></div></li> <li><div class="src-line"><a name="a4147"></a> <span class="src-str">'[date]'</span><span class="src-sym">,</span></div></li> <li><div class="src-line"><a name="a4148"></a> <span class="src-str">'[time]'</span><span class="src-sym">,</span></div></li> <li><div class="src-line"><a name="a4149"></a> <span class="src-str">'[host]'</span><span class="src-sym">,</span></div></li> <li><div class="src-line"><a name="a4150"></a> <span class="src-str">'[server]'</span><span class="src-sym">,</span></div></li> <li><div class="src-line"><a name="a4151"></a> <span class="src-str">'[ip]'</span><span class="src-sym">,</span></div></li> <li><div class="src-line"><a name="a4152"></a> <span class="src-str">'[gd_version]'</span><span class="src-sym">)</span><span class="src-sym">,</span></div></li> <li><div class="src-line"><a name="a4153"></a> <span class="src-key">array</span><span class="src-sym">(</span><span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id"><a href="class.upload.html#var$file_src_name">file_src_name</a></span><span class="src-sym">,</span></div></li> <li><div class="src-line"><a name="a4154"></a> <span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id"><a href="class.upload.html#var$file_src_name_body">file_src_name_body</a></span><span class="src-sym">,</span></div></li> <li><div class="src-line"><a name="a4155"></a> <span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id"><a href="class.upload.html#var$file_src_name_ext">file_src_name_ext</a></span><span class="src-sym">,</span></div></li> <li><div class="src-line"><a name="a4156"></a> <span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id">file_src_pathname</span><span class="src-sym">,</span></div></li> <li><div class="src-line"><a name="a4157"></a> <span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id"><a href="class.upload.html#var$file_src_mime">file_src_mime</a></span><span class="src-sym">,</span></div></li> <li><div class="src-line"><a name="a4158"></a> <span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id"><a href="class.upload.html#var$file_src_size">file_src_size</a></span><span class="src-sym">,</span></div></li> <li><div class="src-line"><a name="a4159"></a> <span class="src-var">$src_size_kb</span><span class="src-sym">,</span></div></li> <li><div class="src-line"><a name="a4160"></a> <span class="src-var">$src_size_mb</span><span class="src-sym">,</span></div></li> <li><div class="src-line"><a name="a4161"></a> <span class="src-var">$src_size_human</span><span class="src-sym">,</span></div></li> <li><div class="src-line"><a name="a4162"></a> <span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id">image_src_x</span><span class="src-sym">,</span></div></li> <li><div class="src-line"><a name="a4163"></a> <span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id">image_src_y</span><span class="src-sym">,</span></div></li> <li><div class="src-line"><a name="a4164"></a> <span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id">image_src_pixels</span><span class="src-sym">,</span></div></li> <li><div class="src-line"><a name="a4165"></a> <span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id">image_src_type</span><span class="src-sym">,</span></div></li> <li><div class="src-line"><a name="a4166"></a> <span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id">image_src_bits</span><span class="src-sym">,</span></div></li> <li><div class="src-line"><a name="a4167"></a> <span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id">file_dst_path</span><span class="src-sym">,</span></div></li> <li><div class="src-line"><a name="a4168"></a> <span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id"><a href="class.upload.html#var$file_dst_name_body">file_dst_name_body</a></span><span class="src-sym">,</span></div></li> <li><div class="src-line"><a name="a4169"></a> <span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id"><a href="class.upload.html#var$file_dst_name_ext">file_dst_name_ext</a></span><span class="src-sym">,</span></div></li> <li><div class="src-line"><a name="a4170"></a> <span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id"><a href="class.upload.html#var$file_dst_name">file_dst_name</a></span><span class="src-sym">,</span></div></li> <li><div class="src-line"><a name="a4171"></a> <span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id">file_dst_pathname</span><span class="src-sym">,</span></div></li> <li><div class="src-line"><a name="a4172"></a> <span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id">image_dst_x</span><span class="src-sym">,</span></div></li> <li><div class="src-line"><a name="a4173"></a> <span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id">image_dst_y</span><span class="src-sym">,</span></div></li> <li><div class="src-line"><a name="a4174"></a> <a href="http://www.php.net/date">date</a><span class="src-sym">(</span><span class="src-str">'Y-m-d'</span><span class="src-sym">)</span><span class="src-sym">,</span></div></li> <li><div class="src-line"><a name="a4175"></a> <a href="http://www.php.net/date">date</a><span class="src-sym">(</span><span class="src-str">'H:i:s'</span><span class="src-sym">)</span><span class="src-sym">,</span></div></li> <li><div class="src-line"><a name="a4176"></a> <span class="src-sym">(</span>isset<span class="src-sym">(</span><span class="src-var">$_SERVER</span><span class="src-sym">[</span><span class="src-str">'HTTP_HOST'</span><span class="src-sym">]</span><span class="src-sym">) </span>? <span class="src-var">$_SERVER</span><span class="src-sym">[</span><span class="src-str">'HTTP_HOST'</span><span class="src-sym">] </span>: <span class="src-str">'n/a'</span><span class="src-sym">)</span><span class="src-sym">,</span></div></li> <li><div class="src-line"><a name="a4177"></a> <span class="src-sym">(</span>isset<span class="src-sym">(</span><span class="src-var">$_SERVER</span><span class="src-sym">[</span><span class="src-str">'SERVER_NAME'</span><span class="src-sym">]</span><span class="src-sym">) </span>? <span class="src-var">$_SERVER</span><span class="src-sym">[</span><span class="src-str">'SERVER_NAME'</span><span class="src-sym">] </span>: <span class="src-str">'n/a'</span><span class="src-sym">)</span><span class="src-sym">,</span></div></li> <li><div class="src-line"><a name="a4178"></a> <span class="src-sym">(</span>isset<span class="src-sym">(</span><span class="src-var">$_SERVER</span><span class="src-sym">[</span><span class="src-str">'REMOTE_ADDR'</span><span class="src-sym">]</span><span class="src-sym">) </span>? <span class="src-var">$_SERVER</span><span class="src-sym">[</span><span class="src-str">'REMOTE_ADDR'</span><span class="src-sym">] </span>: <span class="src-str">'n/a'</span><span class="src-sym">)</span><span class="src-sym">,</span></div></li> <li><div class="src-line"><a name="a4179"></a> <span class="src-var">$this</span><span class="src-sym">-></span><a href="class.upload.html#methodgdversion">gdversion</a><span class="src-sym">(</span><span class="src-id">true</span><span class="src-sym">))</span><span class="src-sym">,</span></div></li> <li><div class="src-line"><a name="a4180"></a> <span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id"><a href="class.upload.html#var$image_text">image_text</a></span><span class="src-sym">)</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a4181"></a> </div></li> <li><div class="src-line"><a name="a4182"></a> <span class="src-key">if </span><span class="src-sym">(</span><span class="src-sym">!</span><a href="http://www.php.net/is_numeric">is_numeric</a><span class="src-sym">(</span><span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id"><a href="class.upload.html#var$image_text_padding">image_text_padding</a></span><span class="src-sym">)) </span><span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id"><a href="class.upload.html#var$image_text_padding">image_text_padding</a> </span>= <span class="src-num">0</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a4183"></a> <span class="src-key">if </span><span class="src-sym">(</span><span class="src-sym">!</span><a href="http://www.php.net/is_numeric">is_numeric</a><span class="src-sym">(</span><span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id"><a href="class.upload.html#var$image_text_line_spacing">image_text_line_spacing</a></span><span class="src-sym">)) </span><span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id"><a href="class.upload.html#var$image_text_line_spacing">image_text_line_spacing</a> </span>= <span class="src-num">0</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a4184"></a> <span class="src-key">if </span><span class="src-sym">(</span><span class="src-sym">!</span><a href="http://www.php.net/is_numeric">is_numeric</a><span class="src-sym">(</span><span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id"><a href="class.upload.html#var$image_text_padding_x">image_text_padding_x</a></span><span class="src-sym">)) </span><span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id"><a href="class.upload.html#var$image_text_padding_x">image_text_padding_x</a> </span>= <span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id"><a href="class.upload.html#var$image_text_padding">image_text_padding</a></span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a4185"></a> <span class="src-key">if </span><span class="src-sym">(</span><span class="src-sym">!</span><a href="http://www.php.net/is_numeric">is_numeric</a><span class="src-sym">(</span><span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id"><a href="class.upload.html#var$image_text_padding_y">image_text_padding_y</a></span><span class="src-sym">)) </span><span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id"><a href="class.upload.html#var$image_text_padding_y">image_text_padding_y</a> </span>= <span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id"><a href="class.upload.html#var$image_text_padding">image_text_padding</a></span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a4186"></a> <span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id"><a href="class.upload.html#var$image_text_position">image_text_position</a> </span>= <a href="http://www.php.net/strtolower">strtolower</a><span class="src-sym">(</span><span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id"><a href="class.upload.html#var$image_text_position">image_text_position</a></span><span class="src-sym">)</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a4187"></a> <span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id"><a href="class.upload.html#var$image_text_direction">image_text_direction</a> </span>= <a href="http://www.php.net/strtolower">strtolower</a><span class="src-sym">(</span><span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id"><a href="class.upload.html#var$image_text_direction">image_text_direction</a></span><span class="src-sym">)</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a4188"></a> <span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id"><a href="class.upload.html#var$image_text_alignment">image_text_alignment</a> </span>= <a href="http://www.php.net/strtolower">strtolower</a><span class="src-sym">(</span><span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id"><a href="class.upload.html#var$image_text_alignment">image_text_alignment</a></span><span class="src-sym">)</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a4189"></a> </div></li> <li><div class="src-line"><a name="a4190"></a> <span class="src-comm">// if the font is a string, we assume that we might want to load a font</span></div></li> <li><div class="src-line"><a name="a4191"></a> <span class="src-key">if </span><span class="src-sym">(</span><span class="src-sym">!</span><a href="http://www.php.net/is_numeric">is_numeric</a><span class="src-sym">(</span><span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id"><a href="class.upload.html#var$image_text_font">image_text_font</a></span><span class="src-sym">) </span>&& <a href="http://www.php.net/strlen">strlen</a><span class="src-sym">(</span><span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id"><a href="class.upload.html#var$image_text_font">image_text_font</a></span><span class="src-sym">) </span>> <span class="src-num">4 </span>&& <a href="http://www.php.net/substr">substr</a><span class="src-sym">(</span><a href="http://www.php.net/strtolower">strtolower</a><span class="src-sym">(</span><span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id"><a href="class.upload.html#var$image_text_font">image_text_font</a></span><span class="src-sym">)</span><span class="src-sym">, </span>-<span class="src-num">4</span><span class="src-sym">) </span>== <span class="src-str">'.gdf'</span><span class="src-sym">) </span><span class="src-sym">{</span></div></li> <li><div class="src-line"><a name="a4192"></a> <span class="src-var">$this</span><span class="src-sym">-></span><a href="http://www.php.net/log">log</a> .= <span class="src-str">'&nbsp;&nbsp;&nbsp;&nbsp;try to load font ' </span>. <span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id"><a href="class.upload.html#var$image_text_font">image_text_font</a> </span>. <span class="src-str">'... '</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a4193"></a> <span class="src-key">if </span><span class="src-sym">(</span><span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id"><a href="class.upload.html#var$image_text_font">image_text_font</a> </span>= <span class="src-sym">@</span><a href="http://www.php.net/imageloadfont">imageloadfont</a><span class="src-sym">(</span><span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id"><a href="class.upload.html#var$image_text_font">image_text_font</a></span><span class="src-sym">)) </span><span class="src-sym">{</span></div></li> <li><div class="src-line"><a name="a4194"></a> <span class="src-var">$this</span><span class="src-sym">-></span><a href="http://www.php.net/log">log</a> .= <span class="src-str">'success<br />'</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a4195"></a> <span class="src-sym">} </span><span class="src-key">else </span><span class="src-sym">{</span></div></li> <li><div class="src-line"><a name="a4196"></a> <span class="src-var">$this</span><span class="src-sym">-></span><a href="http://www.php.net/log">log</a> .= <span class="src-str">'error<br />'</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a4197"></a> <span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id"><a href="class.upload.html#var$image_text_font">image_text_font</a> </span>= <span class="src-num">5</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a4198"></a> <span class="src-sym">}</span></div></li> <li><div class="src-line"><a name="a4199"></a> <span class="src-sym">}</span></div></li> <li><div class="src-line"><a name="a4200"></a> </div></li> <li><div class="src-line"><a name="a4201"></a> <span class="src-var">$text </span>= <a href="http://www.php.net/explode">explode</a><span class="src-sym">(</span><span class="src-str">"\n"</span><span class="src-sym">, </span><span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id"><a href="class.upload.html#var$image_text">image_text</a></span><span class="src-sym">)</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a4202"></a> <span class="src-var">$char_width </span>= <a href="http://www.php.net/imagefontwidth">imagefontwidth</a><span class="src-sym">(</span><span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id"><a href="class.upload.html#var$image_text_font">image_text_font</a></span><span class="src-sym">)</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a4203"></a> <span class="src-var">$char_height </span>= <a href="http://www.php.net/imagefontheight">imagefontheight</a><span class="src-sym">(</span><span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id"><a href="class.upload.html#var$image_text_font">image_text_font</a></span><span class="src-sym">)</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a4204"></a> <span class="src-var">$text_height </span>= <span class="src-num">0</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a4205"></a> <span class="src-var">$text_width </span>= <span class="src-num">0</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a4206"></a> <span class="src-var">$line_height </span>= <span class="src-num">0</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a4207"></a> <span class="src-var">$line_width </span>= <span class="src-num">0</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a4208"></a> </div></li> <li><div class="src-line"><a name="a4209"></a> <span class="src-key">foreach </span><span class="src-sym">(</span><span class="src-var">$text </span><span class="src-key">as </span><span class="src-var">$k </span>=> <span class="src-var">$v</span><span class="src-sym">) </span><span class="src-sym">{</span></div></li> <li><div class="src-line"><a name="a4210"></a> <span class="src-key">if </span><span class="src-sym">(</span><span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id"><a href="class.upload.html#var$image_text_direction">image_text_direction</a> </span>== <span class="src-str">'v'</span><span class="src-sym">) </span><span class="src-sym">{</span></div></li> <li><div class="src-line"><a name="a4211"></a> <span class="src-var">$h </span>= <span class="src-sym">(</span><span class="src-var">$char_width </span>* <a href="http://www.php.net/strlen">strlen</a><span class="src-sym">(</span><span class="src-var">$v</span><span class="src-sym">))</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a4212"></a> <span class="src-key">if </span><span class="src-sym">(</span><span class="src-var">$h </span>> <span class="src-var">$text_height</span><span class="src-sym">) </span><span class="src-var">$text_height </span>= <span class="src-var">$h</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a4213"></a> <span class="src-var">$line_width </span>= <span class="src-var">$char_height</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a4214"></a> <span class="src-var">$text_width </span>+= <span class="src-var">$line_width </span>+ <span class="src-sym">(</span><span class="src-var">$k </span>< <span class="src-sym">(</span><a href="http://www.php.net/sizeof">sizeof</a><span class="src-sym">(</span><span class="src-var">$text</span><span class="src-sym">)</span>-<span class="src-num">1</span><span class="src-sym">) </span>? <span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id"><a href="class.upload.html#var$image_text_line_spacing">image_text_line_spacing</a> </span>: <span class="src-num">0</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a4215"></a> <span class="src-sym">} </span><span class="src-key">else </span><span class="src-sym">{</span></div></li> <li><div class="src-line"><a name="a4216"></a> <span class="src-var">$w </span>= <span class="src-sym">(</span><span class="src-var">$char_width </span>* <a href="http://www.php.net/strlen">strlen</a><span class="src-sym">(</span><span class="src-var">$v</span><span class="src-sym">))</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a4217"></a> <span class="src-key">if </span><span class="src-sym">(</span><span class="src-var">$w </span>> <span class="src-var">$text_width</span><span class="src-sym">) </span><span class="src-var">$text_width </span>= <span class="src-var">$w</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a4218"></a> <span class="src-var">$line_height </span>= <span class="src-var">$char_height</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a4219"></a> <span class="src-var">$text_height </span>+= <span class="src-var">$line_height </span>+ <span class="src-sym">(</span><span class="src-var">$k </span>< <span class="src-sym">(</span><a href="http://www.php.net/sizeof">sizeof</a><span class="src-sym">(</span><span class="src-var">$text</span><span class="src-sym">)</span>-<span class="src-num">1</span><span class="src-sym">) </span>? <span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id"><a href="class.upload.html#var$image_text_line_spacing">image_text_line_spacing</a> </span>: <span class="src-num">0</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a4220"></a> <span class="src-sym">}</span></div></li> <li><div class="src-line"><a name="a4221"></a> <span class="src-sym">}</span></div></li> <li><div class="src-line"><a name="a4222"></a> <span class="src-var">$text_width </span>+= <span class="src-sym">(</span><span class="src-num">2 </span>* <span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id"><a href="class.upload.html#var$image_text_padding_x">image_text_padding_x</a></span><span class="src-sym">)</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a4223"></a> <span class="src-var">$text_height </span>+= <span class="src-sym">(</span><span class="src-num">2 </span>* <span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id"><a href="class.upload.html#var$image_text_padding_y">image_text_padding_y</a></span><span class="src-sym">)</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a4224"></a> <span class="src-var">$text_x </span>= <span class="src-num">0</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a4225"></a> <span class="src-var">$text_y </span>= <span class="src-num">0</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a4226"></a> <span class="src-key">if </span><span class="src-sym">(</span><a href="http://www.php.net/is_numeric">is_numeric</a><span class="src-sym">(</span><span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id"><a href="class.upload.html#var$image_text_x">image_text_x</a></span><span class="src-sym">)) </span><span class="src-sym">{</span></div></li> <li><div class="src-line"><a name="a4227"></a> <span class="src-key">if </span><span class="src-sym">(</span><span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id"><a href="class.upload.html#var$image_text_x">image_text_x</a> </span>< <span class="src-num">0</span><span class="src-sym">) </span><span class="src-sym">{</span></div></li> <li><div class="src-line"><a name="a4228"></a> <span class="src-var">$text_x </span>= <span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id">image_dst_x </span>- <span class="src-var">$text_width </span>+ <span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id"><a href="class.upload.html#var$image_text_x">image_text_x</a></span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a4229"></a> <span class="src-sym">} </span><span class="src-key">else </span><span class="src-sym">{</span></div></li> <li><div class="src-line"><a name="a4230"></a> <span class="src-var">$text_x </span>= <span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id"><a href="class.upload.html#var$image_text_x">image_text_x</a></span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a4231"></a> <span class="src-sym">}</span></div></li> <li><div class="src-line"><a name="a4232"></a> <span class="src-sym">} </span><span class="src-key">else </span><span class="src-sym">{</span></div></li> <li><div class="src-line"><a name="a4233"></a> <span class="src-key">if </span><span class="src-sym">(</span><a href="http://www.php.net/strpos">strpos</a><span class="src-sym">(</span><span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id"><a href="class.upload.html#var$image_text_position">image_text_position</a></span><span class="src-sym">, </span><span class="src-str">'r'</span><span class="src-sym">) </span>!== <span class="src-id">false</span><span class="src-sym">) </span><span class="src-sym">{</span></div></li> <li><div class="src-line"><a name="a4234"></a> <span class="src-var">$text_x </span>= <span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id">image_dst_x </span>- <span class="src-var">$text_width</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a4235"></a> <span class="src-sym">} </span><span class="src-key">else </span><span class="src-key">if </span><span class="src-sym">(</span><a href="http://www.php.net/strpos">strpos</a><span class="src-sym">(</span><span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id"><a href="class.upload.html#var$image_text_position">image_text_position</a></span><span class="src-sym">, </span><span class="src-str">'l'</span><span class="src-sym">) </span>!== <span class="src-id">false</span><span class="src-sym">) </span><span class="src-sym">{</span></div></li> <li><div class="src-line"><a name="a4236"></a> <span class="src-var">$text_x </span>= <span class="src-num">0</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a4237"></a> <span class="src-sym">} </span><span class="src-key">else </span><span class="src-sym">{</span></div></li> <li><div class="src-line"><a name="a4238"></a> <span class="src-var">$text_x </span>= <span class="src-sym">(</span><span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id">image_dst_x </span>- <span class="src-var">$text_width</span><span class="src-sym">) </span>/ <span class="src-num">2</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a4239"></a> <span class="src-sym">}</span></div></li> <li><div class="src-line"><a name="a4240"></a> <span class="src-sym">}</span></div></li> <li><div class="src-line"><a name="a4241"></a> <span class="src-key">if </span><span class="src-sym">(</span><a href="http://www.php.net/is_numeric">is_numeric</a><span class="src-sym">(</span><span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id"><a href="class.upload.html#var$image_text_y">image_text_y</a></span><span class="src-sym">)) </span><span class="src-sym">{</span></div></li> <li><div class="src-line"><a name="a4242"></a> <span class="src-key">if </span><span class="src-sym">(</span><span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id"><a href="class.upload.html#var$image_text_y">image_text_y</a> </span>< <span class="src-num">0</span><span class="src-sym">) </span><span class="src-sym">{</span></div></li> <li><div class="src-line"><a name="a4243"></a> <span class="src-var">$text_y </span>= <span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id">image_dst_y </span>- <span class="src-var">$text_height </span>+ <span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id"><a href="class.upload.html#var$image_text_y">image_text_y</a></span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a4244"></a> <span class="src-sym">} </span><span class="src-key">else </span><span class="src-sym">{</span></div></li> <li><div class="src-line"><a name="a4245"></a> <span class="src-var">$text_y </span>= <span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id"><a href="class.upload.html#var$image_text_y">image_text_y</a></span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a4246"></a> <span class="src-sym">}</span></div></li> <li><div class="src-line"><a name="a4247"></a> <span class="src-sym">} </span><span class="src-key">else </span><span class="src-sym">{</span></div></li> <li><div class="src-line"><a name="a4248"></a> <span class="src-key">if </span><span class="src-sym">(</span><a href="http://www.php.net/strpos">strpos</a><span class="src-sym">(</span><span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id"><a href="class.upload.html#var$image_text_position">image_text_position</a></span><span class="src-sym">, </span><span class="src-str">'b'</span><span class="src-sym">) </span>!== <span class="src-id">false</span><span class="src-sym">) </span><span class="src-sym">{</span></div></li> <li><div class="src-line"><a name="a4249"></a> <span class="src-var">$text_y </span>= <span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id">image_dst_y </span>- <span class="src-var">$text_height</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a4250"></a> <span class="src-sym">} </span><span class="src-key">else </span><span class="src-key">if </span><span class="src-sym">(</span><a href="http://www.php.net/strpos">strpos</a><span class="src-sym">(</span><span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id"><a href="class.upload.html#var$image_text_position">image_text_position</a></span><span class="src-sym">, </span><span class="src-str">'t'</span><span class="src-sym">) </span>!== <span class="src-id">false</span><span class="src-sym">) </span><span class="src-sym">{</span></div></li> <li><div class="src-line"><a name="a4251"></a> <span class="src-var">$text_y </span>= <span class="src-num">0</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a4252"></a> <span class="src-sym">} </span><span class="src-key">else </span><span class="src-sym">{</span></div></li> <li><div class="src-line"><a name="a4253"></a> <span class="src-var">$text_y </span>= <span class="src-sym">(</span><span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id">image_dst_y </span>- <span class="src-var">$text_height</span><span class="src-sym">) </span>/ <span class="src-num">2</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a4254"></a> <span class="src-sym">}</span></div></li> <li><div class="src-line"><a name="a4255"></a> <span class="src-sym">}</span></div></li> <li><div class="src-line"><a name="a4256"></a> </div></li> <li><div class="src-line"><a name="a4257"></a> <span class="src-comm">// add a background, maybe transparent</span></div></li> <li><div class="src-line"><a name="a4258"></a> <span class="src-key">if </span><span class="src-sym">(</span><span class="src-sym">!</span><span class="src-key">empty</span><span class="src-sym">(</span><span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id"><a href="class.upload.html#var$image_text_background">image_text_background</a></span><span class="src-sym">)) </span><span class="src-sym">{</span></div></li> <li><div class="src-line"><a name="a4259"></a> list<span class="src-sym">(</span><span class="src-var">$red</span><span class="src-sym">, </span><span class="src-var">$green</span><span class="src-sym">, </span><span class="src-var">$blue</span><span class="src-sym">) </span>= <span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id">getcolors</span><span class="src-sym">(</span><span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id"><a href="class.upload.html#var$image_text_background">image_text_background</a></span><span class="src-sym">)</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a4260"></a> <span class="src-key">if </span><span class="src-sym">(</span><span class="src-var">$gd_version </span>>= <span class="src-num">2 </span>&& <span class="src-sym">(</span><a href="http://www.php.net/is_numeric">is_numeric</a><span class="src-sym">(</span><span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id"><a href="class.upload.html#var$image_text_background_percent">image_text_background_percent</a></span><span class="src-sym">)) </span>&& <span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id"><a href="class.upload.html#var$image_text_background_percent">image_text_background_percent</a> </span>>= <span class="src-num">0 </span>&& <span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id"><a href="class.upload.html#var$image_text_background_percent">image_text_background_percent</a> </span><= <span class="src-num">100</span><span class="src-sym">) </span><span class="src-sym">{</span></div></li> <li><div class="src-line"><a name="a4261"></a> <span class="src-var">$filter </span>= <a href="http://www.php.net/imagecreatetruecolor">imagecreatetruecolor</a><span class="src-sym">(</span><span class="src-var">$text_width</span><span class="src-sym">, </span><span class="src-var">$text_height</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a4262"></a> <span class="src-var">$background_color </span>= <a href="http://www.php.net/imagecolorallocate">imagecolorallocate</a><span class="src-sym">(</span><span class="src-var">$filter</span><span class="src-sym">, </span><span class="src-var">$red</span><span class="src-sym">, </span><span class="src-var">$green</span><span class="src-sym">, </span><span class="src-var">$blue</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a4263"></a> <a href="http://www.php.net/imagefilledrectangle">imagefilledrectangle</a><span class="src-sym">(</span><span class="src-var">$filter</span><span class="src-sym">, </span><span class="src-num">0</span><span class="src-sym">, </span><span class="src-num">0</span><span class="src-sym">, </span><span class="src-var">$text_width</span><span class="src-sym">, </span><span class="src-var">$text_height</span><span class="src-sym">, </span><span class="src-var">$background_color</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a4264"></a> <span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id">imagecopymergealpha</span><span class="src-sym">(</span><span class="src-var">$image_dst</span><span class="src-sym">, </span><span class="src-var">$filter</span><span class="src-sym">, </span><span class="src-var">$text_x</span><span class="src-sym">, </span><span class="src-var">$text_y</span><span class="src-sym">, </span><span class="src-num">0</span><span class="src-sym">, </span><span class="src-num">0</span><span class="src-sym">, </span><span class="src-var">$text_width</span><span class="src-sym">, </span><span class="src-var">$text_height</span><span class="src-sym">, </span><span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id"><a href="class.upload.html#var$image_text_background_percent">image_text_background_percent</a></span><span class="src-sym">)</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a4265"></a> <a href="http://www.php.net/imagedestroy">imagedestroy</a><span class="src-sym">(</span><span class="src-var">$filter</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a4266"></a> <span class="src-sym">} </span><span class="src-key">else </span><span class="src-sym">{</span></div></li> <li><div class="src-line"><a name="a4267"></a> <span class="src-var">$background_color </span>= <a href="http://www.php.net/imagecolorallocate">imagecolorallocate</a><span class="src-sym">(</span><span class="src-var">$image_dst </span><span class="src-sym">,</span><span class="src-var">$red</span><span class="src-sym">, </span><span class="src-var">$green</span><span class="src-sym">, </span><span class="src-var">$blue</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a4268"></a> <a href="http://www.php.net/imagefilledrectangle">imagefilledrectangle</a><span class="src-sym">(</span><span class="src-var">$image_dst</span><span class="src-sym">, </span><span class="src-var">$text_x</span><span class="src-sym">, </span><span class="src-var">$text_y</span><span class="src-sym">, </span><span class="src-var">$text_x </span>+ <span class="src-var">$text_width</span><span class="src-sym">, </span><span class="src-var">$text_y </span>+ <span class="src-var">$text_height</span><span class="src-sym">, </span><span class="src-var">$background_color</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a4269"></a> <span class="src-sym">}</span></div></li> <li><div class="src-line"><a name="a4270"></a> <span class="src-sym">}</span></div></li> <li><div class="src-line"><a name="a4271"></a> </div></li> <li><div class="src-line"><a name="a4272"></a> <span class="src-var">$text_x </span>+= <span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id"><a href="class.upload.html#var$image_text_padding_x">image_text_padding_x</a></span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a4273"></a> <span class="src-var">$text_y </span>+= <span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id"><a href="class.upload.html#var$image_text_padding_y">image_text_padding_y</a></span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a4274"></a> <span class="src-var">$t_width </span>= <span class="src-var">$text_width </span>- <span class="src-sym">(</span><span class="src-num">2 </span>* <span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id"><a href="class.upload.html#var$image_text_padding_x">image_text_padding_x</a></span><span class="src-sym">)</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a4275"></a> <span class="src-var">$t_height </span>= <span class="src-var">$text_height </span>- <span class="src-sym">(</span><span class="src-num">2 </span>* <span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id"><a href="class.upload.html#var$image_text_padding_y">image_text_padding_y</a></span><span class="src-sym">)</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a4276"></a> list<span class="src-sym">(</span><span class="src-var">$red</span><span class="src-sym">, </span><span class="src-var">$green</span><span class="src-sym">, </span><span class="src-var">$blue</span><span class="src-sym">) </span>= <span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id">getcolors</span><span class="src-sym">(</span><span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id"><a href="class.upload.html#var$image_text_color">image_text_color</a></span><span class="src-sym">)</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a4277"></a> </div></li> <li><div class="src-line"><a name="a4278"></a> <span class="src-comm">// add the text, maybe transparent</span></div></li> <li><div class="src-line"><a name="a4279"></a> <span class="src-key">if </span><span class="src-sym">(</span><span class="src-var">$gd_version </span>>= <span class="src-num">2 </span>&& <span class="src-sym">(</span><a href="http://www.php.net/is_numeric">is_numeric</a><span class="src-sym">(</span><span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id"><a href="class.upload.html#var$image_text_percent">image_text_percent</a></span><span class="src-sym">)) </span>&& <span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id"><a href="class.upload.html#var$image_text_percent">image_text_percent</a> </span>>= <span class="src-num">0 </span>&& <span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id"><a href="class.upload.html#var$image_text_percent">image_text_percent</a> </span><= <span class="src-num">100</span><span class="src-sym">) </span><span class="src-sym">{</span></div></li> <li><div class="src-line"><a name="a4280"></a> <span class="src-key">if </span><span class="src-sym">(</span><span class="src-var">$t_width </span>< <span class="src-num">0</span><span class="src-sym">) </span><span class="src-var">$t_width </span>= <span class="src-num">0</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a4281"></a> <span class="src-key">if </span><span class="src-sym">(</span><span class="src-var">$t_height </span>< <span class="src-num">0</span><span class="src-sym">) </span><span class="src-var">$t_height </span>= <span class="src-num">0</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a4282"></a> <span class="src-var">$filter </span>= <span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id">imagecreatenew</span><span class="src-sym">(</span><span class="src-var">$t_width</span><span class="src-sym">, </span><span class="src-var">$t_height</span><span class="src-sym">, </span><span class="src-id">false</span><span class="src-sym">, </span><span class="src-id">true</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a4283"></a> <span class="src-var">$text_color </span>= <a href="http://www.php.net/imagecolorallocate">imagecolorallocate</a><span class="src-sym">(</span><span class="src-var">$filter </span><span class="src-sym">,</span><span class="src-var">$red</span><span class="src-sym">, </span><span class="src-var">$green</span><span class="src-sym">, </span><span class="src-var">$blue</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a4284"></a> </div></li> <li><div class="src-line"><a name="a4285"></a> <span class="src-key">foreach </span><span class="src-sym">(</span><span class="src-var">$text </span><span class="src-key">as </span><span class="src-var">$k </span>=> <span class="src-var">$v</span><span class="src-sym">) </span><span class="src-sym">{</span></div></li> <li><div class="src-line"><a name="a4286"></a> <span class="src-key">if </span><span class="src-sym">(</span><span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id"><a href="class.upload.html#var$image_text_direction">image_text_direction</a> </span>== <span class="src-str">'v'</span><span class="src-sym">) </span><span class="src-sym">{</span></div></li> <li><div class="src-line"><a name="a4287"></a> <a href="http://www.php.net/imagestringup">imagestringup</a><span class="src-sym">(</span><span class="src-var">$filter</span><span class="src-sym">,</span></div></li> <li><div class="src-line"><a name="a4288"></a> <span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id"><a href="class.upload.html#var$image_text_font">image_text_font</a></span><span class="src-sym">,</span></div></li> <li><div class="src-line"><a name="a4289"></a> <span class="src-var">$k </span>* <span class="src-sym">(</span><span class="src-var">$line_width </span>+ <span class="src-sym">(</span><span class="src-var">$k </span>> <span class="src-num">0 </span>&& <span class="src-var">$k </span>< <span class="src-sym">(</span><a href="http://www.php.net/sizeof">sizeof</a><span class="src-sym">(</span><span class="src-var">$text</span><span class="src-sym">)) </span>? <span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id"><a href="class.upload.html#var$image_text_line_spacing">image_text_line_spacing</a> </span>: <span class="src-num">0</span><span class="src-sym">))</span><span class="src-sym">,</span></div></li> <li><div class="src-line"><a name="a4290"></a> <span class="src-var">$text_height </span>- <span class="src-sym">(</span><span class="src-num">2 </span>* <span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id"><a href="class.upload.html#var$image_text_padding_y">image_text_padding_y</a></span><span class="src-sym">) </span>- <span class="src-sym">(</span><span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id"><a href="class.upload.html#var$image_text_alignment">image_text_alignment</a> </span>== <span class="src-str">'l' </span>? <span class="src-num">0 </span>: <span class="src-sym">((</span><span class="src-var">$t_height </span>- <a href="http://www.php.net/strlen">strlen</a><span class="src-sym">(</span><span class="src-var">$v</span><span class="src-sym">) </span>* <span class="src-var">$char_width</span><span class="src-sym">) </span>/ <span class="src-sym">(</span><span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id"><a href="class.upload.html#var$image_text_alignment">image_text_alignment</a> </span>== <span class="src-str">'r' </span>? <span class="src-num">1 </span>: <span class="src-num">2</span><span class="src-sym">))) </span><span class="src-sym">,</span></div></li> <li><div class="src-line"><a name="a4291"></a> <span class="src-var">$v</span><span class="src-sym">,</span></div></li> <li><div class="src-line"><a name="a4292"></a> <span class="src-var">$text_color</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a4293"></a> <span class="src-sym">} </span><span class="src-key">else </span><span class="src-sym">{</span></div></li> <li><div class="src-line"><a name="a4294"></a> <a href="http://www.php.net/imagestring">imagestring</a><span class="src-sym">(</span><span class="src-var">$filter</span><span class="src-sym">,</span></div></li> <li><div class="src-line"><a name="a4295"></a> <span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id"><a href="class.upload.html#var$image_text_font">image_text_font</a></span><span class="src-sym">,</span></div></li> <li><div class="src-line"><a name="a4296"></a> <span class="src-sym">(</span><span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id"><a href="class.upload.html#var$image_text_alignment">image_text_alignment</a> </span>== <span class="src-str">'l' </span>? <span class="src-num">0 </span>: <span class="src-sym">((</span><span class="src-var">$t_width </span>- <a href="http://www.php.net/strlen">strlen</a><span class="src-sym">(</span><span class="src-var">$v</span><span class="src-sym">) </span>* <span class="src-var">$char_width</span><span class="src-sym">) </span>/ <span class="src-sym">(</span><span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id"><a href="class.upload.html#var$image_text_alignment">image_text_alignment</a> </span>== <span class="src-str">'r' </span>? <span class="src-num">1 </span>: <span class="src-num">2</span><span class="src-sym">)))</span><span class="src-sym">,</span></div></li> <li><div class="src-line"><a name="a4297"></a> <span class="src-var">$k </span>* <span class="src-sym">(</span><span class="src-var">$line_height </span>+ <span class="src-sym">(</span><span class="src-var">$k </span>> <span class="src-num">0 </span>&& <span class="src-var">$k </span>< <span class="src-sym">(</span><a href="http://www.php.net/sizeof">sizeof</a><span class="src-sym">(</span><span class="src-var">$text</span><span class="src-sym">)) </span>? <span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id"><a href="class.upload.html#var$image_text_line_spacing">image_text_line_spacing</a> </span>: <span class="src-num">0</span><span class="src-sym">))</span><span class="src-sym">,</span></div></li> <li><div class="src-line"><a name="a4298"></a> <span class="src-var">$v</span><span class="src-sym">,</span></div></li> <li><div class="src-line"><a name="a4299"></a> <span class="src-var">$text_color</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a4300"></a> <span class="src-sym">}</span></div></li> <li><div class="src-line"><a name="a4301"></a> <span class="src-sym">}</span></div></li> <li><div class="src-line"><a name="a4302"></a> <span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id">imagecopymergealpha</span><span class="src-sym">(</span><span class="src-var">$image_dst</span><span class="src-sym">, </span><span class="src-var">$filter</span><span class="src-sym">, </span><span class="src-var">$text_x</span><span class="src-sym">, </span><span class="src-var">$text_y</span><span class="src-sym">, </span><span class="src-num">0</span><span class="src-sym">, </span><span class="src-num">0</span><span class="src-sym">, </span><span class="src-var">$t_width</span><span class="src-sym">, </span><span class="src-var">$t_height</span><span class="src-sym">, </span><span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id"><a href="class.upload.html#var$image_text_percent">image_text_percent</a></span><span class="src-sym">)</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a4303"></a> <a href="http://www.php.net/imagedestroy">imagedestroy</a><span class="src-sym">(</span><span class="src-var">$filter</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a4304"></a> </div></li> <li><div class="src-line"><a name="a4305"></a> <span class="src-sym">} </span><span class="src-key">else </span><span class="src-sym">{</span></div></li> <li><div class="src-line"><a name="a4306"></a> <span class="src-var">$text_color </span>= <span class="src-id">imageColorAllocate</span><span class="src-sym">(</span><span class="src-var">$image_dst </span><span class="src-sym">,</span><span class="src-var">$red</span><span class="src-sym">, </span><span class="src-var">$green</span><span class="src-sym">, </span><span class="src-var">$blue</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a4307"></a> <span class="src-key">foreach </span><span class="src-sym">(</span><span class="src-var">$text </span><span class="src-key">as </span><span class="src-var">$k </span>=> <span class="src-var">$v</span><span class="src-sym">) </span><span class="src-sym">{</span></div></li> <li><div class="src-line"><a name="a4308"></a> <span class="src-key">if </span><span class="src-sym">(</span><span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id"><a href="class.upload.html#var$image_text_direction">image_text_direction</a> </span>== <span class="src-str">'v'</span><span class="src-sym">) </span><span class="src-sym">{</span></div></li> <li><div class="src-line"><a name="a4309"></a> <a href="http://www.php.net/imagestringup">imagestringup</a><span class="src-sym">(</span><span class="src-var">$image_dst</span><span class="src-sym">,</span></div></li> <li><div class="src-line"><a name="a4310"></a> <span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id"><a href="class.upload.html#var$image_text_font">image_text_font</a></span><span class="src-sym">,</span></div></li> <li><div class="src-line"><a name="a4311"></a> <span class="src-var">$text_x </span>+ <span class="src-var">$k </span>* <span class="src-sym">(</span><span class="src-var">$line_width </span>+ <span class="src-sym">(</span><span class="src-var">$k </span>> <span class="src-num">0 </span>&& <span class="src-var">$k </span>< <span class="src-sym">(</span><a href="http://www.php.net/sizeof">sizeof</a><span class="src-sym">(</span><span class="src-var">$text</span><span class="src-sym">)) </span>? <span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id"><a href="class.upload.html#var$image_text_line_spacing">image_text_line_spacing</a> </span>: <span class="src-num">0</span><span class="src-sym">))</span><span class="src-sym">,</span></div></li> <li><div class="src-line"><a name="a4312"></a> <span class="src-var">$text_y </span>+ <span class="src-var">$text_height </span>- <span class="src-sym">(</span><span class="src-num">2 </span>* <span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id"><a href="class.upload.html#var$image_text_padding_y">image_text_padding_y</a></span><span class="src-sym">) </span>- <span class="src-sym">(</span><span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id"><a href="class.upload.html#var$image_text_alignment">image_text_alignment</a> </span>== <span class="src-str">'l' </span>? <span class="src-num">0 </span>: <span class="src-sym">((</span><span class="src-var">$t_height </span>- <a href="http://www.php.net/strlen">strlen</a><span class="src-sym">(</span><span class="src-var">$v</span><span class="src-sym">) </span>* <span class="src-var">$char_width</span><span class="src-sym">) </span>/ <span class="src-sym">(</span><span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id"><a href="class.upload.html#var$image_text_alignment">image_text_alignment</a> </span>== <span class="src-str">'r' </span>? <span class="src-num">1 </span>: <span class="src-num">2</span><span class="src-sym">)))</span><span class="src-sym">,</span></div></li> <li><div class="src-line"><a name="a4313"></a> <span class="src-var">$v</span><span class="src-sym">,</span></div></li> <li><div class="src-line"><a name="a4314"></a> <span class="src-var">$text_color</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a4315"></a> <span class="src-sym">} </span><span class="src-key">else </span><span class="src-sym">{</span></div></li> <li><div class="src-line"><a name="a4316"></a> <a href="http://www.php.net/imagestring">imagestring</a><span class="src-sym">(</span><span class="src-var">$image_dst</span><span class="src-sym">,</span></div></li> <li><div class="src-line"><a name="a4317"></a> <span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id"><a href="class.upload.html#var$image_text_font">image_text_font</a></span><span class="src-sym">,</span></div></li> <li><div class="src-line"><a name="a4318"></a> <span class="src-var">$text_x </span>+ <span class="src-sym">(</span><span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id"><a href="class.upload.html#var$image_text_alignment">image_text_alignment</a> </span>== <span class="src-str">'l' </span>? <span class="src-num">0 </span>: <span class="src-sym">((</span><span class="src-var">$t_width </span>- <a href="http://www.php.net/strlen">strlen</a><span class="src-sym">(</span><span class="src-var">$v</span><span class="src-sym">) </span>* <span class="src-var">$char_width</span><span class="src-sym">) </span>/ <span class="src-sym">(</span><span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id"><a href="class.upload.html#var$image_text_alignment">image_text_alignment</a> </span>== <span class="src-str">'r' </span>? <span class="src-num">1 </span>: <span class="src-num">2</span><span class="src-sym">)))</span><span class="src-sym">,</span></div></li> <li><div class="src-line"><a name="a4319"></a> <span class="src-var">$text_y </span>+ <span class="src-var">$k </span>* <span class="src-sym">(</span><span class="src-var">$line_height </span>+ <span class="src-sym">(</span><span class="src-var">$k </span>> <span class="src-num">0 </span>&& <span class="src-var">$k </span>< <span class="src-sym">(</span><a href="http://www.php.net/sizeof">sizeof</a><span class="src-sym">(</span><span class="src-var">$text</span><span class="src-sym">)) </span>? <span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id"><a href="class.upload.html#var$image_text_line_spacing">image_text_line_spacing</a> </span>: <span class="src-num">0</span><span class="src-sym">))</span><span class="src-sym">,</span></div></li> <li><div class="src-line"><a name="a4320"></a> <span class="src-var">$v</span><span class="src-sym">,</span></div></li> <li><div class="src-line"><a name="a4321"></a> <span class="src-var">$text_color</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a4322"></a> <span class="src-sym">}</span></div></li> <li><div class="src-line"><a name="a4323"></a> <span class="src-sym">}</span></div></li> <li><div class="src-line"><a name="a4324"></a> <span class="src-sym">}</span></div></li> <li><div class="src-line"><a name="a4325"></a> <span class="src-sym">}</span></div></li> <li><div class="src-line"><a name="a4326"></a> </div></li> <li><div class="src-line"><a name="a4327"></a> <span class="src-comm">// add a reflection</span></div></li> <li><div class="src-line"><a name="a4328"></a> <span class="src-key">if </span><span class="src-sym">(</span><span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id"><a href="class.upload.html#var$image_reflection_height">image_reflection_height</a></span><span class="src-sym">) </span><span class="src-sym">{</span></div></li> <li><div class="src-line"><a name="a4329"></a> <span class="src-var">$this</span><span class="src-sym">-></span><a href="http://www.php.net/log">log</a> .= <span class="src-str">'- add reflection : ' </span>. <span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id"><a href="class.upload.html#var$image_reflection_height">image_reflection_height</a> </span>. <span class="src-str">'<br />'</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a4330"></a> <span class="src-comm">// we decode image_reflection_height, which can be a integer, a string in pixels or percentage</span></div></li> <li><div class="src-line"><a name="a4331"></a> <span class="src-var">$image_reflection_height </span>= <span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id"><a href="class.upload.html#var$image_reflection_height">image_reflection_height</a></span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a4332"></a> <span class="src-key">if </span><span class="src-sym">(</span><a href="http://www.php.net/strpos">strpos</a><span class="src-sym">(</span><span class="src-var">$image_reflection_height</span><span class="src-sym">, </span><span class="src-str">'%'</span><span class="src-sym">)</span>><span class="src-num">0</span><span class="src-sym">) </span><span class="src-var">$image_reflection_height </span>= <span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id">image_dst_y </span>* <span class="src-sym">(</span><a href="http://www.php.net/str_replace">str_replace</a><span class="src-sym">(</span><span class="src-str">'%'</span><span class="src-sym">,</span><span class="src-str">''</span><span class="src-sym">,</span><span class="src-var">$image_reflection_height </span>/ <span class="src-num">100</span><span class="src-sym">))</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a4333"></a> <span class="src-key">if </span><span class="src-sym">(</span><a href="http://www.php.net/strpos">strpos</a><span class="src-sym">(</span><span class="src-var">$image_reflection_height</span><span class="src-sym">, </span><span class="src-str">'px'</span><span class="src-sym">)</span>><span class="src-num">0</span><span class="src-sym">) </span><span class="src-var">$image_reflection_height </span>= <a href="http://www.php.net/str_replace">str_replace</a><span class="src-sym">(</span><span class="src-str">'px'</span><span class="src-sym">,</span><span class="src-str">''</span><span class="src-sym">,</span><span class="src-var">$image_reflection_height</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a4334"></a> <span class="src-var">$image_reflection_height </span>= (int) <span class="src-var">$image_reflection_height</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a4335"></a> <span class="src-key">if </span><span class="src-sym">(</span><span class="src-var">$image_reflection_height </span>> <span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id">image_dst_y</span><span class="src-sym">) </span><span class="src-var">$image_reflection_height </span>= <span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id">image_dst_y</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a4336"></a> <span class="src-key">if </span><span class="src-sym">(</span><span class="src-key">empty</span><span class="src-sym">(</span><span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id"><a href="class.upload.html#var$image_reflection_opacity">image_reflection_opacity</a></span><span class="src-sym">)) </span><span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id"><a href="class.upload.html#var$image_reflection_opacity">image_reflection_opacity</a> </span>= <span class="src-num">60</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a4337"></a> <span class="src-comm">// create the new destination image</span></div></li> <li><div class="src-line"><a name="a4338"></a> <span class="src-var">$tmp </span>= <span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id">imagecreatenew</span><span class="src-sym">(</span><span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id">image_dst_x</span><span class="src-sym">, </span><span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id">image_dst_y </span>+ <span class="src-var">$image_reflection_height </span>+ <span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id"><a href="class.upload.html#var$image_reflection_space">image_reflection_space</a></span><span class="src-sym">, </span><span class="src-id">true</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a4339"></a> <span class="src-var">$transparency </span>= <span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id"><a href="class.upload.html#var$image_reflection_opacity">image_reflection_opacity</a></span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a4340"></a> </div></li> <li><div class="src-line"><a name="a4341"></a> <span class="src-comm">// copy the original image</span></div></li> <li><div class="src-line"><a name="a4342"></a> <a href="http://www.php.net/imagecopy">imagecopy</a><span class="src-sym">(</span><span class="src-var">$tmp</span><span class="src-sym">, </span><span class="src-var">$image_dst</span><span class="src-sym">, </span><span class="src-num">0</span><span class="src-sym">, </span><span class="src-num">0</span><span class="src-sym">, </span><span class="src-num">0</span><span class="src-sym">, </span><span class="src-num">0</span><span class="src-sym">, </span><span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id">image_dst_x</span><span class="src-sym">, </span><span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id">image_dst_y </span>+ <span class="src-sym">(</span><span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id"><a href="class.upload.html#var$image_reflection_space">image_reflection_space</a> </span>< <span class="src-num">0 </span>? <span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id"><a href="class.upload.html#var$image_reflection_space">image_reflection_space</a> </span>: <span class="src-num">0</span><span class="src-sym">))</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a4343"></a> </div></li> <li><div class="src-line"><a name="a4344"></a> <span class="src-comm">// we have to make sure the extra bit is the right color, or transparent</span></div></li> <li><div class="src-line"><a name="a4345"></a> <span class="src-key">if </span><span class="src-sym">(</span><span class="src-var">$image_reflection_height </span>+ <span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id"><a href="class.upload.html#var$image_reflection_space">image_reflection_space</a> </span>> <span class="src-num">0</span><span class="src-sym">) </span><span class="src-sym">{</span></div></li> <li><div class="src-line"><a name="a4346"></a> <span class="src-comm">// use the background color if present</span></div></li> <li><div class="src-line"><a name="a4347"></a> <span class="src-key">if </span><span class="src-sym">(</span><span class="src-sym">!</span><span class="src-key">empty</span><span class="src-sym">(</span><span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id"><a href="class.upload.html#var$image_background_color">image_background_color</a></span><span class="src-sym">)) </span><span class="src-sym">{</span></div></li> <li><div class="src-line"><a name="a4348"></a> list<span class="src-sym">(</span><span class="src-var">$red</span><span class="src-sym">, </span><span class="src-var">$green</span><span class="src-sym">, </span><span class="src-var">$blue</span><span class="src-sym">) </span>= <span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id">getcolors</span><span class="src-sym">(</span><span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id"><a href="class.upload.html#var$image_background_color">image_background_color</a></span><span class="src-sym">)</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a4349"></a> <span class="src-var">$fill </span>= <a href="http://www.php.net/imagecolorallocate">imagecolorallocate</a><span class="src-sym">(</span><span class="src-var">$tmp</span><span class="src-sym">, </span><span class="src-var">$red</span><span class="src-sym">, </span><span class="src-var">$green</span><span class="src-sym">, </span><span class="src-var">$blue</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a4350"></a> <span class="src-sym">} </span><span class="src-key">else </span><span class="src-sym">{</span></div></li> <li><div class="src-line"><a name="a4351"></a> <span class="src-var">$fill </span>= <a href="http://www.php.net/imagecolorallocatealpha">imagecolorallocatealpha</a><span class="src-sym">(</span><span class="src-var">$tmp</span><span class="src-sym">, </span><span class="src-num">0</span><span class="src-sym">, </span><span class="src-num">0</span><span class="src-sym">, </span><span class="src-num">0</span><span class="src-sym">, </span><span class="src-num">127</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a4352"></a> <span class="src-sym">}</span></div></li> <li><div class="src-line"><a name="a4353"></a> <span class="src-comm">// fill in from the edge of the extra bit</span></div></li> <li><div class="src-line"><a name="a4354"></a> <a href="http://www.php.net/imagefill">imagefill</a><span class="src-sym">(</span><span class="src-var">$tmp</span><span class="src-sym">, </span><a href="http://www.php.net/round">round</a><span class="src-sym">(</span><span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id">image_dst_x </span>/ <span class="src-num">2</span><span class="src-sym">)</span><span class="src-sym">, </span><span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id">image_dst_y </span>+ <span class="src-var">$image_reflection_height </span>+ <span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id"><a href="class.upload.html#var$image_reflection_space">image_reflection_space</a> </span>- <span class="src-num">1</span><span class="src-sym">, </span><span class="src-var">$fill</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a4355"></a> <span class="src-sym">}</span></div></li> <li><div class="src-line"><a name="a4356"></a> </div></li> <li><div class="src-line"><a name="a4357"></a> <span class="src-comm">// copy the reflection</span></div></li> <li><div class="src-line"><a name="a4358"></a> <span class="src-key">for </span><span class="src-sym">(</span><span class="src-var">$y </span>= <span class="src-num">0</span><span class="src-sym">; </span><span class="src-var">$y </span>< <span class="src-var">$image_reflection_height</span><span class="src-sym">; </span><span class="src-var">$y</span>++<span class="src-sym">) </span><span class="src-sym">{</span></div></li> <li><div class="src-line"><a name="a4359"></a> <span class="src-key">for </span><span class="src-sym">(</span><span class="src-var">$x </span>= <span class="src-num">0</span><span class="src-sym">; </span><span class="src-var">$x </span>< <span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id">image_dst_x</span><span class="src-sym">; </span><span class="src-var">$x</span>++<span class="src-sym">) </span><span class="src-sym">{</span></div></li> <li><div class="src-line"><a name="a4360"></a> <span class="src-var">$pixel_b </span>= <a href="http://www.php.net/imagecolorsforindex">imagecolorsforindex</a><span class="src-sym">(</span><span class="src-var">$tmp</span><span class="src-sym">, </span><a href="http://www.php.net/imagecolorat">imagecolorat</a><span class="src-sym">(</span><span class="src-var">$tmp</span><span class="src-sym">, </span><span class="src-var">$x</span><span class="src-sym">, </span><span class="src-var">$y </span>+ <span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id">image_dst_y </span>+ <span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id"><a href="class.upload.html#var$image_reflection_space">image_reflection_space</a></span><span class="src-sym">))</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a4361"></a> <span class="src-var">$pixel_o </span>= <a href="http://www.php.net/imagecolorsforindex">imagecolorsforindex</a><span class="src-sym">(</span><span class="src-var">$image_dst</span><span class="src-sym">, </span><a href="http://www.php.net/imagecolorat">imagecolorat</a><span class="src-sym">(</span><span class="src-var">$image_dst</span><span class="src-sym">, </span><span class="src-var">$x</span><span class="src-sym">, </span><span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id">image_dst_y </span>- <span class="src-var">$y </span>- <span class="src-num">1 </span>+ <span class="src-sym">(</span><span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id"><a href="class.upload.html#var$image_reflection_space">image_reflection_space</a> </span>< <span class="src-num">0 </span>? <span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id"><a href="class.upload.html#var$image_reflection_space">image_reflection_space</a> </span>: <span class="src-num">0</span><span class="src-sym">)))</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a4362"></a> <span class="src-var">$alpha_o </span>= <span class="src-num">1 </span>- <span class="src-sym">(</span><span class="src-var">$pixel_o</span><span class="src-sym">[</span><span class="src-str">'alpha'</span><span class="src-sym">] </span>/ <span class="src-num">127</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a4363"></a> <span class="src-var">$alpha_b </span>= <span class="src-num">1 </span>- <span class="src-sym">(</span><span class="src-var">$pixel_b</span><span class="src-sym">[</span><span class="src-str">'alpha'</span><span class="src-sym">] </span>/ <span class="src-num">127</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a4364"></a> <span class="src-var">$opacity </span>= <span class="src-var">$alpha_o </span>* <span class="src-var">$transparency </span>/ <span class="src-num">100</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a4365"></a> <span class="src-key">if </span><span class="src-sym">(</span><span class="src-var">$opacity </span>> <span class="src-num">0</span><span class="src-sym">) </span><span class="src-sym">{</span></div></li> <li><div class="src-line"><a name="a4366"></a> <span class="src-var">$red </span>= <a href="http://www.php.net/round">round</a><span class="src-sym">(((</span><span class="src-var">$pixel_o</span><span class="src-sym">[</span><span class="src-str">'red'</span><span class="src-sym">] </span>* <span class="src-var">$opacity</span><span class="src-sym">) </span>+ <span class="src-sym">(</span><span class="src-var">$pixel_b</span><span class="src-sym">[</span><span class="src-str">'red'</span><span class="src-sym">] </span><span class="src-sym">) </span>* <span class="src-var">$alpha_b</span><span class="src-sym">) </span>/ <span class="src-sym">(</span><span class="src-var">$alpha_b </span>+ <span class="src-var">$opacity</span><span class="src-sym">))</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a4367"></a> <span class="src-var">$green </span>= <a href="http://www.php.net/round">round</a><span class="src-sym">(((</span><span class="src-var">$pixel_o</span><span class="src-sym">[</span><span class="src-str">'green'</span><span class="src-sym">] </span>* <span class="src-var">$opacity</span><span class="src-sym">) </span>+ <span class="src-sym">(</span><span class="src-var">$pixel_b</span><span class="src-sym">[</span><span class="src-str">'green'</span><span class="src-sym">]</span><span class="src-sym">) </span>* <span class="src-var">$alpha_b</span><span class="src-sym">) </span>/ <span class="src-sym">(</span><span class="src-var">$alpha_b </span>+ <span class="src-var">$opacity</span><span class="src-sym">))</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a4368"></a> <span class="src-var">$blue </span>= <a href="http://www.php.net/round">round</a><span class="src-sym">(((</span><span class="src-var">$pixel_o</span><span class="src-sym">[</span><span class="src-str">'blue'</span><span class="src-sym">] </span>* <span class="src-var">$opacity</span><span class="src-sym">) </span>+ <span class="src-sym">(</span><span class="src-var">$pixel_b</span><span class="src-sym">[</span><span class="src-str">'blue'</span><span class="src-sym">] </span><span class="src-sym">) </span>* <span class="src-var">$alpha_b</span><span class="src-sym">) </span>/ <span class="src-sym">(</span><span class="src-var">$alpha_b </span>+ <span class="src-var">$opacity</span><span class="src-sym">))</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a4369"></a> <span class="src-var">$alpha </span>= <span class="src-sym">(</span><span class="src-var">$opacity </span>+ <span class="src-var">$alpha_b</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a4370"></a> <span class="src-key">if </span><span class="src-sym">(</span><span class="src-var">$alpha </span>> <span class="src-num">1</span><span class="src-sym">) </span><span class="src-var">$alpha </span>= <span class="src-num">1</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a4371"></a> <span class="src-var">$alpha </span>= <a href="http://www.php.net/round">round</a><span class="src-sym">((</span><span class="src-num">1 </span>- <span class="src-var">$alpha</span><span class="src-sym">) </span>* <span class="src-num">127</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a4372"></a> <span class="src-var">$color </span>= <a href="http://www.php.net/imagecolorallocatealpha">imagecolorallocatealpha</a><span class="src-sym">(</span><span class="src-var">$tmp</span><span class="src-sym">, </span><span class="src-var">$red</span><span class="src-sym">, </span><span class="src-var">$green</span><span class="src-sym">, </span><span class="src-var">$blue</span><span class="src-sym">, </span><span class="src-var">$alpha</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a4373"></a> <a href="http://www.php.net/imagesetpixel">imagesetpixel</a><span class="src-sym">(</span><span class="src-var">$tmp</span><span class="src-sym">, </span><span class="src-var">$x</span><span class="src-sym">, </span><span class="src-var">$y </span>+ <span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id">image_dst_y </span>+ <span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id"><a href="class.upload.html#var$image_reflection_space">image_reflection_space</a></span><span class="src-sym">, </span><span class="src-var">$color</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a4374"></a> <span class="src-sym">}</span></div></li> <li><div class="src-line"><a name="a4375"></a> <span class="src-sym">}</span></div></li> <li><div class="src-line"><a name="a4376"></a> <span class="src-key">if </span><span class="src-sym">(</span><span class="src-var">$transparency </span>> <span class="src-num">0</span><span class="src-sym">) </span><span class="src-var">$transparency </span>= <span class="src-var">$transparency </span>- <span class="src-sym">(</span><span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id"><a href="class.upload.html#var$image_reflection_opacity">image_reflection_opacity</a> </span>/ <span class="src-var">$image_reflection_height</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a4377"></a> <span class="src-sym">}</span></div></li> <li><div class="src-line"><a name="a4378"></a> </div></li> <li><div class="src-line"><a name="a4379"></a> <span class="src-comm">// copy the resulting image into the destination image</span></div></li> <li><div class="src-line"><a name="a4380"></a> <span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id">image_dst_y </span>= <span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id">image_dst_y </span>+ <span class="src-var">$image_reflection_height </span>+ <span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id"><a href="class.upload.html#var$image_reflection_space">image_reflection_space</a></span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a4381"></a> <span class="src-var">$image_dst </span>= <span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id">imagetransfer</span><span class="src-sym">(</span><span class="src-var">$tmp</span><span class="src-sym">, </span><span class="src-var">$image_dst</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a4382"></a> <span class="src-sym">}</span></div></li> <li><div class="src-line"><a name="a4383"></a> </div></li> <li><div class="src-line"><a name="a4384"></a> <span class="src-comm">// reduce the JPEG image to a set desired size</span></div></li> <li><div class="src-line"><a name="a4385"></a> <span class="src-key">if </span><span class="src-sym">(</span><a href="http://www.php.net/is_numeric">is_numeric</a><span class="src-sym">(</span><span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id"><a href="class.upload.html#var$jpeg_size">jpeg_size</a></span><span class="src-sym">) </span>&& <span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id"><a href="class.upload.html#var$jpeg_size">jpeg_size</a> </span>> <span class="src-num">0 </span>&& <span class="src-sym">(</span><span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id"><a href="class.upload.html#var$image_convert">image_convert</a> </span>== <span class="src-str">'jpeg' </span>|| <span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id"><a href="class.upload.html#var$image_convert">image_convert</a> </span>== <span class="src-str">'jpg'</span><span class="src-sym">)) </span><span class="src-sym">{</span></div></li> <li><div class="src-line"><a name="a4386"></a> <span class="src-comm">// inspired by: JPEGReducer class version 1, 25 November 2004, Author: Huda M ElMatsani, justhuda at netscape dot net</span></div></li> <li><div class="src-line"><a name="a4387"></a> <span class="src-var">$this</span><span class="src-sym">-></span><a href="http://www.php.net/log">log</a> .= <span class="src-str">'- JPEG desired file size : ' </span>. <span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id"><a href="class.upload.html#var$jpeg_size">jpeg_size</a> </span>. <span class="src-str">'<br />'</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a4388"></a> <span class="src-comm">// calculate size of each image. 75%, 50%, and 25% quality</span></div></li> <li><div class="src-line"><a name="a4389"></a> <a href="http://www.php.net/ob_start">ob_start</a><span class="src-sym">(</span><span class="src-sym">)</span><span class="src-sym">; </span><a href="http://www.php.net/imagejpeg">imagejpeg</a><span class="src-sym">(</span><span class="src-var">$image_dst</span><span class="src-sym">,</span><span class="src-str">''</span><span class="src-sym">,</span><span class="src-num">75</span><span class="src-sym">)</span><span class="src-sym">; </span><span class="src-var">$buffer </span>= <a href="http://www.php.net/ob_get_contents">ob_get_contents</a><span class="src-sym">(</span><span class="src-sym">)</span><span class="src-sym">; </span><a href="http://www.php.net/ob_end_clean">ob_end_clean</a><span class="src-sym">(</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a4390"></a> <span class="src-var">$size75 </span>= <a href="http://www.php.net/strlen">strlen</a><span class="src-sym">(</span><span class="src-var">$buffer</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a4391"></a> <a href="http://www.php.net/ob_start">ob_start</a><span class="src-sym">(</span><span class="src-sym">)</span><span class="src-sym">; </span><a href="http://www.php.net/imagejpeg">imagejpeg</a><span class="src-sym">(</span><span class="src-var">$image_dst</span><span class="src-sym">,</span><span class="src-str">''</span><span class="src-sym">,</span><span class="src-num">50</span><span class="src-sym">)</span><span class="src-sym">; </span><span class="src-var">$buffer </span>= <a href="http://www.php.net/ob_get_contents">ob_get_contents</a><span class="src-sym">(</span><span class="src-sym">)</span><span class="src-sym">; </span><a href="http://www.php.net/ob_end_clean">ob_end_clean</a><span class="src-sym">(</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a4392"></a> <span class="src-var">$size50 </span>= <a href="http://www.php.net/strlen">strlen</a><span class="src-sym">(</span><span class="src-var">$buffer</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a4393"></a> <a href="http://www.php.net/ob_start">ob_start</a><span class="src-sym">(</span><span class="src-sym">)</span><span class="src-sym">; </span><a href="http://www.php.net/imagejpeg">imagejpeg</a><span class="src-sym">(</span><span class="src-var">$image_dst</span><span class="src-sym">,</span><span class="src-str">''</span><span class="src-sym">,</span><span class="src-num">25</span><span class="src-sym">)</span><span class="src-sym">; </span><span class="src-var">$buffer </span>= <a href="http://www.php.net/ob_get_contents">ob_get_contents</a><span class="src-sym">(</span><span class="src-sym">)</span><span class="src-sym">; </span><a href="http://www.php.net/ob_end_clean">ob_end_clean</a><span class="src-sym">(</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a4394"></a> <span class="src-var">$size25 </span>= <a href="http://www.php.net/strlen">strlen</a><span class="src-sym">(</span><span class="src-var">$buffer</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a4395"></a> </div></li> <li><div class="src-line"><a name="a4396"></a> <span class="src-comm">// calculate gradient of size reduction by quality</span></div></li> <li><div class="src-line"><a name="a4397"></a> <span class="src-var">$mgrad1 </span>= <span class="src-num">25 </span>/ <span class="src-sym">(</span><span class="src-var">$size50</span>-<span class="src-var">$size25</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a4398"></a> <span class="src-var">$mgrad2 </span>= <span class="src-num">25 </span>/ <span class="src-sym">(</span><span class="src-var">$size75</span>-<span class="src-var">$size50</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a4399"></a> <span class="src-var">$mgrad3 </span>= <span class="src-num">50 </span>/ <span class="src-sym">(</span><span class="src-var">$size75</span>-<span class="src-var">$size25</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a4400"></a> <span class="src-var">$mgrad </span>= <span class="src-sym">(</span><span class="src-var">$mgrad1 </span>+ <span class="src-var">$mgrad2 </span>+ <span class="src-var">$mgrad3</span><span class="src-sym">) </span>/ <span class="src-num">3</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a4401"></a> <span class="src-comm">// result of approx. quality factor for expected size</span></div></li> <li><div class="src-line"><a name="a4402"></a> <span class="src-var">$q_factor </span>= <a href="http://www.php.net/round">round</a><span class="src-sym">(</span><span class="src-var">$mgrad </span>* <span class="src-sym">(</span><span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id"><a href="class.upload.html#var$jpeg_size">jpeg_size</a> </span>- <span class="src-var">$size50</span><span class="src-sym">) </span>+ <span class="src-num">50</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a4403"></a> </div></li> <li><div class="src-line"><a name="a4404"></a> <span class="src-key">if </span><span class="src-sym">(</span><span class="src-var">$q_factor</span><<span class="src-num">1</span><span class="src-sym">) </span><span class="src-sym">{</span></div></li> <li><div class="src-line"><a name="a4405"></a> <span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id"><a href="class.upload.html#var$jpeg_quality">jpeg_quality</a></span>=<span class="src-num">1</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a4406"></a> <span class="src-sym">} </span><span class="src-key">elseif </span><span class="src-sym">(</span><span class="src-var">$q_factor</span>><span class="src-num">100</span><span class="src-sym">) </span><span class="src-sym">{</span></div></li> <li><div class="src-line"><a name="a4407"></a> <span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id"><a href="class.upload.html#var$jpeg_quality">jpeg_quality</a></span>=<span class="src-num">100</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a4408"></a> <span class="src-sym">} </span><span class="src-key">else </span><span class="src-sym">{</span></div></li> <li><div class="src-line"><a name="a4409"></a> <span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id"><a href="class.upload.html#var$jpeg_quality">jpeg_quality</a></span>=<span class="src-var">$q_factor</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a4410"></a> <span class="src-sym">}</span></div></li> <li><div class="src-line"><a name="a4411"></a> <span class="src-var">$this</span><span class="src-sym">-></span><a href="http://www.php.net/log">log</a> .= <span class="src-str">'&nbsp;&nbsp;&nbsp;&nbsp;JPEG quality factor set to ' </span>. <span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id"><a href="class.upload.html#var$jpeg_quality">jpeg_quality</a> </span>. <span class="src-str">'<br />'</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a4412"></a> <span class="src-sym">}</span></div></li> <li><div class="src-line"><a name="a4413"></a> </div></li> <li><div class="src-line"><a name="a4414"></a> <span class="src-comm">// converts image from true color, and fix transparency if needed</span></div></li> <li><div class="src-line"><a name="a4415"></a> <span class="src-var">$this</span><span class="src-sym">-></span><a href="http://www.php.net/log">log</a> .= <span class="src-str">'- converting...<br />'</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a4416"></a> <span class="src-key">switch</span><span class="src-sym">(</span><span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id"><a href="class.upload.html#var$image_convert">image_convert</a></span><span class="src-sym">) </span><span class="src-sym">{</span></div></li> <li><div class="src-line"><a name="a4417"></a> <span class="src-key">case </span><span class="src-str">'gif'</span>:</div></li> <li><div class="src-line"><a name="a4418"></a> <span class="src-comm">// if the image is true color, we convert it to a palette</span></div></li> <li><div class="src-line"><a name="a4419"></a> <span class="src-key">if </span><span class="src-sym">(</span><a href="http://www.php.net/imageistruecolor">imageistruecolor</a><span class="src-sym">(</span><span class="src-var">$image_dst</span><span class="src-sym">)) </span><span class="src-sym">{</span></div></li> <li><div class="src-line"><a name="a4420"></a> <span class="src-var">$this</span><span class="src-sym">-></span><a href="http://www.php.net/log">log</a> .= <span class="src-str">'&nbsp;&nbsp;&nbsp;&nbsp;true color to palette<br />'</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a4421"></a> <span class="src-comm">// creates a black and white mask</span></div></li> <li><div class="src-line"><a name="a4422"></a> <span class="src-var">$mask </span>= <span class="src-key">array</span><span class="src-sym">(</span><span class="src-key">array</span><span class="src-sym">(</span><span class="src-sym">))</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a4423"></a> <span class="src-key">for </span><span class="src-sym">(</span><span class="src-var">$x </span>= <span class="src-num">0</span><span class="src-sym">; </span><span class="src-var">$x </span>< <span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id">image_dst_x</span><span class="src-sym">; </span><span class="src-var">$x</span>++<span class="src-sym">) </span><span class="src-sym">{</span></div></li> <li><div class="src-line"><a name="a4424"></a> <span class="src-key">for </span><span class="src-sym">(</span><span class="src-var">$y </span>= <span class="src-num">0</span><span class="src-sym">; </span><span class="src-var">$y </span>< <span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id">image_dst_y</span><span class="src-sym">; </span><span class="src-var">$y</span>++<span class="src-sym">) </span><span class="src-sym">{</span></div></li> <li><div class="src-line"><a name="a4425"></a> <span class="src-var">$pixel </span>= <a href="http://www.php.net/imagecolorsforindex">imagecolorsforindex</a><span class="src-sym">(</span><span class="src-var">$image_dst</span><span class="src-sym">, </span><a href="http://www.php.net/imagecolorat">imagecolorat</a><span class="src-sym">(</span><span class="src-var">$image_dst</span><span class="src-sym">, </span><span class="src-var">$x</span><span class="src-sym">, </span><span class="src-var">$y</span><span class="src-sym">))</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a4426"></a> <span class="src-var">$mask</span><span class="src-sym">[</span><span class="src-var">$x</span><span class="src-sym">]</span><span class="src-sym">[</span><span class="src-var">$y</span><span class="src-sym">] </span>= <span class="src-var">$pixel</span><span class="src-sym">[</span><span class="src-str">'alpha'</span><span class="src-sym">]</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a4427"></a> <span class="src-sym">}</span></div></li> <li><div class="src-line"><a name="a4428"></a> <span class="src-sym">}</span></div></li> <li><div class="src-line"><a name="a4429"></a> list<span class="src-sym">(</span><span class="src-var">$red</span><span class="src-sym">, </span><span class="src-var">$green</span><span class="src-sym">, </span><span class="src-var">$blue</span><span class="src-sym">) </span>= <span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id">getcolors</span><span class="src-sym">(</span><span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id"><a href="class.upload.html#var$image_default_color">image_default_color</a></span><span class="src-sym">)</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a4430"></a> <span class="src-comm">// first, we merge the image with the background color, so we know which colors we will have</span></div></li> <li><div class="src-line"><a name="a4431"></a> <span class="src-key">for </span><span class="src-sym">(</span><span class="src-var">$x </span>= <span class="src-num">0</span><span class="src-sym">; </span><span class="src-var">$x </span>< <span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id">image_dst_x</span><span class="src-sym">; </span><span class="src-var">$x</span>++<span class="src-sym">) </span><span class="src-sym">{</span></div></li> <li><div class="src-line"><a name="a4432"></a> <span class="src-key">for </span><span class="src-sym">(</span><span class="src-var">$y </span>= <span class="src-num">0</span><span class="src-sym">; </span><span class="src-var">$y </span>< <span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id">image_dst_y</span><span class="src-sym">; </span><span class="src-var">$y</span>++<span class="src-sym">) </span><span class="src-sym">{</span></div></li> <li><div class="src-line"><a name="a4433"></a> <span class="src-key">if </span><span class="src-sym">(</span><span class="src-var">$mask</span><span class="src-sym">[</span><span class="src-var">$x</span><span class="src-sym">]</span><span class="src-sym">[</span><span class="src-var">$y</span><span class="src-sym">] </span>> <span class="src-num">0</span><span class="src-sym">)</span><span class="src-sym">{</span></div></li> <li><div class="src-line"><a name="a4434"></a> <span class="src-comm">// we have some transparency. we combine the color with the default color</span></div></li> <li><div class="src-line"><a name="a4435"></a> <span class="src-var">$pixel </span>= <a href="http://www.php.net/imagecolorsforindex">imagecolorsforindex</a><span class="src-sym">(</span><span class="src-var">$image_dst</span><span class="src-sym">, </span><a href="http://www.php.net/imagecolorat">imagecolorat</a><span class="src-sym">(</span><span class="src-var">$image_dst</span><span class="src-sym">, </span><span class="src-var">$x</span><span class="src-sym">, </span><span class="src-var">$y</span><span class="src-sym">))</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a4436"></a> <span class="src-var">$alpha </span>= <span class="src-sym">(</span><span class="src-var">$mask</span><span class="src-sym">[</span><span class="src-var">$x</span><span class="src-sym">]</span><span class="src-sym">[</span><span class="src-var">$y</span><span class="src-sym">] </span>/ <span class="src-num">127</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a4437"></a> <span class="src-var">$pixel</span><span class="src-sym">[</span><span class="src-str">'red'</span><span class="src-sym">] </span>= <a href="http://www.php.net/round">round</a><span class="src-sym">((</span><span class="src-var">$pixel</span><span class="src-sym">[</span><span class="src-str">'red'</span><span class="src-sym">] </span>* <span class="src-sym">(</span><span class="src-num">1 </span>-<span class="src-var">$alpha</span><span class="src-sym">) </span>+ <span class="src-var">$red </span>* <span class="src-sym">(</span><span class="src-var">$alpha</span><span class="src-sym">)))</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a4438"></a> <span class="src-var">$pixel</span><span class="src-sym">[</span><span class="src-str">'green'</span><span class="src-sym">] </span>= <a href="http://www.php.net/round">round</a><span class="src-sym">((</span><span class="src-var">$pixel</span><span class="src-sym">[</span><span class="src-str">'green'</span><span class="src-sym">] </span>* <span class="src-sym">(</span><span class="src-num">1 </span>-<span class="src-var">$alpha</span><span class="src-sym">) </span>+ <span class="src-var">$green </span>* <span class="src-sym">(</span><span class="src-var">$alpha</span><span class="src-sym">)))</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a4439"></a> <span class="src-var">$pixel</span><span class="src-sym">[</span><span class="src-str">'blue'</span><span class="src-sym">] </span>= <a href="http://www.php.net/round">round</a><span class="src-sym">((</span><span class="src-var">$pixel</span><span class="src-sym">[</span><span class="src-str">'blue'</span><span class="src-sym">] </span>* <span class="src-sym">(</span><span class="src-num">1 </span>-<span class="src-var">$alpha</span><span class="src-sym">) </span>+ <span class="src-var">$blue </span>* <span class="src-sym">(</span><span class="src-var">$alpha</span><span class="src-sym">)))</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a4440"></a> <span class="src-var">$color </span>= <a href="http://www.php.net/imagecolorallocate">imagecolorallocate</a><span class="src-sym">(</span><span class="src-var">$image_dst</span><span class="src-sym">, </span><span class="src-var">$pixel</span><span class="src-sym">[</span><span class="src-str">'red'</span><span class="src-sym">]</span><span class="src-sym">, </span><span class="src-var">$pixel</span><span class="src-sym">[</span><span class="src-str">'green'</span><span class="src-sym">]</span><span class="src-sym">, </span><span class="src-var">$pixel</span><span class="src-sym">[</span><span class="src-str">'blue'</span><span class="src-sym">]</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a4441"></a> <a href="http://www.php.net/imagesetpixel">imagesetpixel</a><span class="src-sym">(</span><span class="src-var">$image_dst</span><span class="src-sym">, </span><span class="src-var">$x</span><span class="src-sym">, </span><span class="src-var">$y</span><span class="src-sym">, </span><span class="src-var">$color</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a4442"></a> <span class="src-sym">}</span></div></li> <li><div class="src-line"><a name="a4443"></a> <span class="src-sym">}</span></div></li> <li><div class="src-line"><a name="a4444"></a> <span class="src-sym">}</span></div></li> <li><div class="src-line"><a name="a4445"></a> <span class="src-comm">// transfrom the true color image into palette, with it merged default color in</span></div></li> <li><div class="src-line"><a name="a4446"></a> <span class="src-comm">// we will have the best color possible, including the background</span></div></li> <li><div class="src-line"><a name="a4447"></a> <span class="src-key">if </span><span class="src-sym">(</span><span class="src-key">empty</span><span class="src-sym">(</span><span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id"><a href="class.upload.html#var$image_background_color">image_background_color</a></span><span class="src-sym">)) </span><span class="src-sym">{</span></div></li> <li><div class="src-line"><a name="a4448"></a> <a href="http://www.php.net/imagetruecolortopalette">imagetruecolortopalette</a><span class="src-sym">(</span><span class="src-var">$image_dst</span><span class="src-sym">, </span><span class="src-id">true</span><span class="src-sym">, </span><span class="src-num">255</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a4449"></a> <span class="src-var">$transparency </span>= <a href="http://www.php.net/imagecolorallocate">imagecolorallocate</a><span class="src-sym">(</span><span class="src-var">$image_dst</span><span class="src-sym">, </span><span class="src-num">254</span><span class="src-sym">, </span><span class="src-num">1</span><span class="src-sym">, </span><span class="src-num">253</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a4450"></a> <a href="http://www.php.net/imagecolortransparent">imagecolortransparent</a><span class="src-sym">(</span><span class="src-var">$image_dst</span><span class="src-sym">, </span><span class="src-var">$transparency</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a4451"></a> <span class="src-comm">// make the transparent areas transparent</span></div></li> <li><div class="src-line"><a name="a4452"></a> <span class="src-key">for </span><span class="src-sym">(</span><span class="src-var">$x </span>= <span class="src-num">0</span><span class="src-sym">; </span><span class="src-var">$x </span>< <span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id">image_dst_x</span><span class="src-sym">; </span><span class="src-var">$x</span>++<span class="src-sym">) </span><span class="src-sym">{</span></div></li> <li><div class="src-line"><a name="a4453"></a> <span class="src-key">for </span><span class="src-sym">(</span><span class="src-var">$y </span>= <span class="src-num">0</span><span class="src-sym">; </span><span class="src-var">$y </span>< <span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id">image_dst_y</span><span class="src-sym">; </span><span class="src-var">$y</span>++<span class="src-sym">) </span><span class="src-sym">{</span></div></li> <li><div class="src-line"><a name="a4454"></a> <span class="src-comm">// we test wether we have enough opacity to justify keeping the color</span></div></li> <li><div class="src-line"><a name="a4455"></a> <span class="src-key">if </span><span class="src-sym">(</span><span class="src-var">$mask</span><span class="src-sym">[</span><span class="src-var">$x</span><span class="src-sym">]</span><span class="src-sym">[</span><span class="src-var">$y</span><span class="src-sym">] </span>> <span class="src-num">120</span><span class="src-sym">) </span><a href="http://www.php.net/imagesetpixel">imagesetpixel</a><span class="src-sym">(</span><span class="src-var">$image_dst</span><span class="src-sym">, </span><span class="src-var">$x</span><span class="src-sym">, </span><span class="src-var">$y</span><span class="src-sym">, </span><span class="src-var">$transparency</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a4456"></a> <span class="src-sym">}</span></div></li> <li><div class="src-line"><a name="a4457"></a> <span class="src-sym">}</span></div></li> <li><div class="src-line"><a name="a4458"></a> <span class="src-sym">}</span></div></li> <li><div class="src-line"><a name="a4459"></a> unset<span class="src-sym">(</span><span class="src-var">$mask</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a4460"></a> <span class="src-sym">}</span></div></li> <li><div class="src-line"><a name="a4461"></a> <span class="src-key">break</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a4462"></a> <span class="src-key">case </span><span class="src-str">'jpg'</span>:</div></li> <li><div class="src-line"><a name="a4463"></a> <span class="src-key">case </span><span class="src-str">'bmp'</span>:</div></li> <li><div class="src-line"><a name="a4464"></a> <span class="src-comm">// if the image doesn't support any transparency, then we merge it with the default color</span></div></li> <li><div class="src-line"><a name="a4465"></a> <span class="src-var">$this</span><span class="src-sym">-></span><a href="http://www.php.net/log">log</a> .= <span class="src-str">'&nbsp;&nbsp;&nbsp;&nbsp;fills in transparency with default color<br />'</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a4466"></a> list<span class="src-sym">(</span><span class="src-var">$red</span><span class="src-sym">, </span><span class="src-var">$green</span><span class="src-sym">, </span><span class="src-var">$blue</span><span class="src-sym">) </span>= <span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id">getcolors</span><span class="src-sym">(</span><span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id"><a href="class.upload.html#var$image_default_color">image_default_color</a></span><span class="src-sym">)</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a4467"></a> <span class="src-var">$transparency </span>= <a href="http://www.php.net/imagecolorallocate">imagecolorallocate</a><span class="src-sym">(</span><span class="src-var">$image_dst</span><span class="src-sym">, </span><span class="src-var">$red</span><span class="src-sym">, </span><span class="src-var">$green</span><span class="src-sym">, </span><span class="src-var">$blue</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a4468"></a> <span class="src-comm">// make the transaparent areas transparent</span></div></li> <li><div class="src-line"><a name="a4469"></a> <span class="src-key">for </span><span class="src-sym">(</span><span class="src-var">$x </span>= <span class="src-num">0</span><span class="src-sym">; </span><span class="src-var">$x </span>< <span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id">image_dst_x</span><span class="src-sym">; </span><span class="src-var">$x</span>++<span class="src-sym">) </span><span class="src-sym">{</span></div></li> <li><div class="src-line"><a name="a4470"></a> <span class="src-key">for </span><span class="src-sym">(</span><span class="src-var">$y </span>= <span class="src-num">0</span><span class="src-sym">; </span><span class="src-var">$y </span>< <span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id">image_dst_y</span><span class="src-sym">; </span><span class="src-var">$y</span>++<span class="src-sym">) </span><span class="src-sym">{</span></div></li> <li><div class="src-line"><a name="a4471"></a> <span class="src-comm">// we test wether we have some transparency, in which case we will merge the colors</span></div></li> <li><div class="src-line"><a name="a4472"></a> <span class="src-key">if </span><span class="src-sym">(</span><a href="http://www.php.net/imageistruecolor">imageistruecolor</a><span class="src-sym">(</span><span class="src-var">$image_dst</span><span class="src-sym">)) </span><span class="src-sym">{</span></div></li> <li><div class="src-line"><a name="a4473"></a> <span class="src-var">$rgba </span>= <a href="http://www.php.net/imagecolorat">imagecolorat</a><span class="src-sym">(</span><span class="src-var">$image_dst</span><span class="src-sym">, </span><span class="src-var">$x</span><span class="src-sym">, </span><span class="src-var">$y</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a4474"></a> <span class="src-var">$pixel </span>= <span class="src-key">array</span><span class="src-sym">(</span><span class="src-str">'red' </span>=> <span class="src-sym">(</span><span class="src-var">$rgba </span>>> <span class="src-num">16</span><span class="src-sym">) </span><span class="src-sym">& </span><span class="src-num">0xFF</span><span class="src-sym">,</span></div></li> <li><div class="src-line"><a name="a4475"></a> <span class="src-str">'green' </span>=> <span class="src-sym">(</span><span class="src-var">$rgba </span>>> <span class="src-num">8</span><span class="src-sym">) </span><span class="src-sym">& </span><span class="src-num">0xFF</span><span class="src-sym">,</span></div></li> <li><div class="src-line"><a name="a4476"></a> <span class="src-str">'blue' </span>=> <span class="src-var">$rgba </span><span class="src-sym">& </span><span class="src-num">0xFF</span><span class="src-sym">,</span></div></li> <li><div class="src-line"><a name="a4477"></a> <span class="src-str">'alpha' </span>=> <span class="src-sym">(</span><span class="src-var">$rgba </span><span class="src-sym">& </span><span class="src-num">0x7F000000</span><span class="src-sym">) </span>>> <span class="src-num">24</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a4478"></a> <span class="src-sym">} </span><span class="src-key">else </span><span class="src-sym">{</span></div></li> <li><div class="src-line"><a name="a4479"></a> <span class="src-var">$pixel </span>= <a href="http://www.php.net/imagecolorsforindex">imagecolorsforindex</a><span class="src-sym">(</span><span class="src-var">$image_dst</span><span class="src-sym">, </span><a href="http://www.php.net/imagecolorat">imagecolorat</a><span class="src-sym">(</span><span class="src-var">$image_dst</span><span class="src-sym">, </span><span class="src-var">$x</span><span class="src-sym">, </span><span class="src-var">$y</span><span class="src-sym">))</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a4480"></a> <span class="src-sym">}</span></div></li> <li><div class="src-line"><a name="a4481"></a> <span class="src-key">if </span><span class="src-sym">(</span><span class="src-var">$pixel</span><span class="src-sym">[</span><span class="src-str">'alpha'</span><span class="src-sym">] </span>== <span class="src-num">127</span><span class="src-sym">) </span><span class="src-sym">{</span></div></li> <li><div class="src-line"><a name="a4482"></a> <span class="src-comm">// we have full transparency. we make the pixel transparent</span></div></li> <li><div class="src-line"><a name="a4483"></a> <a href="http://www.php.net/imagesetpixel">imagesetpixel</a><span class="src-sym">(</span><span class="src-var">$image_dst</span><span class="src-sym">, </span><span class="src-var">$x</span><span class="src-sym">, </span><span class="src-var">$y</span><span class="src-sym">, </span><span class="src-var">$transparency</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a4484"></a> <span class="src-sym">} </span><span class="src-key">else </span><span class="src-key">if </span><span class="src-sym">(</span><span class="src-var">$pixel</span><span class="src-sym">[</span><span class="src-str">'alpha'</span><span class="src-sym">] </span>> <span class="src-num">0</span><span class="src-sym">) </span><span class="src-sym">{</span></div></li> <li><div class="src-line"><a name="a4485"></a> <span class="src-comm">// we have some transparency. we combine the color with the default color</span></div></li> <li><div class="src-line"><a name="a4486"></a> <span class="src-var">$alpha </span>= <span class="src-sym">(</span><span class="src-var">$pixel</span><span class="src-sym">[</span><span class="src-str">'alpha'</span><span class="src-sym">] </span>/ <span class="src-num">127</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a4487"></a> <span class="src-var">$pixel</span><span class="src-sym">[</span><span class="src-str">'red'</span><span class="src-sym">] </span>= <a href="http://www.php.net/round">round</a><span class="src-sym">((</span><span class="src-var">$pixel</span><span class="src-sym">[</span><span class="src-str">'red'</span><span class="src-sym">] </span>* <span class="src-sym">(</span><span class="src-num">1 </span>-<span class="src-var">$alpha</span><span class="src-sym">) </span>+ <span class="src-var">$red </span>* <span class="src-sym">(</span><span class="src-var">$alpha</span><span class="src-sym">)))</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a4488"></a> <span class="src-var">$pixel</span><span class="src-sym">[</span><span class="src-str">'green'</span><span class="src-sym">] </span>= <a href="http://www.php.net/round">round</a><span class="src-sym">((</span><span class="src-var">$pixel</span><span class="src-sym">[</span><span class="src-str">'green'</span><span class="src-sym">] </span>* <span class="src-sym">(</span><span class="src-num">1 </span>-<span class="src-var">$alpha</span><span class="src-sym">) </span>+ <span class="src-var">$green </span>* <span class="src-sym">(</span><span class="src-var">$alpha</span><span class="src-sym">)))</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a4489"></a> <span class="src-var">$pixel</span><span class="src-sym">[</span><span class="src-str">'blue'</span><span class="src-sym">] </span>= <a href="http://www.php.net/round">round</a><span class="src-sym">((</span><span class="src-var">$pixel</span><span class="src-sym">[</span><span class="src-str">'blue'</span><span class="src-sym">] </span>* <span class="src-sym">(</span><span class="src-num">1 </span>-<span class="src-var">$alpha</span><span class="src-sym">) </span>+ <span class="src-var">$blue </span>* <span class="src-sym">(</span><span class="src-var">$alpha</span><span class="src-sym">)))</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a4490"></a> <span class="src-var">$color </span>= <a href="http://www.php.net/imagecolorclosest">imagecolorclosest</a><span class="src-sym">(</span><span class="src-var">$image_dst</span><span class="src-sym">, </span><span class="src-var">$pixel</span><span class="src-sym">[</span><span class="src-str">'red'</span><span class="src-sym">]</span><span class="src-sym">, </span><span class="src-var">$pixel</span><span class="src-sym">[</span><span class="src-str">'green'</span><span class="src-sym">]</span><span class="src-sym">, </span><span class="src-var">$pixel</span><span class="src-sym">[</span><span class="src-str">'blue'</span><span class="src-sym">]</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a4491"></a> <a href="http://www.php.net/imagesetpixel">imagesetpixel</a><span class="src-sym">(</span><span class="src-var">$image_dst</span><span class="src-sym">, </span><span class="src-var">$x</span><span class="src-sym">, </span><span class="src-var">$y</span><span class="src-sym">, </span><span class="src-var">$color</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a4492"></a> <span class="src-sym">}</span></div></li> <li><div class="src-line"><a name="a4493"></a> <span class="src-sym">}</span></div></li> <li><div class="src-line"><a name="a4494"></a> <span class="src-sym">}</span></div></li> <li><div class="src-line"><a name="a4495"></a> </div></li> <li><div class="src-line"><a name="a4496"></a> <span class="src-key">break</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a4497"></a> <span class="src-key">default</span>:</div></li> <li><div class="src-line"><a name="a4498"></a> <span class="src-key">break</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a4499"></a> <span class="src-sym">}</span></div></li> <li><div class="src-line"><a name="a4500"></a> </div></li> <li><div class="src-line"><a name="a4501"></a> <span class="src-comm">// outputs image</span></div></li> <li><div class="src-line"><a name="a4502"></a> <span class="src-var">$this</span><span class="src-sym">-></span><a href="http://www.php.net/log">log</a> .= <span class="src-str">'- saving image...<br />'</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a4503"></a> <span class="src-key">switch</span><span class="src-sym">(</span><span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id"><a href="class.upload.html#var$image_convert">image_convert</a></span><span class="src-sym">) </span><span class="src-sym">{</span></div></li> <li><div class="src-line"><a name="a4504"></a> <span class="src-key">case </span><span class="src-str">'jpeg'</span>:</div></li> <li><div class="src-line"><a name="a4505"></a> <span class="src-key">case </span><span class="src-str">'jpg'</span>:</div></li> <li><div class="src-line"><a name="a4506"></a> <span class="src-key">if </span><span class="src-sym">(</span><span class="src-sym">!</span><span class="src-var">$return_mode</span><span class="src-sym">) </span><span class="src-sym">{</span></div></li> <li><div class="src-line"><a name="a4507"></a> <span class="src-var">$result </span>= <span class="src-sym">@</span><a href="http://www.php.net/imagejpeg">imagejpeg</a><span class="src-sym">(</span><span class="src-var">$image_dst</span><span class="src-sym">, </span><span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id">file_dst_pathname</span><span class="src-sym">, </span><span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id"><a href="class.upload.html#var$jpeg_quality">jpeg_quality</a></span><span class="src-sym">)</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a4508"></a> <span class="src-sym">} </span><span class="src-key">else </span><span class="src-sym">{</span></div></li> <li><div class="src-line"><a name="a4509"></a> <a href="http://www.php.net/ob_start">ob_start</a><span class="src-sym">(</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a4510"></a> <span class="src-var">$result </span>= <span class="src-sym">@</span><a href="http://www.php.net/imagejpeg">imagejpeg</a><span class="src-sym">(</span><span class="src-var">$image_dst</span><span class="src-sym">, </span><span class="src-str">''</span><span class="src-sym">, </span><span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id"><a href="class.upload.html#var$jpeg_quality">jpeg_quality</a></span><span class="src-sym">)</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a4511"></a> <span class="src-var">$return_content </span>= <a href="http://www.php.net/ob_get_contents">ob_get_contents</a><span class="src-sym">(</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a4512"></a> <a href="http://www.php.net/ob_end_clean">ob_end_clean</a><span class="src-sym">(</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a4513"></a> <span class="src-sym">}</span></div></li> <li><div class="src-line"><a name="a4514"></a> <span class="src-key">if </span><span class="src-sym">(</span><span class="src-sym">!</span><span class="src-var">$result</span><span class="src-sym">) </span><span class="src-sym">{</span></div></li> <li><div class="src-line"><a name="a4515"></a> <span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id"><a href="class.upload.html#var$processed">processed</a> </span>= <span class="src-id">false</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a4516"></a> <span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id"><a href="class.upload.html#var$error">error</a> </span>= <span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id">translate</span><span class="src-sym">(</span><span class="src-str">'file_create'</span><span class="src-sym">, </span><span class="src-key">array</span><span class="src-sym">(</span><span class="src-str">'JPEG'</span><span class="src-sym">))</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a4517"></a> <span class="src-sym">} </span><span class="src-key">else </span><span class="src-sym">{</span></div></li> <li><div class="src-line"><a name="a4518"></a> <span class="src-var">$this</span><span class="src-sym">-></span><a href="http://www.php.net/log">log</a> .= <span class="src-str">'&nbsp;&nbsp;&nbsp;&nbsp;JPEG image created<br />'</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a4519"></a> <span class="src-sym">}</span></div></li> <li><div class="src-line"><a name="a4520"></a> <span class="src-key">break</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a4521"></a> <span class="src-key">case </span><span class="src-str">'png'</span>:</div></li> <li><div class="src-line"><a name="a4522"></a> <a href="http://www.php.net/imagealphablending">imagealphablending</a><span class="src-sym">( </span><span class="src-var">$image_dst</span><span class="src-sym">, </span><span class="src-id">false </span><span class="src-sym">)</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a4523"></a> <a href="http://www.php.net/imagesavealpha">imagesavealpha</a><span class="src-sym">( </span><span class="src-var">$image_dst</span><span class="src-sym">, </span><span class="src-id">true </span><span class="src-sym">)</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a4524"></a> <span class="src-key">if </span><span class="src-sym">(</span><span class="src-sym">!</span><span class="src-var">$return_mode</span><span class="src-sym">) </span><span class="src-sym">{</span></div></li> <li><div class="src-line"><a name="a4525"></a> <span class="src-var">$result </span>= <span class="src-sym">@</span><a href="http://www.php.net/imagepng">imagepng</a><span class="src-sym">(</span><span class="src-var">$image_dst</span><span class="src-sym">, </span><span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id">file_dst_pathname</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a4526"></a> <span class="src-sym">} </span><span class="src-key">else </span><span class="src-sym">{</span></div></li> <li><div class="src-line"><a name="a4527"></a> <a href="http://www.php.net/ob_start">ob_start</a><span class="src-sym">(</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a4528"></a> <span class="src-var">$result </span>= <span class="src-sym">@</span><a href="http://www.php.net/imagepng">imagepng</a><span class="src-sym">(</span><span class="src-var">$image_dst</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a4529"></a> <span class="src-var">$return_content </span>= <a href="http://www.php.net/ob_get_contents">ob_get_contents</a><span class="src-sym">(</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a4530"></a> <a href="http://www.php.net/ob_end_clean">ob_end_clean</a><span class="src-sym">(</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a4531"></a> <span class="src-sym">}</span></div></li> <li><div class="src-line"><a name="a4532"></a> <span class="src-key">if </span><span class="src-sym">(</span><span class="src-sym">!</span><span class="src-var">$result</span><span class="src-sym">) </span><span class="src-sym">{</span></div></li> <li><div class="src-line"><a name="a4533"></a> <span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id"><a href="class.upload.html#var$processed">processed</a> </span>= <span class="src-id">false</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a4534"></a> <span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id"><a href="class.upload.html#var$error">error</a> </span>= <span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id">translate</span><span class="src-sym">(</span><span class="src-str">'file_create'</span><span class="src-sym">, </span><span class="src-key">array</span><span class="src-sym">(</span><span class="src-str">'PNG'</span><span class="src-sym">))</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a4535"></a> <span class="src-sym">} </span><span class="src-key">else </span><span class="src-sym">{</span></div></li> <li><div class="src-line"><a name="a4536"></a> <span class="src-var">$this</span><span class="src-sym">-></span><a href="http://www.php.net/log">log</a> .= <span class="src-str">'&nbsp;&nbsp;&nbsp;&nbsp;PNG image created<br />'</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a4537"></a> <span class="src-sym">}</span></div></li> <li><div class="src-line"><a name="a4538"></a> <span class="src-key">break</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a4539"></a> <span class="src-key">case </span><span class="src-str">'gif'</span>:</div></li> <li><div class="src-line"><a name="a4540"></a> <span class="src-key">if </span><span class="src-sym">(</span><span class="src-sym">!</span><span class="src-var">$return_mode</span><span class="src-sym">) </span><span class="src-sym">{</span></div></li> <li><div class="src-line"><a name="a4541"></a> <span class="src-var">$result </span>= <span class="src-sym">@</span><a href="http://www.php.net/imagegif">imagegif</a><span class="src-sym">(</span><span class="src-var">$image_dst</span><span class="src-sym">, </span><span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id">file_dst_pathname</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a4542"></a> <span class="src-sym">} </span><span class="src-key">else </span><span class="src-sym">{</span></div></li> <li><div class="src-line"><a name="a4543"></a> <a href="http://www.php.net/ob_start">ob_start</a><span class="src-sym">(</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a4544"></a> <span class="src-var">$result </span>= <span class="src-sym">@</span><a href="http://www.php.net/imagegif">imagegif</a><span class="src-sym">(</span><span class="src-var">$image_dst</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a4545"></a> <span class="src-var">$return_content </span>= <a href="http://www.php.net/ob_get_contents">ob_get_contents</a><span class="src-sym">(</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a4546"></a> <a href="http://www.php.net/ob_end_clean">ob_end_clean</a><span class="src-sym">(</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a4547"></a> <span class="src-sym">}</span></div></li> <li><div class="src-line"><a name="a4548"></a> <span class="src-key">if </span><span class="src-sym">(</span><span class="src-sym">!</span><span class="src-var">$result</span><span class="src-sym">) </span><span class="src-sym">{</span></div></li> <li><div class="src-line"><a name="a4549"></a> <span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id"><a href="class.upload.html#var$processed">processed</a> </span>= <span class="src-id">false</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a4550"></a> <span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id"><a href="class.upload.html#var$error">error</a> </span>= <span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id">translate</span><span class="src-sym">(</span><span class="src-str">'file_create'</span><span class="src-sym">, </span><span class="src-key">array</span><span class="src-sym">(</span><span class="src-str">'GIF'</span><span class="src-sym">))</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a4551"></a> <span class="src-sym">} </span><span class="src-key">else </span><span class="src-sym">{</span></div></li> <li><div class="src-line"><a name="a4552"></a> <span class="src-var">$this</span><span class="src-sym">-></span><a href="http://www.php.net/log">log</a> .= <span class="src-str">'&nbsp;&nbsp;&nbsp;&nbsp;GIF image created<br />'</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a4553"></a> <span class="src-sym">}</span></div></li> <li><div class="src-line"><a name="a4554"></a> <span class="src-key">break</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a4555"></a> <span class="src-key">case </span><span class="src-str">'bmp'</span>:</div></li> <li><div class="src-line"><a name="a4556"></a> <span class="src-key">if </span><span class="src-sym">(</span><span class="src-sym">!</span><span class="src-var">$return_mode</span><span class="src-sym">) </span><span class="src-sym">{</span></div></li> <li><div class="src-line"><a name="a4557"></a> <span class="src-var">$result </span>= <span class="src-var">$this</span><span class="src-sym">-></span><a href="class.upload.html#methodimagebmp">imagebmp</a><span class="src-sym">(</span><span class="src-var">$image_dst</span><span class="src-sym">, </span><span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id">file_dst_pathname</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a4558"></a> <span class="src-sym">} </span><span class="src-key">else </span><span class="src-sym">{</span></div></li> <li><div class="src-line"><a name="a4559"></a> <a href="http://www.php.net/ob_start">ob_start</a><span class="src-sym">(</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a4560"></a> <span class="src-var">$result </span>= <span class="src-var">$this</span><span class="src-sym">-></span><a href="class.upload.html#methodimagebmp">imagebmp</a><span class="src-sym">(</span><span class="src-var">$image_dst</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a4561"></a> <span class="src-var">$return_content </span>= <a href="http://www.php.net/ob_get_contents">ob_get_contents</a><span class="src-sym">(</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a4562"></a> <a href="http://www.php.net/ob_end_clean">ob_end_clean</a><span class="src-sym">(</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a4563"></a> <span class="src-sym">}</span></div></li> <li><div class="src-line"><a name="a4564"></a> <span class="src-key">if </span><span class="src-sym">(</span><span class="src-sym">!</span><span class="src-var">$result</span><span class="src-sym">) </span><span class="src-sym">{</span></div></li> <li><div class="src-line"><a name="a4565"></a> <span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id"><a href="class.upload.html#var$processed">processed</a> </span>= <span class="src-id">false</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a4566"></a> <span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id"><a href="class.upload.html#var$error">error</a> </span>= <span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id">translate</span><span class="src-sym">(</span><span class="src-str">'file_create'</span><span class="src-sym">, </span><span class="src-key">array</span><span class="src-sym">(</span><span class="src-str">'BMP'</span><span class="src-sym">))</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a4567"></a> <span class="src-sym">} </span><span class="src-key">else </span><span class="src-sym">{</span></div></li> <li><div class="src-line"><a name="a4568"></a> <span class="src-var">$this</span><span class="src-sym">-></span><a href="http://www.php.net/log">log</a> .= <span class="src-str">'&nbsp;&nbsp;&nbsp;&nbsp;BMP image created<br />'</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a4569"></a> <span class="src-sym">}</span></div></li> <li><div class="src-line"><a name="a4570"></a> <span class="src-key">break</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a4571"></a> </div></li> <li><div class="src-line"><a name="a4572"></a> <span class="src-key">default</span>:</div></li> <li><div class="src-line"><a name="a4573"></a> <span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id"><a href="class.upload.html#var$processed">processed</a> </span>= <span class="src-id">false</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a4574"></a> <span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id"><a href="class.upload.html#var$error">error</a> </span>= <span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id">translate</span><span class="src-sym">(</span><span class="src-str">'no_conversion_type'</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a4575"></a> <span class="src-sym">}</span></div></li> <li><div class="src-line"><a name="a4576"></a> <span class="src-key">if </span><span class="src-sym">(</span><span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id"><a href="class.upload.html#var$processed">processed</a></span><span class="src-sym">) </span><span class="src-sym">{</span></div></li> <li><div class="src-line"><a name="a4577"></a> <span class="src-key">if </span><span class="src-sym">(</span><a href="http://www.php.net/is_resource">is_resource</a><span class="src-sym">(</span><span class="src-var">$image_src</span><span class="src-sym">)) </span><a href="http://www.php.net/imagedestroy">imagedestroy</a><span class="src-sym">(</span><span class="src-var">$image_src</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a4578"></a> <span class="src-key">if </span><span class="src-sym">(</span><a href="http://www.php.net/is_resource">is_resource</a><span class="src-sym">(</span><span class="src-var">$image_dst</span><span class="src-sym">)) </span><a href="http://www.php.net/imagedestroy">imagedestroy</a><span class="src-sym">(</span><span class="src-var">$image_dst</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a4579"></a> <span class="src-var">$this</span><span class="src-sym">-></span><a href="http://www.php.net/log">log</a> .= <span class="src-str">'&nbsp;&nbsp;&nbsp;&nbsp;image objects destroyed<br />'</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a4580"></a> <span class="src-sym">}</span></div></li> <li><div class="src-line"><a name="a4581"></a> <span class="src-sym">}</span></div></li> <li><div class="src-line"><a name="a4582"></a> </div></li> <li><div class="src-line"><a name="a4583"></a> <span class="src-sym">} </span><span class="src-key">else </span><span class="src-sym">{</span></div></li> <li><div class="src-line"><a name="a4584"></a> <span class="src-var">$this</span><span class="src-sym">-></span><a href="http://www.php.net/log">log</a> .= <span class="src-str">'- no image processing wanted<br />'</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a4585"></a> </div></li> <li><div class="src-line"><a name="a4586"></a> <span class="src-key">if </span><span class="src-sym">(</span><span class="src-sym">!</span><span class="src-var">$return_mode</span><span class="src-sym">) </span><span class="src-sym">{</span></div></li> <li><div class="src-line"><a name="a4587"></a> <span class="src-comm">// copy the file to its final destination. we don't use move_uploaded_file here</span></div></li> <li><div class="src-line"><a name="a4588"></a> <span class="src-comm">// if we happen to have open_basedir restrictions, it is a temp file that we copy, not the original uploaded file</span></div></li> <li><div class="src-line"><a name="a4589"></a> <span class="src-key">if </span><span class="src-sym">(</span><span class="src-sym">!</span><a href="http://www.php.net/copy">copy</a><span class="src-sym">(</span><span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id">file_src_pathname</span><span class="src-sym">, </span><span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id">file_dst_pathname</span><span class="src-sym">)) </span><span class="src-sym">{</span></div></li> <li><div class="src-line"><a name="a4590"></a> <span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id"><a href="class.upload.html#var$processed">processed</a> </span>= <span class="src-id">false</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a4591"></a> <span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id"><a href="class.upload.html#var$error">error</a> </span>= <span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id">translate</span><span class="src-sym">(</span><span class="src-str">'copy_failed'</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a4592"></a> <span class="src-sym">}</span></div></li> <li><div class="src-line"><a name="a4593"></a> <span class="src-sym">} </span><span class="src-key">else </span><span class="src-sym">{</span></div></li> <li><div class="src-line"><a name="a4594"></a> <span class="src-comm">// returns the file, so that its content can be received by the caller</span></div></li> <li><div class="src-line"><a name="a4595"></a> <span class="src-var">$return_content </span>= <span class="src-sym">@</span><a href="http://www.php.net/file_get_contents">file_get_contents</a><span class="src-sym">(</span><span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id">file_src_pathname</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a4596"></a> <span class="src-key">if </span><span class="src-sym">(</span><span class="src-var">$return_content </span>=== <span class="src-id">FALSE</span><span class="src-sym">) </span><span class="src-sym">{</span></div></li> <li><div class="src-line"><a name="a4597"></a> <span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id"><a href="class.upload.html#var$processed">processed</a> </span>= <span class="src-id">false</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a4598"></a> <span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id"><a href="class.upload.html#var$error">error</a> </span>= <span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id">translate</span><span class="src-sym">(</span><span class="src-str">'reading_failed'</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a4599"></a> <span class="src-sym">}</span></div></li> <li><div class="src-line"><a name="a4600"></a> <span class="src-sym">}</span></div></li> <li><div class="src-line"><a name="a4601"></a> <span class="src-sym">}</span></div></li> <li><div class="src-line"><a name="a4602"></a> <span class="src-sym">}</span></div></li> <li><div class="src-line"><a name="a4603"></a> </div></li> <li><div class="src-line"><a name="a4604"></a> <span class="src-key">if </span><span class="src-sym">(</span><span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id"><a href="class.upload.html#var$processed">processed</a></span><span class="src-sym">) </span><span class="src-sym">{</span></div></li> <li><div class="src-line"><a name="a4605"></a> <span class="src-var">$this</span><span class="src-sym">-></span><a href="http://www.php.net/log">log</a> .= <span class="src-str">'- <b>process OK</b><br />'</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a4606"></a> <span class="src-sym">} </span><span class="src-key">else </span><span class="src-sym">{</span></div></li> <li><div class="src-line"><a name="a4607"></a> <span class="src-var">$this</span><span class="src-sym">-></span><a href="http://www.php.net/log">log</a> .= <span class="src-str">'- <b>error</b>: ' </span>. <span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id"><a href="class.upload.html#var$error">error</a> </span>. <span class="src-str">'<br />'</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a4608"></a> <span class="src-sym">}</span></div></li> <li><div class="src-line"><a name="a4609"></a> </div></li> <li><div class="src-line"><a name="a4610"></a> <span class="src-comm">// we reinit all the vars</span></div></li> <li><div class="src-line"><a name="a4611"></a> <span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id">init</span><span class="src-sym">(</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a4612"></a> </div></li> <li><div class="src-line"><a name="a4613"></a> <span class="src-comm">// we may return the image content</span></div></li> <li><div class="src-line"><a name="a4614"></a> <span class="src-key">if </span><span class="src-sym">(</span><span class="src-var">$return_mode</span><span class="src-sym">) </span><span class="src-key">return </span><span class="src-var">$return_content</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a4615"></a> </div></li> <li><div class="src-line"><a name="a4616"></a> <span class="src-sym">}</span></div></li> <li><div class="src-line"><a name="a4617"></a> </div></li> <li><div class="src-line"><a name="a4618"></a> <span class="src-doc">/**</span></div></li> <li><div class="src-line"><a name="a4619"></a><span class="src-doc"> * Deletes the uploaded file from its temporary location</span></div></li> <li><div class="src-line"><a name="a4620"></a><span class="src-doc"> *</span></div></li> <li><div class="src-line"><a name="a4621"></a><span class="src-doc"> * When PHP uploads a file, it stores it in a temporary location.</span></div></li> <li><div class="src-line"><a name="a4622"></a><span class="src-doc"> * When you </span><span class="src-doc-inlinetag">{@link process}</span><span class="src-doc"> the file, you actually copy the resulting file to the given location, it doesn't alter the original file.</span></div></li> <li><div class="src-line"><a name="a4623"></a><span class="src-doc"> * Once you have processed the file as many times as you wanted, you can delete the uploaded file.</span></div></li> <li><div class="src-line"><a name="a4624"></a><span class="src-doc"> * If there is open_basedir restrictions, the uploaded file is in fact a temporary file</span></div></li> <li><div class="src-line"><a name="a4625"></a><span class="src-doc"> *</span></div></li> <li><div class="src-line"><a name="a4626"></a><span class="src-doc"> * You might want not to use this function if you work on local files, as it will delete the source file</span></div></li> <li><div class="src-line"><a name="a4627"></a><span class="src-doc"> *</span></div></li> <li><div class="src-line"><a name="a4628"></a><span class="src-doc"> * </span><span class="src-doc-coretag">@access</span><span class="src-doc"> public</span></div></li> <li><div class="src-line"><a name="a4629"></a><span class="src-doc"> */</span></div></li> <li><div class="src-line"><a name="a4630"></a> <span class="src-key">function </span><a href="class.upload.html#methodclean">clean</a><span class="src-sym">(</span><span class="src-sym">) </span><span class="src-sym">{</span></div></li> <li><div class="src-line"><a name="a4631"></a> <span class="src-var">$this</span><span class="src-sym">-></span><a href="http://www.php.net/log">log</a> .= <span class="src-str">'<b>cleanup</b><br />'</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a4632"></a> <span class="src-var">$this</span><span class="src-sym">-></span><a href="http://www.php.net/log">log</a> .= <span class="src-str">'- delete temp file ' </span>. <span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id">file_src_pathname </span>. <span class="src-str">'<br />'</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a4633"></a> <span class="src-sym">@</span><a href="http://www.php.net/unlink">unlink</a><span class="src-sym">(</span><span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id">file_src_pathname</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a4634"></a> <span class="src-sym">}</span></div></li> <li><div class="src-line"><a name="a4635"></a> </div></li> <li><div class="src-line"><a name="a4636"></a> </div></li> <li><div class="src-line"><a name="a4637"></a> <span class="src-doc">/**</span></div></li> <li><div class="src-line"><a name="a4638"></a><span class="src-doc"> * Opens a BMP image</span></div></li> <li><div class="src-line"><a name="a4639"></a><span class="src-doc"> *</span></div></li> <li><div class="src-line"><a name="a4640"></a><span class="src-doc"> * This function has been written by DHKold, and is used with permission of the author</span></div></li> <li><div class="src-line"><a name="a4641"></a><span class="src-doc"> *</span></div></li> <li><div class="src-line"><a name="a4642"></a><span class="src-doc"> * </span><span class="src-doc-coretag">@access</span><span class="src-doc"> public</span></div></li> <li><div class="src-line"><a name="a4643"></a><span class="src-doc"> */</span></div></li> <li><div class="src-line"><a name="a4644"></a> <span class="src-key">function </span><a href="class.upload.html#methodimagecreatefrombmp">imagecreatefrombmp</a><span class="src-sym">(</span><span class="src-var">$filename</span><span class="src-sym">) </span><span class="src-sym">{</span></div></li> <li><div class="src-line"><a name="a4645"></a> <span class="src-key">if </span><span class="src-sym">(</span><span class="src-sym">! </span><span class="src-var">$f1 </span>= <a href="http://www.php.net/fopen">fopen</a><span class="src-sym">(</span><span class="src-var">$filename</span><span class="src-sym">,</span><span class="src-str">"rb"</span><span class="src-sym">)) </span><span class="src-key">return </span><span class="src-id">false</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a4646"></a> </div></li> <li><div class="src-line"><a name="a4647"></a> <span class="src-var">$file </span>= <a href="http://www.php.net/unpack">unpack</a><span class="src-sym">(</span><span class="src-str">"vfile_type/Vfile_size/Vreserved/Vbitmap_offset"</span><span class="src-sym">, </span><a href="http://www.php.net/fread">fread</a><span class="src-sym">(</span><span class="src-var">$f1</span><span class="src-sym">,</span><span class="src-num">14</span><span class="src-sym">))</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a4648"></a> <span class="src-key">if </span><span class="src-sym">(</span><span class="src-var">$file</span><span class="src-sym">[</span><span class="src-str">'file_type'</span><span class="src-sym">] </span>!= <span class="src-num">19778</span><span class="src-sym">) </span><span class="src-key">return </span><span class="src-id">false</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a4649"></a> </div></li> <li><div class="src-line"><a name="a4650"></a> <span class="src-var">$bmp </span>= <a href="http://www.php.net/unpack">unpack</a><span class="src-sym">(</span><span class="src-str">'Vheader_size/Vwidth/Vheight/vplanes/vbits_per_pixel'</span>.</div></li> <li><div class="src-line"><a name="a4651"></a> <span class="src-str">'/Vcompression/Vsize_bitmap/Vhoriz_resolution'</span>.</div></li> <li><div class="src-line"><a name="a4652"></a> <span class="src-str">'/Vvert_resolution/Vcolors_used/Vcolors_important'</span><span class="src-sym">, </span><a href="http://www.php.net/fread">fread</a><span class="src-sym">(</span><span class="src-var">$f1</span><span class="src-sym">,</span><span class="src-num">40</span><span class="src-sym">))</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a4653"></a> <span class="src-var">$bmp</span><span class="src-sym">[</span><span class="src-str">'colors'</span><span class="src-sym">] </span>= <a href="http://www.php.net/pow">pow</a><span class="src-sym">(</span><span class="src-num">2</span><span class="src-sym">,</span><span class="src-var">$bmp</span><span class="src-sym">[</span><span class="src-str">'bits_per_pixel'</span><span class="src-sym">]</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a4654"></a> <span class="src-key">if </span><span class="src-sym">(</span><span class="src-var">$bmp</span><span class="src-sym">[</span><span class="src-str">'size_bitmap'</span><span class="src-sym">] </span>== <span class="src-num">0</span><span class="src-sym">) </span><span class="src-var">$bmp</span><span class="src-sym">[</span><span class="src-str">'size_bitmap'</span><span class="src-sym">] </span>= <span class="src-var">$file</span><span class="src-sym">[</span><span class="src-str">'file_size'</span><span class="src-sym">] </span>- <span class="src-var">$file</span><span class="src-sym">[</span><span class="src-str">'bitmap_offset'</span><span class="src-sym">]</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a4655"></a> <span class="src-var">$bmp</span><span class="src-sym">[</span><span class="src-str">'bytes_per_pixel'</span><span class="src-sym">] </span>= <span class="src-var">$bmp</span><span class="src-sym">[</span><span class="src-str">'bits_per_pixel'</span><span class="src-sym">]</span>/<span class="src-num">8</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a4656"></a> <span class="src-var">$bmp</span><span class="src-sym">[</span><span class="src-str">'bytes_per_pixel2'</span><span class="src-sym">] </span>= <a href="http://www.php.net/ceil">ceil</a><span class="src-sym">(</span><span class="src-var">$bmp</span><span class="src-sym">[</span><span class="src-str">'bytes_per_pixel'</span><span class="src-sym">]</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a4657"></a> <span class="src-var">$bmp</span><span class="src-sym">[</span><span class="src-str">'decal'</span><span class="src-sym">] </span>= <span class="src-sym">(</span><span class="src-var">$bmp</span><span class="src-sym">[</span><span class="src-str">'width'</span><span class="src-sym">]</span>*<span class="src-var">$bmp</span><span class="src-sym">[</span><span class="src-str">'bytes_per_pixel'</span><span class="src-sym">]</span>/<span class="src-num">4</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a4658"></a> <span class="src-var">$bmp</span><span class="src-sym">[</span><span class="src-str">'decal'</span><span class="src-sym">] </span>-= <a href="http://www.php.net/floor">floor</a><span class="src-sym">(</span><span class="src-var">$bmp</span><span class="src-sym">[</span><span class="src-str">'width'</span><span class="src-sym">]</span>*<span class="src-var">$bmp</span><span class="src-sym">[</span><span class="src-str">'bytes_per_pixel'</span><span class="src-sym">]</span>/<span class="src-num">4</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a4659"></a> <span class="src-var">$bmp</span><span class="src-sym">[</span><span class="src-str">'decal'</span><span class="src-sym">] </span>= <span class="src-num">4</span>-<span class="src-sym">(</span><span class="src-num">4</span>*<span class="src-var">$bmp</span><span class="src-sym">[</span><span class="src-str">'decal'</span><span class="src-sym">]</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a4660"></a> <span class="src-key">if </span><span class="src-sym">(</span><span class="src-var">$bmp</span><span class="src-sym">[</span><span class="src-str">'decal'</span><span class="src-sym">] </span>== <span class="src-num">4</span><span class="src-sym">) </span><span class="src-var">$bmp</span><span class="src-sym">[</span><span class="src-str">'decal'</span><span class="src-sym">] </span>= <span class="src-num">0</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a4661"></a> </div></li> <li><div class="src-line"><a name="a4662"></a> <span class="src-var">$palette </span>= <span class="src-key">array</span><span class="src-sym">(</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a4663"></a> <span class="src-key">if </span><span class="src-sym">(</span><span class="src-var">$bmp</span><span class="src-sym">[</span><span class="src-str">'colors'</span><span class="src-sym">] </span>< <span class="src-num">16777216</span><span class="src-sym">) </span><span class="src-sym">{</span></div></li> <li><div class="src-line"><a name="a4664"></a> <span class="src-var">$palette </span>= <a href="http://www.php.net/unpack">unpack</a><span class="src-sym">(</span><span class="src-str">'V'</span>.<span class="src-var">$bmp</span><span class="src-sym">[</span><span class="src-str">'colors'</span><span class="src-sym">]</span><span class="src-sym">, </span><a href="http://www.php.net/fread">fread</a><span class="src-sym">(</span><span class="src-var">$f1</span><span class="src-sym">,</span><span class="src-var">$bmp</span><span class="src-sym">[</span><span class="src-str">'colors'</span><span class="src-sym">]</span>*<span class="src-num">4</span><span class="src-sym">))</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a4665"></a> <span class="src-sym">}</span></div></li> <li><div class="src-line"><a name="a4666"></a> </div></li> <li><div class="src-line"><a name="a4667"></a> <span class="src-var">$im </span>= <a href="http://www.php.net/fread">fread</a><span class="src-sym">(</span><span class="src-var">$f1</span><span class="src-sym">,</span><span class="src-var">$bmp</span><span class="src-sym">[</span><span class="src-str">'size_bitmap'</span><span class="src-sym">]</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a4668"></a> <span class="src-var">$vide </span>= <a href="http://www.php.net/chr">chr</a><span class="src-sym">(</span><span class="src-num">0</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a4669"></a> </div></li> <li><div class="src-line"><a name="a4670"></a> <span class="src-var">$res </span>= <a href="http://www.php.net/imagecreatetruecolor">imagecreatetruecolor</a><span class="src-sym">(</span><span class="src-var">$bmp</span><span class="src-sym">[</span><span class="src-str">'width'</span><span class="src-sym">]</span><span class="src-sym">,</span><span class="src-var">$bmp</span><span class="src-sym">[</span><span class="src-str">'height'</span><span class="src-sym">]</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a4671"></a> <span class="src-var">$P </span>= <span class="src-num">0</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a4672"></a> <span class="src-var">$Y </span>= <span class="src-var">$bmp</span><span class="src-sym">[</span><span class="src-str">'height'</span><span class="src-sym">]</span>-<span class="src-num">1</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a4673"></a> <span class="src-key">while </span><span class="src-sym">(</span><span class="src-var">$Y </span>>= <span class="src-num">0</span><span class="src-sym">) </span><span class="src-sym">{</span></div></li> <li><div class="src-line"><a name="a4674"></a> <span class="src-var">$X</span>=<span class="src-num">0</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a4675"></a> <span class="src-key">while </span><span class="src-sym">(</span><span class="src-var">$X </span>< <span class="src-var">$bmp</span><span class="src-sym">[</span><span class="src-str">'width'</span><span class="src-sym">]</span><span class="src-sym">) </span><span class="src-sym">{</span></div></li> <li><div class="src-line"><a name="a4676"></a> <span class="src-key">if </span><span class="src-sym">(</span><span class="src-var">$bmp</span><span class="src-sym">[</span><span class="src-str">'bits_per_pixel'</span><span class="src-sym">] </span>== <span class="src-num">24</span><span class="src-sym">)</span></div></li> <li><div class="src-line"><a name="a4677"></a> <span class="src-var">$color </span>= <a href="http://www.php.net/unpack">unpack</a><span class="src-sym">(</span><span class="src-str">"V"</span><span class="src-sym">,</span><a href="http://www.php.net/substr">substr</a><span class="src-sym">(</span><span class="src-var">$im</span><span class="src-sym">,</span><span class="src-var">$P</span><span class="src-sym">,</span><span class="src-num">3</span><span class="src-sym">)</span>.<span class="src-var">$vide</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a4678"></a> <span class="src-key">elseif </span><span class="src-sym">(</span><span class="src-var">$bmp</span><span class="src-sym">[</span><span class="src-str">'bits_per_pixel'</span><span class="src-sym">] </span>== <span class="src-num">16</span><span class="src-sym">) </span><span class="src-sym">{</span></div></li> <li><div class="src-line"><a name="a4679"></a> <span class="src-var">$color </span>= <a href="http://www.php.net/unpack">unpack</a><span class="src-sym">(</span><span class="src-str">"n"</span><span class="src-sym">,</span><a href="http://www.php.net/substr">substr</a><span class="src-sym">(</span><span class="src-var">$im</span><span class="src-sym">,</span><span class="src-var">$P</span><span class="src-sym">,</span><span class="src-num">2</span><span class="src-sym">))</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a4680"></a> <span class="src-var">$color</span><span class="src-sym">[</span><span class="src-num">1</span><span class="src-sym">] </span>= <span class="src-var">$palette</span><span class="src-sym">[</span><span class="src-var">$color</span><span class="src-sym">[</span><span class="src-num">1</span><span class="src-sym">]</span>+<span class="src-num">1</span><span class="src-sym">]</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a4681"></a> <span class="src-sym">} </span><span class="src-key">elseif </span><span class="src-sym">(</span><span class="src-var">$bmp</span><span class="src-sym">[</span><span class="src-str">'bits_per_pixel'</span><span class="src-sym">] </span>== <span class="src-num">8</span><span class="src-sym">) </span><span class="src-sym">{</span></div></li> <li><div class="src-line"><a name="a4682"></a> <span class="src-var">$color </span>= <a href="http://www.php.net/unpack">unpack</a><span class="src-sym">(</span><span class="src-str">"n"</span><span class="src-sym">,</span><span class="src-var">$vide</span>.<a href="http://www.php.net/substr">substr</a><span class="src-sym">(</span><span class="src-var">$im</span><span class="src-sym">,</span><span class="src-var">$P</span><span class="src-sym">,</span><span class="src-num">1</span><span class="src-sym">))</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a4683"></a> <span class="src-var">$color</span><span class="src-sym">[</span><span class="src-num">1</span><span class="src-sym">] </span>= <span class="src-var">$palette</span><span class="src-sym">[</span><span class="src-var">$color</span><span class="src-sym">[</span><span class="src-num">1</span><span class="src-sym">]</span>+<span class="src-num">1</span><span class="src-sym">]</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a4684"></a> <span class="src-sym">} </span><span class="src-key">elseif </span><span class="src-sym">(</span><span class="src-var">$bmp</span><span class="src-sym">[</span><span class="src-str">'bits_per_pixel'</span><span class="src-sym">] </span>== <span class="src-num">4</span><span class="src-sym">) </span><span class="src-sym">{</span></div></li> <li><div class="src-line"><a name="a4685"></a> <span class="src-var">$color </span>= <a href="http://www.php.net/unpack">unpack</a><span class="src-sym">(</span><span class="src-str">"n"</span><span class="src-sym">,</span><span class="src-var">$vide</span>.<a href="http://www.php.net/substr">substr</a><span class="src-sym">(</span><span class="src-var">$im</span><span class="src-sym">,</span><a href="http://www.php.net/floor">floor</a><span class="src-sym">(</span><span class="src-var">$P</span><span class="src-sym">)</span><span class="src-sym">,</span><span class="src-num">1</span><span class="src-sym">))</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a4686"></a> <span class="src-key">if </span><span class="src-sym">((</span><span class="src-var">$P</span>*<span class="src-num">2</span><span class="src-sym">)</span>%<span class="src-num">2 </span>== <span class="src-num">0</span><span class="src-sym">) </span><span class="src-var">$color</span><span class="src-sym">[</span><span class="src-num">1</span><span class="src-sym">] </span>= <span class="src-sym">(</span><span class="src-var">$color</span><span class="src-sym">[</span><span class="src-num">1</span><span class="src-sym">] </span>>> <span class="src-num">4</span><span class="src-sym">) </span><span class="src-sym">; </span><span class="src-key">else </span><span class="src-var">$color</span><span class="src-sym">[</span><span class="src-num">1</span><span class="src-sym">] </span>= <span class="src-sym">(</span><span class="src-var">$color</span><span class="src-sym">[</span><span class="src-num">1</span><span class="src-sym">] </span><span class="src-sym">& </span><span class="src-num">0x0F</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a4687"></a> <span class="src-var">$color</span><span class="src-sym">[</span><span class="src-num">1</span><span class="src-sym">] </span>= <span class="src-var">$palette</span><span class="src-sym">[</span><span class="src-var">$color</span><span class="src-sym">[</span><span class="src-num">1</span><span class="src-sym">]</span>+<span class="src-num">1</span><span class="src-sym">]</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a4688"></a> <span class="src-sym">} </span><span class="src-key">elseif </span><span class="src-sym">(</span><span class="src-var">$bmp</span><span class="src-sym">[</span><span class="src-str">'bits_per_pixel'</span><span class="src-sym">] </span>== <span class="src-num">1</span><span class="src-sym">) </span><span class="src-sym">{</span></div></li> <li><div class="src-line"><a name="a4689"></a> <span class="src-var">$color </span>= <a href="http://www.php.net/unpack">unpack</a><span class="src-sym">(</span><span class="src-str">"n"</span><span class="src-sym">,</span><span class="src-var">$vide</span>.<a href="http://www.php.net/substr">substr</a><span class="src-sym">(</span><span class="src-var">$im</span><span class="src-sym">,</span><a href="http://www.php.net/floor">floor</a><span class="src-sym">(</span><span class="src-var">$P</span><span class="src-sym">)</span><span class="src-sym">,</span><span class="src-num">1</span><span class="src-sym">))</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a4690"></a> <span class="src-key">if </span><span class="src-sym">((</span><span class="src-var">$P</span>*<span class="src-num">8</span><span class="src-sym">)</span>%<span class="src-num">8 </span>== <span class="src-num">0</span><span class="src-sym">) </span><span class="src-var">$color</span><span class="src-sym">[</span><span class="src-num">1</span><span class="src-sym">] </span>= <span class="src-var">$color</span><span class="src-sym">[</span><span class="src-num">1</span><span class="src-sym">] </span>>><span class="src-num">7</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a4691"></a> <span class="src-key">elseif </span><span class="src-sym">((</span><span class="src-var">$P</span>*<span class="src-num">8</span><span class="src-sym">)</span>%<span class="src-num">8 </span>== <span class="src-num">1</span><span class="src-sym">) </span><span class="src-var">$color</span><span class="src-sym">[</span><span class="src-num">1</span><span class="src-sym">] </span>= <span class="src-sym">(</span><span class="src-var">$color</span><span class="src-sym">[</span><span class="src-num">1</span><span class="src-sym">] </span><span class="src-sym">& </span><span class="src-num">0x40</span><span class="src-sym">)</span>>><span class="src-num">6</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a4692"></a> <span class="src-key">elseif </span><span class="src-sym">((</span><span class="src-var">$P</span>*<span class="src-num">8</span><span class="src-sym">)</span>%<span class="src-num">8 </span>== <span class="src-num">2</span><span class="src-sym">) </span><span class="src-var">$color</span><span class="src-sym">[</span><span class="src-num">1</span><span class="src-sym">] </span>= <span class="src-sym">(</span><span class="src-var">$color</span><span class="src-sym">[</span><span class="src-num">1</span><span class="src-sym">] </span><span class="src-sym">& </span><span class="src-num">0x20</span><span class="src-sym">)</span>>><span class="src-num">5</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a4693"></a> <span class="src-key">elseif </span><span class="src-sym">((</span><span class="src-var">$P</span>*<span class="src-num">8</span><span class="src-sym">)</span>%<span class="src-num">8 </span>== <span class="src-num">3</span><span class="src-sym">) </span><span class="src-var">$color</span><span class="src-sym">[</span><span class="src-num">1</span><span class="src-sym">] </span>= <span class="src-sym">(</span><span class="src-var">$color</span><span class="src-sym">[</span><span class="src-num">1</span><span class="src-sym">] </span><span class="src-sym">& </span><span class="src-num">0x10</span><span class="src-sym">)</span>>><span class="src-num">4</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a4694"></a> <span class="src-key">elseif </span><span class="src-sym">((</span><span class="src-var">$P</span>*<span class="src-num">8</span><span class="src-sym">)</span>%<span class="src-num">8 </span>== <span class="src-num">4</span><span class="src-sym">) </span><span class="src-var">$color</span><span class="src-sym">[</span><span class="src-num">1</span><span class="src-sym">] </span>= <span class="src-sym">(</span><span class="src-var">$color</span><span class="src-sym">[</span><span class="src-num">1</span><span class="src-sym">] </span><span class="src-sym">& </span><span class="src-num">0x8</span><span class="src-sym">)</span>>><span class="src-num">3</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a4695"></a> <span class="src-key">elseif </span><span class="src-sym">((</span><span class="src-var">$P</span>*<span class="src-num">8</span><span class="src-sym">)</span>%<span class="src-num">8 </span>== <span class="src-num">5</span><span class="src-sym">) </span><span class="src-var">$color</span><span class="src-sym">[</span><span class="src-num">1</span><span class="src-sym">] </span>= <span class="src-sym">(</span><span class="src-var">$color</span><span class="src-sym">[</span><span class="src-num">1</span><span class="src-sym">] </span><span class="src-sym">& </span><span class="src-num">0x4</span><span class="src-sym">)</span>>><span class="src-num">2</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a4696"></a> <span class="src-key">elseif </span><span class="src-sym">((</span><span class="src-var">$P</span>*<span class="src-num">8</span><span class="src-sym">)</span>%<span class="src-num">8 </span>== <span class="src-num">6</span><span class="src-sym">) </span><span class="src-var">$color</span><span class="src-sym">[</span><span class="src-num">1</span><span class="src-sym">] </span>= <span class="src-sym">(</span><span class="src-var">$color</span><span class="src-sym">[</span><span class="src-num">1</span><span class="src-sym">] </span><span class="src-sym">& </span><span class="src-num">0x2</span><span class="src-sym">)</span>>><span class="src-num">1</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a4697"></a> <span class="src-key">elseif </span><span class="src-sym">((</span><span class="src-var">$P</span>*<span class="src-num">8</span><span class="src-sym">)</span>%<span class="src-num">8 </span>== <span class="src-num">7</span><span class="src-sym">) </span><span class="src-var">$color</span><span class="src-sym">[</span><span class="src-num">1</span><span class="src-sym">] </span>= <span class="src-sym">(</span><span class="src-var">$color</span><span class="src-sym">[</span><span class="src-num">1</span><span class="src-sym">] </span><span class="src-sym">& </span><span class="src-num">0x1</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a4698"></a> <span class="src-var">$color</span><span class="src-sym">[</span><span class="src-num">1</span><span class="src-sym">] </span>= <span class="src-var">$palette</span><span class="src-sym">[</span><span class="src-var">$color</span><span class="src-sym">[</span><span class="src-num">1</span><span class="src-sym">]</span>+<span class="src-num">1</span><span class="src-sym">]</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a4699"></a> <span class="src-sym">} </span><span class="src-key">else</span></div></li> <li><div class="src-line"><a name="a4700"></a> <span class="src-key">return </span><span class="src-id">FALSE</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a4701"></a> <a href="http://www.php.net/imagesetpixel">imagesetpixel</a><span class="src-sym">(</span><span class="src-var">$res</span><span class="src-sym">,</span><span class="src-var">$X</span><span class="src-sym">,</span><span class="src-var">$Y</span><span class="src-sym">,</span><span class="src-var">$color</span><span class="src-sym">[</span><span class="src-num">1</span><span class="src-sym">]</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a4702"></a> <span class="src-var">$X</span>++<span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a4703"></a> <span class="src-var">$P </span>+= <span class="src-var">$bmp</span><span class="src-sym">[</span><span class="src-str">'bytes_per_pixel'</span><span class="src-sym">]</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a4704"></a> <span class="src-sym">}</span></div></li> <li><div class="src-line"><a name="a4705"></a> <span class="src-var">$Y</span>--<span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a4706"></a> <span class="src-var">$P</span>+=<span class="src-var">$bmp</span><span class="src-sym">[</span><span class="src-str">'decal'</span><span class="src-sym">]</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a4707"></a> <span class="src-sym">}</span></div></li> <li><div class="src-line"><a name="a4708"></a> <a href="http://www.php.net/fclose">fclose</a><span class="src-sym">(</span><span class="src-var">$f1</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a4709"></a> <span class="src-key">return </span><span class="src-var">$res</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a4710"></a> <span class="src-sym">}</span></div></li> <li><div class="src-line"><a name="a4711"></a> </div></li> <li><div class="src-line"><a name="a4712"></a> <span class="src-doc">/**</span></div></li> <li><div class="src-line"><a name="a4713"></a><span class="src-doc"> * Saves a BMP image</span></div></li> <li><div class="src-line"><a name="a4714"></a><span class="src-doc"> *</span></div></li> <li><div class="src-line"><a name="a4715"></a><span class="src-doc"> * This function has been published on the PHP website, and can be used freely</span></div></li> <li><div class="src-line"><a name="a4716"></a><span class="src-doc"> *</span></div></li> <li><div class="src-line"><a name="a4717"></a><span class="src-doc"> * </span><span class="src-doc-coretag">@access</span><span class="src-doc"> public</span></div></li> <li><div class="src-line"><a name="a4718"></a><span class="src-doc"> */</span></div></li> <li><div class="src-line"><a name="a4719"></a> <span class="src-key">function </span><a href="class.upload.html#methodimagebmp">imagebmp</a><span class="src-sym">(</span><span class="src-sym">&</span><span class="src-var">$im</span><span class="src-sym">, </span><span class="src-var">$filename </span>= <span class="src-str">""</span><span class="src-sym">) </span><span class="src-sym">{</span></div></li> <li><div class="src-line"><a name="a4720"></a> </div></li> <li><div class="src-line"><a name="a4721"></a> <span class="src-key">if </span><span class="src-sym">(</span><span class="src-sym">!</span><span class="src-var">$im</span><span class="src-sym">) </span><span class="src-key">return </span><span class="src-id">false</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a4722"></a> <span class="src-var">$w </span>= <a href="http://www.php.net/imagesx">imagesx</a><span class="src-sym">(</span><span class="src-var">$im</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a4723"></a> <span class="src-var">$h </span>= <a href="http://www.php.net/imagesy">imagesy</a><span class="src-sym">(</span><span class="src-var">$im</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a4724"></a> <span class="src-var">$result </span>= <span class="src-str">''</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a4725"></a> </div></li> <li><div class="src-line"><a name="a4726"></a> <span class="src-comm">// if the image is not true color, we convert it first</span></div></li> <li><div class="src-line"><a name="a4727"></a> <span class="src-key">if </span><span class="src-sym">(</span><span class="src-sym">!</span><a href="http://www.php.net/imageistruecolor">imageistruecolor</a><span class="src-sym">(</span><span class="src-var">$im</span><span class="src-sym">)) </span><span class="src-sym">{</span></div></li> <li><div class="src-line"><a name="a4728"></a> <span class="src-var">$tmp </span>= <a href="http://www.php.net/imagecreatetruecolor">imagecreatetruecolor</a><span class="src-sym">(</span><span class="src-var">$w</span><span class="src-sym">, </span><span class="src-var">$h</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a4729"></a> <a href="http://www.php.net/imagecopy">imagecopy</a><span class="src-sym">(</span><span class="src-var">$tmp</span><span class="src-sym">, </span><span class="src-var">$im</span><span class="src-sym">, </span><span class="src-num">0</span><span class="src-sym">, </span><span class="src-num">0</span><span class="src-sym">, </span><span class="src-num">0</span><span class="src-sym">, </span><span class="src-num">0</span><span class="src-sym">, </span><span class="src-var">$w</span><span class="src-sym">, </span><span class="src-var">$h</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a4730"></a> <a href="http://www.php.net/imagedestroy">imagedestroy</a><span class="src-sym">(</span><span class="src-var">$im</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a4731"></a> <span class="src-var">$im </span>= <span class="src-sym">& </span><span class="src-var">$tmp</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a4732"></a> <span class="src-sym">}</span></div></li> <li><div class="src-line"><a name="a4733"></a> </div></li> <li><div class="src-line"><a name="a4734"></a> <span class="src-var">$biBPLine </span>= <span class="src-var">$w </span>* <span class="src-num">3</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a4735"></a> <span class="src-var">$biStride </span>= <span class="src-sym">(</span><span class="src-var">$biBPLine </span>+ <span class="src-num">3</span><span class="src-sym">) </span><span class="src-sym">& </span>~<span class="src-num">3</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a4736"></a> <span class="src-var">$biSizeImage </span>= <span class="src-var">$biStride </span>* <span class="src-var">$h</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a4737"></a> <span class="src-var">$bfOffBits </span>= <span class="src-num">54</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a4738"></a> <span class="src-var">$bfSize </span>= <span class="src-var">$bfOffBits </span>+ <span class="src-var">$biSizeImage</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a4739"></a> </div></li> <li><div class="src-line"><a name="a4740"></a> <span class="src-var">$result </span>.= <a href="http://www.php.net/substr">substr</a><span class="src-sym">(</span><span class="src-str">'BM'</span><span class="src-sym">, </span><span class="src-num">0</span><span class="src-sym">, </span><span class="src-num">2</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a4741"></a> <span class="src-var">$result </span>.= <a href="http://www.php.net/pack">pack</a> <span class="src-sym">(</span><span class="src-str">'VvvV'</span><span class="src-sym">, </span><span class="src-var">$bfSize</span><span class="src-sym">, </span><span class="src-num">0</span><span class="src-sym">, </span><span class="src-num">0</span><span class="src-sym">, </span><span class="src-var">$bfOffBits</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a4742"></a> <span class="src-var">$result </span>.= <a href="http://www.php.net/pack">pack</a> <span class="src-sym">(</span><span class="src-str">'VVVvvVVVVVV'</span><span class="src-sym">, </span><span class="src-num">40</span><span class="src-sym">, </span><span class="src-var">$w</span><span class="src-sym">, </span><span class="src-var">$h</span><span class="src-sym">, </span><span class="src-num">1</span><span class="src-sym">, </span><span class="src-num">24</span><span class="src-sym">, </span><span class="src-num">0</span><span class="src-sym">, </span><span class="src-var">$biSizeImage</span><span class="src-sym">, </span><span class="src-num">0</span><span class="src-sym">, </span><span class="src-num">0</span><span class="src-sym">, </span><span class="src-num">0</span><span class="src-sym">, </span><span class="src-num">0</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a4743"></a> </div></li> <li><div class="src-line"><a name="a4744"></a> <span class="src-var">$numpad </span>= <span class="src-var">$biStride </span>- <span class="src-var">$biBPLine</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a4745"></a> <span class="src-key">for </span><span class="src-sym">(</span><span class="src-var">$y </span>= <span class="src-var">$h </span>- <span class="src-num">1</span><span class="src-sym">; </span><span class="src-var">$y </span>>= <span class="src-num">0</span><span class="src-sym">; </span>--<span class="src-var">$y</span><span class="src-sym">) </span><span class="src-sym">{</span></div></li> <li><div class="src-line"><a name="a4746"></a> <span class="src-key">for </span><span class="src-sym">(</span><span class="src-var">$x </span>= <span class="src-num">0</span><span class="src-sym">; </span><span class="src-var">$x </span>< <span class="src-var">$w</span><span class="src-sym">; </span>++<span class="src-var">$x</span><span class="src-sym">) </span><span class="src-sym">{</span></div></li> <li><div class="src-line"><a name="a4747"></a> <span class="src-var">$col </span>= <a href="http://www.php.net/imagecolorat">imagecolorat</a> <span class="src-sym">(</span><span class="src-var">$im</span><span class="src-sym">, </span><span class="src-var">$x</span><span class="src-sym">, </span><span class="src-var">$y</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a4748"></a> <span class="src-var">$result </span>.= <a href="http://www.php.net/substr">substr</a><span class="src-sym">(</span><a href="http://www.php.net/pack">pack</a> <span class="src-sym">(</span><span class="src-str">'V'</span><span class="src-sym">, </span><span class="src-var">$col</span><span class="src-sym">)</span><span class="src-sym">, </span><span class="src-num">0</span><span class="src-sym">, </span><span class="src-num">3</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a4749"></a> <span class="src-sym">}</span></div></li> <li><div class="src-line"><a name="a4750"></a> <span class="src-key">for </span><span class="src-sym">(</span><span class="src-var">$i </span>= <span class="src-num">0</span><span class="src-sym">; </span><span class="src-var">$i </span>< <span class="src-var">$numpad</span><span class="src-sym">; </span>++<span class="src-var">$i</span><span class="src-sym">)</span></div></li> <li><div class="src-line"><a name="a4751"></a> <span class="src-var">$result </span>.= <a href="http://www.php.net/pack">pack</a> <span class="src-sym">(</span><span class="src-str">'C'</span><span class="src-sym">, </span><span class="src-num">0</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a4752"></a> <span class="src-sym">}</span></div></li> <li><div class="src-line"><a name="a4753"></a> </div></li> <li><div class="src-line"><a name="a4754"></a> <span class="src-key">if</span><span class="src-sym">(</span><span class="src-var">$filename</span>==<span class="src-str">""</span><span class="src-sym">)</span><span class="src-sym">{</span></div></li> <li><div class="src-line"><a name="a4755"></a> echo <span class="src-var">$result</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a4756"></a> <span class="src-sym">} </span><span class="src-key">else </span><span class="src-sym">{</span></div></li> <li><div class="src-line"><a name="a4757"></a> <span class="src-var">$file </span>= <a href="http://www.php.net/fopen">fopen</a><span class="src-sym">(</span><span class="src-var">$filename</span><span class="src-sym">, </span><span class="src-str">"wb"</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a4758"></a> <a href="http://www.php.net/fwrite">fwrite</a><span class="src-sym">(</span><span class="src-var">$file</span><span class="src-sym">, </span><span class="src-var">$result</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a4759"></a> <a href="http://www.php.net/fclose">fclose</a><span class="src-sym">(</span><span class="src-var">$file</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a4760"></a> <span class="src-sym">}</span></div></li> <li><div class="src-line"><a name="a4761"></a> <span class="src-key">return </span><span class="src-id">true</span><span class="src-sym">;</span></div></li> <li><div class="src-line"><a name="a4762"></a> <span class="src-sym">}</span></div></li> <li><div class="src-line"><a name="a4763"></a><span class="src-sym">}</span></div></li> <li><div class="src-line"><a name="a4764"></a> </div></li> <li><div class="src-line"><a name="a4765"></a><span class="src-php">?></span></div></li> </ol></div> </div> <p class="notes" id="credit"> </p> </body> </html>