View file down/pic.php

File size: 2.22Kb
<?php
include_once "../config.php";
include_once "../inc/inc.php";
include_once "../inc/func.php";
include_once "../inc/user.php";

$d = str_replace("../", "", $d);
$d = str_replace(" ", "", $d);
$d = str_replace("'", "", $d);
$d = str_replace("\"", "", $d);
$d = str_replace("%00", "", $d);
$d = str_replace("|", "/", $d);
$nameoffile = basename($d);
$tip = explode('.', $nameoffile);
$tip = array_reverse($tip);
if ($tip[0] == 'jpeg' || $tip[0] == 'jpg' || $tip[0] == 'jpe') {
    Header("Content-type: image/jpeg");
    $size = GetImageSize($d);
    $krat = $size[0] / 60;
    // $krat=(int)$krat;
    $x = $size[0] / $krat;
    $y = $size[1] / $krat;
    $x = (int)$x;
    $y = (int)$y;
    $img1 = imageCreateFromJpeg($d);
    // $img2=imageCreate($x, $y);
    $img2 = ImageCreateTrueColor($x, $y);
    imageCopyResized($img2, $img1, 0, 0, 0, 0, $x, $y, $size[0], $size[1]);
    // imageCopy($im2,$im1,0,0,0,0,$size[0],$size[1]);
    imageJpeg($img2);
    // imageJpeg($img2);
    imageDestroy($img1);
    imageDestroy($img2);
} 

if ($tip[0] == 'gif') {
    Header("Content-type: image/gif");
    $size = GetImageSize($d);
    $krat = $size[0] / 60;
    // $krat=(int)$krat;
    $x = $size[0] / $krat;
    $y = $size[1] / $krat;
    $x = (int)$x;
    $y = (int)$y;
    $img1 = imageCreateFromGif($d);
    // $img2=imageCreate($x, $y);
    $img2 = ImageCreateTrueColor($x, $y);
    imageCopyResized($img2, $img1, 0, 0, 0, 0, $x, $y, $size[0], $size[1]);
    // imageCopy($im2,$im1,0,0,0,0,$size[0],$size[1]);
    imageGif($img2);
    // imageJpeg($img2);
    imageDestroy($img1);
    imageDestroy($img2);
} 

if ($tip[0] == 'png') {
    Header("Content-type: image/png");
    $size = GetImageSize($d);
    $krat = $size[0] / 60;
    // $krat=(int)$krat;
    $x = $size[0] / $krat;
    $y = $size[1] / $krat;
    $x = (int)$x;
    $y = (int)$y;
    $img1 = imageCreateFromPng($d);
    // $img2=imageCreate($x, $y);
    $img2 = ImageCreateTrueColor($x, $y);
    imageCopyResized($img2, $img1, 0, 0, 0, 0, $x, $y, $size[0], $size[1]);
    // imageCopy($im2,$im1,0,0,0,0,$size[0],$size[1]);
    imagePng($img2);
    // imageJpeg($img2);
    imageDestroy($img1);
    imageDestroy($img2);
} 

?>