!C99Shell v. 2.1 [PHP 8 Update] [02.02.2022]!

Software: Apache/2.4.53 (Unix) OpenSSL/1.1.1o PHP/7.4.29 mod_perl/2.0.12 Perl/v5.34.1. PHP/7.4.29 

uname -a: Linux vps-2738122-x 4.15.0-213-generic #224-Ubuntu SMP Mon Jun 19 13:30:12 UTC 2023 x86_64 

uid=1(daemon) gid=1(daemon) grupos=1(daemon) 

Safe-mode: OFF (not secure)

/opt/lampp/share/docs/   drwxr-xr-x
Free 14.48 GB of 61.93 GB (23.38%)
Home    Back    Forward    UPDIR    Refresh    Search    Buffer    Encoder    Tools    Proc.    FTP brute    Sec.    SQL    PHP-code    Update    Feedback    Self remove    Logout    


Viewing file:     copyrotated.c (1.81 KB)      -rw-r--r--
Select action/file-type:
(+) | (+) | (+) | Code (+) | Session (+) | (+) | SDB (+) | (+) | (+) | (+) | (+) | (+) |
/* $Id$ */
#include "gd.h"
#include <stdio.h>
#include <stdlib.h>
#include <math.h>

gdImagePtr loadImage(const char *name)
{
    FILE *fp;
    gdImagePtr im;

    fp = fopen(name, "rb");
    if (!fp) {
        fprintf(stderr, "Can't open jpeg file\n");
        return NULL;
    }

    im = gdImageCreateFromJpeg(fp);
    fclose(fp);
    return im;
}

int savePngImage(gdImagePtr im, const char *name)
{
    FILE *fp;
    fp = fopen(name, "wb");
    if (!fp) {
        fprintf(stderr, "Can't save png image fromtiff.png\n");
        return 0;
    }
    gdImagePng(im, fp);
    fclose(fp);
    return 1;
}

int main(int argc, char **arg)
{
    gdImagePtr im, im2;
    int new_width, new_height;
    double angle, a2;

    if (argc < 3) {
        fprintf(stderr, "Usage: copyrotated [angle in degree] [filename.png]\n");
        return 1;
    }
    angle = strtod(arg[1], 0);
    im = loadImage(arg[2]);

    if (!im) {
        fprintf(stderr, "Can't load PNG file <%s>", arg[1]);
        return 1;
    }

    /*
        cos adj hyp (cos = adjacent / hypothenus)
        sin op hyp (sin adjacent / hypothenus)
        + 10 pixels margin
     */

    /* to radian */
    a2 = angle * .0174532925;

    new_width = ceil(cos(a2) * gdImageSX(im)) +
                fabs(sin(a2) * gdImageSY(im));
    new_height = ceil(cos(a2) * gdImageSY(im)) +
                 fabs(sin(a2) * gdImageSX(im));


    im2 = gdImageCreateTrueColor(new_width, new_height);
    if (!im2) {
        fprintf(stderr, "Can't create a new image");
        gdImageDestroy(im);
        return 1;
    }

    gdImageAlphaBlending(im2, 0);
    gdImageFilledRectangle(im2, 0, 0, gdImageSX(im2), gdImageSY(im2), gdTrueColorAlpha(127,0,0,127));

    gdImageCopyRotated(im2, im, new_width/2, new_height/2, 0, 0, gdImageSX(im), gdImageSY(im), angle);
    gdImageSaveAlpha(im2, 1);
    if (!savePngImage(im2, "rotated.png")) {
        fprintf(stderr, "Can't save PNG file rotated.png");
        gdImageDestroy(im);
        gdImageDestroy(im2);
        return 1;
    }

    gdImageDestroy(im2);
    gdImageDestroy(im);
    return 0;
}

:: Command execute ::

Enter:
 
Select:
 

:: Search ::
  - regexp 

:: Upload ::
 
[ Read-Only ]

:: Make Dir ::
 
[ Read-Only ]
:: Make File ::
 
[ Read-Only ]

:: Go Dir ::
 
:: Go File ::
 

--[ c99shell v. 2.1 [PHP 8 Update] [02.02.2022] maintained byC99Shell Github | Generation time: 0.6019 ]--