Version 2.1.7

This commit is contained in:
Neo committed 2025-12-19 00:21:15 -08:00
1 parent 0eecc172d9
commit f73f8bff6d
941 files changed
+215301 -103093

No files matched your search

+162 -7
View File
@@ -2,16 +2,28 @@
/*
+--------------------------------------------------------------------------
| Invision Power Board v2.0.0
| Invision Power Board 2.1.7
| =============================================
| by Matthew Mecham
| (c) 2001 - 2004 Invision Power Services, Inc.
| (c) 2001 - 2005 Invision Power Services, Inc.
| http://www.invisionpower.com
| =============================================
| Web: http://www.invisionboard.com
| Time: Tue, 21 Sep 2004 16:34:28 GMT
| Release: 150aa7a702c3c8b6f6eb90ad49305d2f
| http://www.ibresource.ru/products/invisionpowerboard/
| Time: Tuesday 18th of July 2006 05:56:00 PM
| Release: 52f408a29988b02f45b5e6f4ba5af0ae
| Licence Info: http://www.invisionboard.com/?license
| http://www.ibresource.ru/license
+---------------------------------------------------------------------------
| INVISION POWER BOARD IS NOT FREE / OPEN SOURCE!
+---------------------------------------------------------------------------
| INVISION POWER BOARD ÍÅ ßÂËßÅÒÑß ÁÅÑÏËÀÒÍÛÌ ÏÐÎÃÐÀÌÌÍÛÌ ÎÁÅÑÏÅ×ÅÍÈÅÌ!
| Ïðàâà íà ÏÎ ïðèíàäëåæàò Invision Power Services
| Ïðàâà íà ïåðåâîä IBResource (http://www.ibresource.ru)
+---------------------------------------------------------------------------
| > $Date: 2005-10-10 14:03:20 +0100 (Mon, 10 Oct 2005) $
| > $Revision: 22 $
| > $Author: matt $
+---------------------------------------------------------------------------
|
| > GD / IMAGE handling methods (KERNEL)
@@ -22,20 +34,136 @@
+--------------------------------------------------------------------------
*/
/**
* IPS Kernel Pages: Image Class
*
* This class contains all generic functions to
* handle GD 1 & 2 thumbnail generation
*
* Example Usage:
* <code>
* $image = new class_image();
*
* $image->in_type = 'file';
* $image->out_type = 'file';
* $image->in_file_dir = './uploads';
* $image->in_file_name = 'somepicture.jpg';
* $image->desired_width = 200;
* $image->desired_height = 200;
* $image->gd_version = 2;
*
* $return = $image->generate_thumbnail();
*
* print_r( $return );
* // Prints
* Array( thumb_width => int
* thumb_height => int
* thumb_location => string )
* </code>
*
* @package IPS_KERNEL
* @author Matt Mecham
* @copyright Invision Power Services, Inc.
* @version 2.1
*/
/**
*
*/
/**
* Image Class
*
* Methods and functions for handling thumbnail generation
*
* @package IPS_KERNEL
* @author Matt Mecham
* @version 2.1
*/
class class_image
{
/**
* Type of incoming data
*
* @var string Type
*/
var $in_type = 'file';
/**
* Type of outgoing data
*
* @var string Type
*/
var $out_type = 'file';
/**
* Save file as...
*
* @var string File name
*/
var $out_file_name = '';
/**
* Save file in...
*
* @var string Directory
*/
var $out_file_dir = '';
/**
* In file directory
*
* @var string Directory
*/
var $in_file_dir = '.';
/**
* Name of input file name
*
* @var string File name
*/
var $in_file_name = '';
/**
* Complete file name with path
*
* @var string
*/
var $in_file_complete = '';
/**
* Max. thumbnail width
*
* @var integer Pixels
*/
var $desired_width = 0;
/**
* Max. thumbnail height
*
* @var integer Pixels
*/
var $desired_height = 0;
/**
* GD version
*
* @var integer GD version
*/
var $gd_version = 2;
/**
* Image type (PNG, JPG, GIF)
*
* @var string Image type
*/
var $image_type = '';
/**
* File extension
*
* @var string
*/
var $file_extension = '';
/*-------------------------------------------------------------------------*/
@@ -53,6 +181,11 @@ class class_image
// Clean paths
/*-------------------------------------------------------------------------*/
/**
* Cleans up paths, generates var $in_file_complete
*
* @return void
*/
function clean_paths()
{
$this->in_file_dir = preg_replace( "#/$#", "", $this->in_file_dir );
@@ -77,6 +210,11 @@ class class_image
// GENERATE THUMBNAIL
/*-------------------------------------------------------------------------*/
/**
* Generates thumnbail
*
* @return array [ thumb_width, thumb_height, thumb_location ]
*/
function generate_thumbnail()
{
$return = array();
@@ -126,7 +264,6 @@ class class_image
$this->show_non_gd();
}
}
//----------------------------------------------------
@@ -378,6 +515,13 @@ class class_image
// Show GD image
/*-------------------------------------------------------------------------*/
/**
* Show GD image
*
* @param string Thumbnail data
* @param string Thumbnail type (gif, png, jpg)
* @return void
*/
function show_image( $thumb, $type )
{
flush();
@@ -395,7 +539,7 @@ class class_image
@header('Content-Type: image/jpeg' );
}
print $data;
print $thumb;
exit();
}
@@ -404,6 +548,11 @@ class class_image
// Show non GD image
/*-------------------------------------------------------------------------*/
/**
* Show a NON GD image
*
* @return void
*/
function show_non_gd()
{
$file_extension = preg_replace( ".*\.(\w+)$", "\\1", $this->in_file_name );
@@ -414,7 +563,7 @@ class class_image
{
if ( $data = @file_get_contents( $this->in_file_complete ) )
{
$this->show_thumbnail( $data, $file_extension );
$this->show_image( $data, $file_extension );
}
}
}
@@ -424,6 +573,12 @@ class class_image
// Return scaled down image
/*-------------------------------------------------------------------------*/
/**
* Scale an image
*
* @param array [ cur_height, cur_width, max_width, max_height ]
* @return array [ img_height, img_width ]
*/
function scale_image($arg)
{
// max_width, max_height, cur_width, cur_height