PHP image upload and generate thumbnail class

/** * Upload Images */ Class imgupload{ static protected $a; protected $formName; Form name protected $directory; File Upload to Directory protected $maxSize; Maximum file Upload size protected $canUpload;

PHP will format the time a few days ago, a few ago, etc.

Class DateFormat { private static $_diff_format = Array ( ' Day ' = '%s days ago ', ' Day_hour ' + '%s day%s hours ago ', ' HOUR ' = '%s hours ', ' Hour_minute ' + '%s hours before%s ', ' MINUTE ' = '%s minutes ago

PHP uncompressed zip file

The zip file can be decompressed. It has two parameters: the path to the compressed file, and the path to the destination file. function Unzip_file ($file, $destination) { Create Object $zip = new Ziparchive (); Open

PHP array to generate CSV file

A very simple function to generate a. csv file from a PHP array. This function uses the Fputcsv PHP built-in function to generate a comma-delimited file (. CSV). The function has 3 parameters: data, delimiters, and CSV enclosure, which are double

Submit a mock post submission form with PHP Fsocket impersonation get

Fsocket Analog Post Submission $purl = "http://www.baidu.com"; Print_r (Parse_url ($url)); Sock_post ($purl, "parm=ping"); Fsocket Analog Get Commit function Sock_get ($url, $query) { $info = Parse_url ($url);

A PHP paging function

PHP Paging code calls: $start =show_page ($query, $page, $link, $offset); Where: $start is the starting record $query the SQL statement is retrieved for the full record $page is the page parameter passed for the current page number $link Offset

Traverse all files and folders under a folder PHP code

php traverse all files and folders under a folder function List_dir ($di rpath) { if ($dirpath [strlen ($dirpath) -1]!= "\ \") {$dirpath. = "\ \";} static $result _array=array (); if (Is_dir ($dirpath)) { $

PHP generates certificates, keys, and encrypts decrypted data through OpenSSL

About PHP generated certificate key information is really very few ah, check for a long, finally in the official documents found relevant information, and according to their own understanding, organized into the following code, divided into two

Generate a certain number of non-repeating random number of PHP code

Generate a certain number of non-repeating random numbers /* * Array Unique_rand (int $min, int $max, int $num) * Generate a certain number of non-repeating random numbers * $min and $max: Specify the

PHP Implementation 301 Permanent Redirection

The following code implements the 301 redirect, 301 redirect is a SEO friendly redirection method, its intention is to tell the search engine now access to the content has been transferred to another address.The following is a PHP implementation of

PHP uses Phpexcel to export Excel code

Vendor ("Phpexcel176.phpexcel"); Create New Phpexcel Object $objPHPExcel = new Phpexcel (); Set Properties $objPHPExcel->getproperties ()->setcreator ("CTOs") ->setlastmodifiedby ("CTOs") ->settitle ("Office" XLSX Test

Summary of common PHP date functions

PHP Common Date function Summary: including check the date format is legitimate, check whether the time is legitimate time, time comparison function, return two date a few seconds, minutes, hours or days. function Check_date

PHP classes that implement thumbnails and watermarks

/** * Picture shrinkage Water printing type * * @version 1.0; * */ Class Cls_photo { protected $waterrate = 0.2; The scale of the watermark icon on the picture protected $width = 300; Thumbnail default

PHP File Upload Sample code

Image upload $max _file_szie=2*pow (2,20); The uploaded file is less than 2MB $destination _folder= ' uploadimg/'; Upload File Save path if ($_server[' Request_method ']== ' POST ') { if

PHP generates thumbnail code

/********************** * @filename-path to the image * @tmpname-temporary path to thumbnail * @xmax-max width * @ymax-max Height */ function Resize_image ($filename, $tmpname, $xmax, $ymax) { $ext = Explode ("

A common method for recursive creation of multilevel directories by PHP

/** * +-------------------------------------------------------------------- * Description Create directory recursively +-------------------------------------------------------------------- * @param string $dir need an

PHP calculates the size of the entire MySQL database

PHP calculates the size of the connected MySQL database, which is returned in MB,KB or GB format function Calcfulldatabasesize ($database, $db) { $tables = Mysql_list_tables ($database, $db); if (! $tables) {return-1;}

Phpmailer sending mail

require './class.phpmailer.php '; $mail =new phpmailer (); $mail->contenttype= "text/html"; $mail->encoding= "base64"; $mail->issmtp (); $mail->host= "smtp.163.com"; $mail->smtpauth=true;

PHP implementation of simple Minesweeper game example

In this paper, we describe the simple game of minesweeper implemented by PHP. Share to everyone for your reference. Specific as follows: $init = $_post["init"];//game restart $clickvalue =

Analysis of the session in PHP may cause concurrency problems

In Web application development, people often use the session to store data. However, some people may not know that in PHP, the use of the session may cause concurrency problems. Plus91 Technologies Senior Engineer Kishan Gor, a software solutions

Total Pages: 5208 1 .... 3133 3134 3135 3136 3137 .... 5208 Go to: GO

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.