PHP Zoom image, code example

How to zoom image in php? Here is a quick recipe.

 
 
<?php
 
list($image_width, $image_height) = @getimagesize('xx.jpg');
$imgsrc = imagecreatefromjpeg('xx.jpg');
$towidth = 565;
$newwidth = $towidth ;
$newheight = ($image_height * $towidth )/$image_width;
$imgdst = imagecreatetruecolor($newwidth , $newheight );
 
$copy = @imagecopyresized($imgdst, $imgsrc, 0, 0, 0,0, $newwidth , $newheight , $image_width, $image_height );
 
imagejpeg($imgdst, 'yy.jpg');
imagedestroy($imgsrc);
imagedestroy($imgdst);
?>
 

PHP shell script example: How to open file effectively

How people usually open a file? First they have to locate it then double click it to launch the associated program or type file name in the terminal as parameter to the command.

What if the file you are handling reside in a very deep and complex directory tree.The file name can be very long. For example, the source code tree of large project. Below is part of jdk source code tree:

What if the file you are handling reside in a very deep and complex directory tree.The file name can be very long. For example, the source .

How to set the expire time of session and cookie in PHP

The login information can store in session or cookie. When store in session, the default expire time is when browser is closed.

Change the default by set the session.cookie_lifetime option in php.ini.

Previous Page 1 ... 4 5