Просмотр файла nthprev.php

Размер файла: 1.54Kb
<?php
error_reporting(0);
include 'connect.php';
include 'functions.php';
include 'config.php';
$path=$_SERVER['PHP_SELF'];
$p=valid_number($p);
$res=mysql_query("SELECT * 
FROM `category`
WHERE `id`='$p'
LIMIT 1");
$arr = mysql_fetch_assoc($res);
$dec=urldecode($arr['array']);
$dec=unserialize($dec);
$f=$_GET['f'];
$f=valid_number($f);
$file=$dec[$f];
$size = 100;
include 'pclzip.lib.php';
$nth = new PclZip($file);
$content = $nth->extract(PCLZIP_OPT_BY_NAME,'theme_descriptor.xml',PCLZIP_OPT_EXTRACT_AS_STRING);
$content = $content[0]['content'];
$teg = simplexml_load_string($content)->wallpaper['src'] or $teg = simplexml_load_string($content)->wallpaper['main_display_graphics'];
$image_resourse = $nth->extract(PCLZIP_OPT_BY_NAME,"$teg",PCLZIP_OPT_EXTRACT_AS_STRING);
$image_resourse = $image_resourse[0]['content'];
$resource = imagecreatefromstring($image_resourse);
if ($resource)
{
$width = imageSX($resource);
$height = imageSY($resource);
$image = imagecreatetruecolor($size,$size);
if ( $width > $height )
{imagecopyresampled( $image, $resource, 0, 0, round( ( max( $width, $height ) - min( $width, $height ) ) / 2 ), 0, $size, $size, min( $width, $height ), min( $width, $height ) );}
if ( $width < $height )
{imagecopyresampled( $image, $resource, 0, 0, 0, 0, $size, $size, min( $width, $height ), min( $width, $height ) );}
if ( $width == $height )
{imagecopyresampled( $image, $resource, 0, 0, 0, 0, $size, $size, $width, $width );}
header( "Content-type:image/jpeg" );
imagejpeg($image);
imagedestroy( $image );
}
?>