(Experimental) Replace htmlarea with XINHA. Thanks to abdussamad!
@@ -0,0 +1,333 @@
|
||||
<?php
|
||||
/**
|
||||
* File Utilities.
|
||||
* @author $Author:koto $
|
||||
* @version $Id:Files.php 841 2007-05-27 13:31:51Z koto $
|
||||
* @package ImageManager
|
||||
*/
|
||||
|
||||
define('FILE_ERROR_NO_SOURCE', 100);
|
||||
define('FILE_ERROR_COPY_FAILED', 101);
|
||||
define('FILE_ERROR_DST_DIR_FAILED', 102);
|
||||
define('FILE_COPY_OK', 103);
|
||||
define('FILE_ERROR_DST_DIR_EXIST', 104);
|
||||
|
||||
/**
|
||||
* File Utilities
|
||||
* @author $Author:koto $
|
||||
* @version $Id:Files.php 841 2007-05-27 13:31:51Z koto $
|
||||
* @package ImageManager
|
||||
* @subpackage files
|
||||
*/
|
||||
class Files
|
||||
{
|
||||
|
||||
/**
|
||||
* Copy a file from source to destination. If unique == true, then if
|
||||
* the destination exists, it will be renamed by appending an increamenting
|
||||
* counting number.
|
||||
* @param string $source where the file is from, full path to the files required
|
||||
* @param string $destination_file name of the new file, just the filename
|
||||
* @param string $destination_dir where the files, just the destination dir,
|
||||
* e.g., /www/html/gallery/
|
||||
* @param boolean $unique create unique destination file if true.
|
||||
* @return string the new copied filename, else error if anything goes bad.
|
||||
*/
|
||||
function copyFile($source, $destination_dir, $destination_file, $unique=true)
|
||||
{
|
||||
if(!(file_exists($source) && is_file($source)))
|
||||
return FILE_ERROR_NO_SOURCE;
|
||||
|
||||
$destination_dir = Files::fixPath($destination_dir);
|
||||
|
||||
if(!is_dir($destination_dir))
|
||||
Return FILE_ERROR_DST_DIR_FAILED;
|
||||
|
||||
$filename = Files::escape($destination_file);
|
||||
|
||||
if($unique)
|
||||
{
|
||||
$dotIndex = strrpos($destination_file, '.');
|
||||
$ext = '';
|
||||
if(is_int($dotIndex))
|
||||
{
|
||||
$ext = substr($destination_file, $dotIndex);
|
||||
$base = substr($destination_file, 0, $dotIndex);
|
||||
}
|
||||
$counter = 0;
|
||||
while(is_file($destination_dir.$filename))
|
||||
{
|
||||
$counter++;
|
||||
$filename = $base.'_'.$counter.$ext;
|
||||
}
|
||||
}
|
||||
|
||||
if (!copy($source, $destination_dir.$filename))
|
||||
return FILE_ERROR_COPY_FAILED;
|
||||
|
||||
//verify that it copied, new file must exists
|
||||
if (is_file($destination_dir.$filename))
|
||||
Return $filename;
|
||||
else
|
||||
return FILE_ERROR_COPY_FAILED;
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a new folder.
|
||||
* @param string $newFolder specifiy the full path of the new folder.
|
||||
* @return boolean true if the new folder is created, false otherwise.
|
||||
*/
|
||||
function createFolder($newFolder)
|
||||
{
|
||||
mkdir ($newFolder, 0777);
|
||||
return chmod($newFolder, 0777);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Escape the filenames, any non-word characters will be
|
||||
* replaced by an underscore.
|
||||
* @param string $filename the orginal filename
|
||||
* @return string the escaped safe filename
|
||||
*/
|
||||
function escape($filename)
|
||||
{
|
||||
Return preg_replace('/[^\w\._]/', '_', $filename);
|
||||
}
|
||||
|
||||
/**
|
||||
* Delete a file.
|
||||
* @param string $file file to be deleted
|
||||
* @return boolean true if deleted, false otherwise.
|
||||
*/
|
||||
function delFile($file)
|
||||
{
|
||||
if(is_file($file))
|
||||
Return unlink($file);
|
||||
else
|
||||
Return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Delete folder(s), can delete recursively.
|
||||
* @param string $folder the folder to be deleted.
|
||||
* @param boolean $recursive if true, all files and sub-directories
|
||||
* are delete. If false, tries to delete the folder, can throw
|
||||
* error if the directory is not empty.
|
||||
* @return boolean true if deleted.
|
||||
*/
|
||||
function delFolder($folder, $recursive=false)
|
||||
{
|
||||
$deleted = true;
|
||||
if($recursive)
|
||||
{
|
||||
$d = dir($folder);
|
||||
while (false !== ($entry = $d->read()))
|
||||
{
|
||||
if ($entry != '.' && $entry != '..')
|
||||
{
|
||||
$obj = Files::fixPath($folder).$entry;
|
||||
//var_dump($obj);
|
||||
if (is_file($obj))
|
||||
{
|
||||
$deleted &= Files::delFile($obj);
|
||||
}
|
||||
else if(is_dir($obj))
|
||||
{
|
||||
$deleted &= Files::delFolder($obj, $recursive);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
$d->close();
|
||||
|
||||
}
|
||||
|
||||
//$folder= $folder.'/thumbs';
|
||||
//var_dump($folder);
|
||||
if(is_dir($folder))
|
||||
$deleted &= rmdir($folder);
|
||||
else
|
||||
$deleted &= false;
|
||||
|
||||
Return $deleted;
|
||||
}
|
||||
|
||||
/**
|
||||
* Append a / to the path if required.
|
||||
* @param string $path the path
|
||||
* @return string path with trailing /
|
||||
*/
|
||||
function fixPath($path)
|
||||
{
|
||||
//append a slash to the path if it doesn't exists.
|
||||
if(!(substr($path,-1) == '/'))
|
||||
$path .= '/';
|
||||
Return $path;
|
||||
}
|
||||
|
||||
/**
|
||||
* Concat two paths together. Basically $pathA+$pathB
|
||||
* @param string $pathA path one
|
||||
* @param string $pathB path two
|
||||
* @return string a trailing slash combinded path.
|
||||
*/
|
||||
function makePath($pathA, $pathB)
|
||||
{
|
||||
$pathA = Files::fixPath($pathA);
|
||||
if(substr($pathB,0,1)=='/')
|
||||
$pathB = substr($pathB,1);
|
||||
Return Files::fixPath($pathA.$pathB);
|
||||
}
|
||||
|
||||
/**
|
||||
* Similar to makePath, but the second parameter
|
||||
* is not only a path, it may contain say a file ending.
|
||||
* @param string $pathA the leading path
|
||||
* @param string $pathB the ending path with file
|
||||
* @return string combined file path.
|
||||
*/
|
||||
function makeFile($pathA, $pathB)
|
||||
{
|
||||
$pathA = Files::fixPath($pathA);
|
||||
if(substr($pathB,0,1)=='/')
|
||||
$pathB = substr($pathB,1);
|
||||
|
||||
Return $pathA.$pathB;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Format the file size, limits to Mb.
|
||||
* @param int $size the raw filesize
|
||||
* @return string formated file size.
|
||||
*/
|
||||
function formatSize($size)
|
||||
{
|
||||
if($size < 1024)
|
||||
return $size.' bytes';
|
||||
else if($size >= 1024 && $size < 1024*1024)
|
||||
return sprintf('%01.2f',$size/1024.0).' KB';
|
||||
else
|
||||
return sprintf('%01.2f',$size/(1024.0*1024)).' MB';
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns size of a directory, with all file & subdirectory
|
||||
* sizes added up
|
||||
* @param string dir path
|
||||
* @return int
|
||||
*/
|
||||
function dirSize($dirName = '.')
|
||||
{
|
||||
$dir = dir($dirName);
|
||||
$size = 0;
|
||||
|
||||
while ($file = $dir->read()) {
|
||||
if ($file != '.' && $file != '..')
|
||||
{
|
||||
if (is_dir("$dirName$file"))
|
||||
{
|
||||
$size += Files::dirSize($dirName . '/' . $file);
|
||||
}
|
||||
else
|
||||
{
|
||||
$size += filesize($dirName . '/' . $file);
|
||||
}
|
||||
}
|
||||
}
|
||||
$dir->close();
|
||||
return $size;
|
||||
}
|
||||
|
||||
/**
|
||||
* Renames file, preserving its directory and extension
|
||||
* @param string $oldPath path to the old existing file
|
||||
* @param string new filename (just the name, without path or extension)
|
||||
* @author Krzysztof Kotowicz <koto@webworkers.pl>
|
||||
*/
|
||||
function renameFile($oldPath, $newName) {
|
||||
|
||||
if(!(file_exists($oldPath) && is_file($oldPath)))
|
||||
return FILE_ERROR_NO_SOURCE;
|
||||
|
||||
$oldFileParts = pathinfo($oldPath);
|
||||
|
||||
$newPath = $oldFileParts['dirname'] . '/'
|
||||
. $newName
|
||||
. (!empty($oldFileParts['extension']) ? '.' . $oldFileParts['extension'] : '');
|
||||
|
||||
if (file_exists($newPath))
|
||||
return false;
|
||||
|
||||
if (!rename($oldPath, $newPath))
|
||||
return FILE_ERROR_COPY_FAILED;
|
||||
|
||||
}
|
||||
|
||||
function rename ($oldPath,$newPath)
|
||||
{
|
||||
if(!(is_dir($oldPath) || is_file($oldPath)))
|
||||
return FILE_ERROR_NO_SOURCE;
|
||||
|
||||
if (file_exists($newPath))
|
||||
return FILE_ERROR_DST_DIR_EXIST;
|
||||
|
||||
$ret = rename($oldPath, $newPath);
|
||||
if (!$ret)
|
||||
return FILE_ERROR_COPY_FAILED;
|
||||
else return FILE_COPY_OK;
|
||||
}
|
||||
|
||||
/**
|
||||
* copy a directory and all subdirectories and files (recursive)
|
||||
* @author SBoisvert at Don'tSpamMe dot Bryxal dot ca (adapted from php.net)
|
||||
* @author Raimund Meyer
|
||||
* @param string base path
|
||||
* @param string source directory
|
||||
* @param string destination directory
|
||||
* @param bool overwrite existing files
|
||||
*
|
||||
* @return mixed bool true on pass, number on fail
|
||||
*/
|
||||
function copyDir($basePath, $source, $dest, $overwrite = false)
|
||||
{
|
||||
if(!is_dir($basePath . $dest))
|
||||
{
|
||||
if (!@mkdir($basePath . $dest)) return FILE_ERROR_DST_DIR_FAILED;
|
||||
}
|
||||
if($handle = opendir($basePath . $source))
|
||||
{ // if the folder exploration is sucsessful, continue
|
||||
while( ($file = readdir($handle)) !== false)
|
||||
{ // as long as storing the next file to $file is successful, continue
|
||||
if($file != '.' && $file != '..')
|
||||
{
|
||||
$path = $source . '/' . $file;
|
||||
if(is_file($basePath . $path))
|
||||
{
|
||||
/*if(!is_file($basePath . $dest . '/' . $file) || $overwrite)
|
||||
{
|
||||
if(!@copy($basePath . $path, $basePath . $dest . '/' . $file))
|
||||
{
|
||||
return FILE_ERROR_COPY_FAILED;
|
||||
}
|
||||
}*/
|
||||
Files::copyFile($basePath . $path, $basePath . $dest . '/', $file, true);
|
||||
}
|
||||
elseif(is_dir($basePath . $path))
|
||||
{
|
||||
if(!is_dir($basePath . $dest . '/' . $file))
|
||||
{
|
||||
mkdir($basePath . $dest . '/' . $file); // make subdirectory before subdirectory is copied
|
||||
Files::copyDir($basePath, $path, $dest . '/' . $file, $overwrite); //recurse!
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
closedir($handle);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
@@ -0,0 +1,597 @@
|
||||
<?php
|
||||
/***********************************************************************
|
||||
** Title.........: GD Driver
|
||||
** Version.......: 1.0
|
||||
** Author........: Xiang Wei ZHUO <wei@zhuo.org>
|
||||
** Filename......: GD.php
|
||||
** Last changed..: 30 Aug 2003
|
||||
** Notes.........: Orginal is from PEAR
|
||||
**/
|
||||
// +----------------------------------------------------------------------+
|
||||
// | PHP Version 4 |
|
||||
// +----------------------------------------------------------------------+
|
||||
// | Copyright (c) 1997-2002 The PHP Group |
|
||||
// +----------------------------------------------------------------------+
|
||||
// | This source file is subject to version 2.02 of the PHP license, |
|
||||
// | that is bundled with this package in the file LICENSE, and is |
|
||||
// | available at through the world-wide-web at |
|
||||
// | http://www.php.net/license/2_02.txt. |
|
||||
// | If you did not receive a copy of the PHP license and are unable to |
|
||||
// | obtain it through the world-wide-web, please send a note to |
|
||||
// | license@php.net so we can mail you a copy immediately. |
|
||||
// +----------------------------------------------------------------------+
|
||||
// | Authors: Peter Bowyer <peter@mapledesign.co.uk> |
|
||||
// | Alan Knowles <alan@akbkhome.com> |
|
||||
// +----------------------------------------------------------------------+
|
||||
//
|
||||
// Usage :
|
||||
// $img = new Image_Transform_GD();
|
||||
// $angle = -78;
|
||||
// $img->load('magick.png');
|
||||
//
|
||||
// if($img->rotate($angle,array('autoresize'=>true,'color_mask'=>array(255,0,0)))){
|
||||
// $img->addText(array('text'=>"Rotation $angle",'x'=>0,'y'=>100,'font'=>'/usr/share/fonts/default/TrueType/cogb____.ttf'));
|
||||
// $img->display();
|
||||
// } else {
|
||||
// echo "Error";
|
||||
// }
|
||||
//
|
||||
//
|
||||
// $Id:GD.php 938 2008-01-22 20:13:47Z ray $
|
||||
//
|
||||
// Image Transformation interface using the GD library
|
||||
//
|
||||
|
||||
require_once "../ImageManager/Classes/Transform.php";
|
||||
|
||||
Class Image_Transform_Driver_GD extends Image_Transform
|
||||
{
|
||||
/**
|
||||
* Holds the image file for manipulation
|
||||
*/
|
||||
var $imageHandle = '';
|
||||
|
||||
/**
|
||||
* Holds the original image file
|
||||
*/
|
||||
var $old_image = '';
|
||||
|
||||
/**
|
||||
* Check settings
|
||||
*
|
||||
* @return mixed true or or a PEAR error object on error
|
||||
*
|
||||
* @see PEAR::isError()
|
||||
*/
|
||||
function Image_Transform_GD()
|
||||
{
|
||||
return;
|
||||
} // End function Image
|
||||
|
||||
/**
|
||||
* Load image
|
||||
*
|
||||
* @param string filename
|
||||
*
|
||||
* @return mixed none or a PEAR error object on error
|
||||
* @see PEAR::isError()
|
||||
*/
|
||||
function load($image)
|
||||
{
|
||||
$this->uid = md5($_SERVER['REMOTE_ADDR']);
|
||||
$this->image = $image;
|
||||
$this->_get_image_details($image);
|
||||
$functionName = 'ImageCreateFrom' . $this->type;
|
||||
|
||||
if(function_exists($functionName))
|
||||
{
|
||||
$this->imageHandle = $functionName($this->image);
|
||||
if ( $this->type == 'png')
|
||||
{
|
||||
imageAlphaBlending($this->imageHandle, false);
|
||||
imageSaveAlpha($this->imageHandle, true);
|
||||
}
|
||||
}
|
||||
} // End load
|
||||
|
||||
/**
|
||||
* addText
|
||||
*
|
||||
* @param array options Array contains options
|
||||
* array(
|
||||
* 'text' The string to draw
|
||||
* 'x' Horizontal position
|
||||
* 'y' Vertical Position
|
||||
* 'Color' Font color
|
||||
* 'font' Font to be used
|
||||
* 'size' Size of the fonts in pixel
|
||||
* 'resize_first' Tell if the image has to be resized
|
||||
* before drawing the text
|
||||
* )
|
||||
*
|
||||
* @return none
|
||||
* @see PEAR::isError()
|
||||
*/
|
||||
function addText($params)
|
||||
{
|
||||
$default_params = array(
|
||||
'text' => 'This is Text',
|
||||
'x' => 10,
|
||||
'y' => 20,
|
||||
'color' => array(255,0,0),
|
||||
'font' => 'Arial.ttf',
|
||||
'size' => '12',
|
||||
'angle' => 0,
|
||||
'resize_first' => false // Carry out the scaling of the image before annotation? Not used for GD
|
||||
);
|
||||
$params = array_merge($default_params, $params);
|
||||
extract($params);
|
||||
|
||||
if( !is_array($color) ){
|
||||
if ($color[0]=='#'){
|
||||
$this->colorhex2colorarray( $color );
|
||||
} else {
|
||||
include_once('Image/Transform/Driver/ColorsDefs.php');
|
||||
$color = isset($colornames[$color])?$colornames[$color]:false;
|
||||
}
|
||||
}
|
||||
|
||||
$c = imagecolorresolve ($this->imageHandle, $color[0], $color[1], $color[2]);
|
||||
|
||||
if ('ttf' == substr($font, -3)) {
|
||||
ImageTTFText($this->imageHandle, $size, $angle, $x, $y, $c, $font, $text);
|
||||
} else {
|
||||
ImagePSText($this->imageHandle, $size, $angle, $x, $y, $c, $font, $text);
|
||||
}
|
||||
return true;
|
||||
} // End addText
|
||||
|
||||
|
||||
/**
|
||||
* Rotate image by the given angle
|
||||
* Uses a fast rotation algorythm for custom angles
|
||||
* or lines copy for multiple of 90 degrees
|
||||
*
|
||||
* @param int $angle Rotation angle
|
||||
* @param array $options array( 'autoresize'=>true|false,
|
||||
* 'color_mask'=>array(r,g,b), named color or #rrggbb
|
||||
* )
|
||||
* @author Pierre-Alain Joye
|
||||
* @return mixed none or a PEAR error object on error
|
||||
* @see PEAR::isError()
|
||||
*/
|
||||
function rotate($angle, $options=null)
|
||||
{
|
||||
if(function_exists('imagerotate')) {
|
||||
$white = imagecolorallocatealpha ($this->imageHandle, 255, 255, 255, 127);
|
||||
$this->imageHandle = imagerotate($this->imageHandle, $angle, $white);
|
||||
return true;
|
||||
}
|
||||
|
||||
if ( $options==null ){
|
||||
$autoresize = true;
|
||||
$color_mask = array(105,255,255);
|
||||
} else {
|
||||
extract( $options );
|
||||
}
|
||||
|
||||
while ($angle <= -45) {
|
||||
$angle += 360;
|
||||
}
|
||||
while ($angle > 270) {
|
||||
$angle -= 360;
|
||||
}
|
||||
|
||||
$t = deg2rad($angle);
|
||||
|
||||
if( !is_array($color_mask) ){
|
||||
if ($color[0]=='#'){
|
||||
$this->colorhex2colorarray( $color_mask );
|
||||
} else {
|
||||
include_once('Image/Transform/Driver/ColorDefs.php');
|
||||
$color = isset($colornames[$color_mask])?$colornames[$color_mask]:false;
|
||||
}
|
||||
}
|
||||
|
||||
// Do not round it, too much lost of quality
|
||||
$cosT = cos($t);
|
||||
$sinT = sin($t);
|
||||
|
||||
$img =& $this->imageHandle;
|
||||
|
||||
$width = $max_x = $this->img_x;
|
||||
$height = $max_y = $this->img_y;
|
||||
$min_y = 0;
|
||||
$min_x = 0;
|
||||
|
||||
$x1 = round($max_x/2,0);
|
||||
$y1 = round($max_y/2,0);
|
||||
|
||||
if ( $autoresize ){
|
||||
$t = abs($t);
|
||||
$a = round($angle,0);
|
||||
switch((int)($angle)){
|
||||
case 0:
|
||||
$width2 = $width;
|
||||
$height2 = $height;
|
||||
break;
|
||||
case 90:
|
||||
$width2 = $height;
|
||||
$height2 = $width;
|
||||
break;
|
||||
case 180:
|
||||
$width2 = $width;
|
||||
$height2 = $height;
|
||||
break;
|
||||
case 270:
|
||||
$width2 = $height;
|
||||
$height2 = $width;
|
||||
break;
|
||||
default:
|
||||
$width2 = (int)(abs(sin($t) * $height + cos($t) * $width));
|
||||
$height2 = (int)(abs(cos($t) * $height+sin($t) * $width));
|
||||
}
|
||||
|
||||
$width2 -= $width2%2;
|
||||
$height2 -= $height2%2;
|
||||
|
||||
$d_width = abs($width - $width2);
|
||||
$d_height = abs($height - $height2);
|
||||
$x_offset = $d_width/2;
|
||||
$y_offset = $d_height/2;
|
||||
$min_x2 = -abs($x_offset);
|
||||
$min_y2 = -abs($y_offset);
|
||||
$max_x2 = $width2;
|
||||
$max_y2 = $height2;
|
||||
}
|
||||
|
||||
$img2 = @$this->newImgPreserveAlpha( imagecreateTrueColor($width2,$height2) );
|
||||
|
||||
if ( !is_resource($img2) ){
|
||||
return false;/*PEAR::raiseError('Cannot create buffer for the rotataion.',
|
||||
null, PEAR_ERROR_TRIGGER, E_USER_NOTICE);*/
|
||||
}
|
||||
|
||||
$this->img_x = $width2;
|
||||
$this->img_y = $height2;
|
||||
|
||||
|
||||
imagepalettecopy($img2,$img);
|
||||
|
||||
$mask = imagecolorallocatealpha ($img2,$color_mask[0],$color_mask[1],$color_mask[2],127);
|
||||
// use simple lines copy for axes angles
|
||||
switch((int)($angle)){
|
||||
case 0:
|
||||
imagefill ($img2, 0, 0,$mask);
|
||||
for ($y=0; $y < $max_y; $y++) {
|
||||
for ($x = $min_x; $x < $max_x; $x++){
|
||||
$c = @imagecolorat ( $img, $x, $y);
|
||||
imagesetpixel($img2,$x+$x_offset,$y+$y_offset,$c);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 90:
|
||||
imagefill ($img2, 0, 0,$mask);
|
||||
for ($x = $min_x; $x < $max_x; $x++){
|
||||
for ($y=$min_y; $y < $max_y; $y++) {
|
||||
$c = imagecolorat ( $img, $x, $y);
|
||||
imagesetpixel($img2,$max_y-$y-1,$x,$c);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 180:
|
||||
imagefill ($img2, 0, 0,$mask);
|
||||
for ($y=0; $y < $max_y; $y++) {
|
||||
for ($x = $min_x; $x < $max_x; $x++){
|
||||
$c = @imagecolorat ( $img, $x, $y);
|
||||
imagesetpixel($img2, $max_x2-$x-1, $max_y2-$y-1, $c);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 270:
|
||||
imagefill ($img2, 0, 0,$mask);
|
||||
for ($y=0; $y < $max_y; $y++) {
|
||||
for ($x = $max_x; $x >= $min_x; $x--){
|
||||
$c = @imagecolorat ( $img, $x, $y);
|
||||
imagesetpixel($img2,$y,$max_x-$x-1,$c);
|
||||
}
|
||||
}
|
||||
break;
|
||||
// simple reverse rotation algo
|
||||
default:
|
||||
$i=0;
|
||||
for ($y = $min_y2; $y < $max_y2; $y++){
|
||||
|
||||
// Algebra :)
|
||||
$x2 = round((($min_x2-$x1) * $cosT) + (($y-$y1) * $sinT + $x1),0);
|
||||
$y2 = round((($y-$y1) * $cosT - ($min_x2-$x1) * $sinT + $y1),0);
|
||||
|
||||
for ($x = $min_x2; $x < $max_x2; $x++){
|
||||
|
||||
// Check if we are out of original bounces, if we are
|
||||
// use the default color mask
|
||||
if ( $x2>=0 && $x2<$max_x && $y2>=0 && $y2<$max_y ){
|
||||
$c = imagecolorat ( $img, $x2, $y2);
|
||||
} else {
|
||||
$c = $mask;
|
||||
}
|
||||
imagesetpixel($img2,$x+$x_offset,$y+$y_offset,$c);
|
||||
|
||||
// round verboten!
|
||||
$x2 += $cosT;
|
||||
$y2 -= $sinT;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
$this->old_image = $this->imageHandle;
|
||||
$this->imageHandle = $img2;
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Resize Action
|
||||
*
|
||||
* For GD 2.01+ the new copyresampled function is used
|
||||
* It uses a bicubic interpolation algorithm to get far
|
||||
* better result.
|
||||
*
|
||||
* @param int $new_x new width
|
||||
* @param int $new_y new height
|
||||
*
|
||||
* @return true on success or pear error
|
||||
* @see PEAR::isError()
|
||||
*/
|
||||
function _resize($new_x, $new_y) {
|
||||
if ($this->resized === true) {
|
||||
return false; /*PEAR::raiseError('You have already resized the image without saving it. Your previous resizing will be overwritten', null, PEAR_ERROR_TRIGGER, E_USER_NOTICE);*/
|
||||
}
|
||||
if(function_exists('ImageCreateTrueColor')){
|
||||
$new_img = $this->newImgPreserveAlpha( ImageCreateTrueColor($new_x,$new_y) );
|
||||
} else {
|
||||
$new_img =ImageCreate($new_x,$new_y);
|
||||
}
|
||||
|
||||
if(function_exists('ImageCopyResampled')){
|
||||
ImageCopyResampled($new_img, $this->imageHandle, 0, 0, 0, 0, $new_x, $new_y, $this->img_x, $this->img_y);
|
||||
} else {
|
||||
ImageCopyResized($new_img, $this->imageHandle, 0, 0, 0, 0, $new_x, $new_y, $this->img_x, $this->img_y);
|
||||
}
|
||||
|
||||
$this->old_image = $this->imageHandle;
|
||||
$this->imageHandle = $new_img;
|
||||
$this->resized = true;
|
||||
|
||||
$this->new_x = $new_x;
|
||||
$this->new_y = $new_y;
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Crop the image
|
||||
*
|
||||
* @param int $crop_x left column of the image
|
||||
* @param int $crop_y top row of the image
|
||||
* @param int $crop_width new cropped image width
|
||||
* @param int $crop_height new cropped image height
|
||||
*/
|
||||
function crop($new_x, $new_y, $new_width, $new_height)
|
||||
{
|
||||
if(function_exists('ImageCreateTrueColor')){
|
||||
$new_img = $this->newImgPreserveAlpha(ImageCreateTrueColor($new_width,$new_height));
|
||||
} else {
|
||||
$new_img =ImageCreate($new_width,$new_height);
|
||||
}
|
||||
if(function_exists('ImageCopyResampled')){
|
||||
ImageCopyResampled($new_img, $this->imageHandle, 0, 0, $new_x, $new_y,$new_width,$new_height,$new_width,$new_height);
|
||||
} else {
|
||||
ImageCopyResized($new_img, $this->imageHandle, 0, 0, $new_x, $new_y, $new_width,$new_height,$new_width,$new_height);
|
||||
}
|
||||
$this->old_image = $this->imageHandle;
|
||||
$this->imageHandle = $new_img;
|
||||
$this->resized = true;
|
||||
|
||||
$this->new_x = $new_x;
|
||||
$this->new_y = $new_y;
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Flip the image horizontally or vertically
|
||||
*
|
||||
* @param boolean $horizontal true if horizontal flip, vertical otherwise
|
||||
*/
|
||||
function flip($horizontal)
|
||||
{
|
||||
if(!$horizontal) {
|
||||
$this->rotate(180);
|
||||
}
|
||||
|
||||
$width = imagesx($this->imageHandle);
|
||||
$height = imagesy($this->imageHandle);
|
||||
|
||||
for ($j = 0; $j < $height; $j++) {
|
||||
$left = 0;
|
||||
$right = $width-1;
|
||||
|
||||
|
||||
while ($left < $right) {
|
||||
//echo " j:".$j." l:".$left." r:".$right."\n<br>";
|
||||
$t = imagecolorat($this->imageHandle, $left, $j);
|
||||
imagesetpixel($this->imageHandle, $left, $j, imagecolorat($this->imageHandle, $right, $j));
|
||||
imagesetpixel($this->imageHandle, $right, $j, $t);
|
||||
$left++; $right--;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Adjust the image gamma
|
||||
*
|
||||
* @param float $outputgamma
|
||||
*
|
||||
* @return none
|
||||
*/
|
||||
function gamma($outputgamma=1.0) {
|
||||
ImageGammaCorrect($this->imageHandle, 1.0, $outputgamma);
|
||||
}
|
||||
function paletteToTrueColorWithTransparency()
|
||||
{
|
||||
$oldImg = $this->imageHandle;
|
||||
$newImg = $this->newImgPreserveAlpha( imagecreatetruecolor($this->img_x,$this->img_y) );
|
||||
imagecopy($newImg,$oldImg,0,0,0,0,$this->img_x,$this->img_y);
|
||||
|
||||
$this->imageHandle = $newImg;
|
||||
}
|
||||
|
||||
function newImgPreserveAlpha($newImg)
|
||||
{
|
||||
if ( $this->type == 'jpeg') return $newImg;
|
||||
|
||||
// Turn off transparency blending (temporarily)
|
||||
imagealphablending($newImg, false);
|
||||
|
||||
// Create a new transparent color for image
|
||||
if ( $transparent = imagecolortransparent($this->imageHandle) >= 0 )
|
||||
{
|
||||
if (imageistruecolor($this->imageHandle))
|
||||
{
|
||||
$red = ($transparent & 0xFF0000) >> 16;
|
||||
$green = ($transparent & 0x00FF00) >> 8;
|
||||
$blue = ($transparent & 0x0000FF);
|
||||
$color_values = array('red' => $red, 'green' => $green, 'blue' => $blue);
|
||||
}
|
||||
else
|
||||
{
|
||||
$color_values = imagecolorsforindex($this->imageHandle,$transparent);
|
||||
|
||||
}
|
||||
$color_values = imagecolorsforindex($this->imageHandle,$transparent);
|
||||
$color = imagecolorallocatealpha($newImg, $color_values['red'],$color_values['green'],$color_values['blue'], 127);
|
||||
$colort = imagecolorallocate($newImg, $color_values['red'],$color_values['green'],$color_values['blue']);
|
||||
}
|
||||
else
|
||||
{
|
||||
$color = imagecolorallocatealpha($newImg, 252, 2, 252, 127);
|
||||
$colort = imagecolorallocate($newImg, 252, 2, 252);
|
||||
}
|
||||
imagecolortransparent($newImg,$colort);
|
||||
|
||||
// Completely fill the background of the new image with allocated color.
|
||||
imagefill($newImg, 0, 0, $color);
|
||||
|
||||
// Restore transparency blending
|
||||
imagesavealpha($newImg, true);
|
||||
|
||||
return $newImg;
|
||||
}
|
||||
|
||||
function preserveTransparencyForPalette()
|
||||
{
|
||||
$new_img = imagecreatetruecolor($this->img_x,$this->img_y);
|
||||
$truecolor = imageistruecolor($this->imageHandle);
|
||||
$transparent = imagecolorallocate($new_img, 252,2,252); // nasty pinkish purple that hopefully doesn't exist in the image
|
||||
|
||||
imagecolortransparent($new_img, $transparent);
|
||||
for ($i=0;$i<$this->img_y;$i++)
|
||||
{
|
||||
for ($j=0;$j<$this->img_x;$j++)
|
||||
{
|
||||
$c = imagecolorat($this->imageHandle,$j, $i);
|
||||
if ($truecolor)
|
||||
{
|
||||
$a = ($c >> 24) & 0xFF;
|
||||
$r = ($c >> 16) & 0xFF;
|
||||
$g = ($c >> 8) & 0xFF;
|
||||
$b = $c & 0xFF;
|
||||
$color_values = array('red' => $r, 'green' => $g, 'blue' => $b, 'alpha' => $a);
|
||||
}
|
||||
else
|
||||
{
|
||||
$color_values = imagecolorsforindex($this->imageHandle,$c);
|
||||
}
|
||||
if ($color_values['alpha'] >= 126)
|
||||
{
|
||||
imagesetpixel($new_img, $j, $i, $transparent);
|
||||
}
|
||||
else
|
||||
{
|
||||
imagesetpixel($new_img, $j, $i, $c);
|
||||
}
|
||||
}
|
||||
}
|
||||
$this->imageHandle = $new_img;
|
||||
}
|
||||
|
||||
/**
|
||||
* Save the image file
|
||||
*
|
||||
* @param string $filename the name of the file to write to
|
||||
* @param int $quality output DPI, default is 85
|
||||
* @param string $types define the output format, default
|
||||
* is the current used format
|
||||
*
|
||||
* @return none
|
||||
*/
|
||||
function save($filename, $type = '', $quality = 85)
|
||||
{
|
||||
$type = $type==''? $this->type : $type;
|
||||
$functionName = 'image' . $type;
|
||||
|
||||
if(function_exists($functionName))
|
||||
{
|
||||
$this->old_image = $this->imageHandle;
|
||||
if($type=='jpeg')
|
||||
$functionName($this->imageHandle, $filename, $quality);
|
||||
else
|
||||
$functionName($this->imageHandle, $filename);
|
||||
$this->imageHandle = $this->old_image;
|
||||
$this->resized = false;
|
||||
}
|
||||
} // End save
|
||||
|
||||
|
||||
/**
|
||||
* Display image without saving and lose changes
|
||||
*
|
||||
* @param string type (JPG,PNG...);
|
||||
* @param int quality 75
|
||||
*
|
||||
* @return none
|
||||
*/
|
||||
function display($type = '', $quality = 75)
|
||||
{
|
||||
if ($type != '') {
|
||||
$this->type = $type;
|
||||
}
|
||||
$functionName = 'Image' . $this->type;
|
||||
if(function_exists($functionName))
|
||||
{
|
||||
header('Content-type: image/' . strtolower($this->type));
|
||||
$functionName($this->imageHandle, '', $quality);
|
||||
$this->imageHandle = $this->old_image;
|
||||
$this->resized = false;
|
||||
ImageDestroy($this->old_image);
|
||||
$this->free();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Destroy image handle
|
||||
*
|
||||
* @return none
|
||||
*/
|
||||
function free()
|
||||
{
|
||||
if ($this->imageHandle){
|
||||
ImageDestroy($this->imageHandle);
|
||||
}
|
||||
}
|
||||
|
||||
} // End class ImageGD
|
||||
?>
|
||||
@@ -0,0 +1,239 @@
|
||||
<?php
|
||||
|
||||
/***********************************************************************
|
||||
** Title.........: ImageMagick Driver
|
||||
** Version.......: 1.0
|
||||
** Author........: Xiang Wei ZHUO <wei@zhuo.org>
|
||||
** Filename......: IM.php
|
||||
** Last changed..: 30 Aug 2003
|
||||
** Notes.........: Orginal is from PEAR
|
||||
**/
|
||||
|
||||
// +----------------------------------------------------------------------+
|
||||
// | PHP Version 4 |
|
||||
// +----------------------------------------------------------------------+
|
||||
// | Copyright (c) 1997-2002 The PHP Group |
|
||||
// +----------------------------------------------------------------------+
|
||||
// | This source file is subject to version 2.02 of the PHP license, |
|
||||
// | that is bundled with this package in the file LICENSE, and is |
|
||||
// | available at through the world-wide-web at |
|
||||
// | http://www.php.net/license/2_02.txt. |
|
||||
// | If you did not receive a copy of the PHP license and are unable to |
|
||||
// | obtain it through the world-wide-web, please send a note to |
|
||||
// | license@php.net so we can mail you a copy immediately. |
|
||||
// +----------------------------------------------------------------------+
|
||||
// | Authors: Peter Bowyer <peter@mapledesign.co.uk> |
|
||||
// +----------------------------------------------------------------------+
|
||||
//
|
||||
// $Id:IM.php 937 2008-01-20 23:13:25Z ray $
|
||||
//
|
||||
// Image Transformation interface using command line ImageMagick
|
||||
//
|
||||
|
||||
require_once "../ImageManager/Classes/Transform.php";
|
||||
|
||||
Class Image_Transform_Driver_IM extends Image_Transform
|
||||
{
|
||||
/**
|
||||
* associative array commands to be executed
|
||||
* @var array
|
||||
*/
|
||||
var $command = array();
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
*/
|
||||
function Image_Transform_Driver_IM()
|
||||
{
|
||||
return true;
|
||||
} // End Image_IM
|
||||
|
||||
/**
|
||||
* Load image
|
||||
*
|
||||
* @param string filename
|
||||
*
|
||||
* @return mixed none or a PEAR error object on error
|
||||
* @see PEAR::isError()
|
||||
*/
|
||||
function load($image)
|
||||
{
|
||||
|
||||
$this->uid = md5($_SERVER['REMOTE_ADDR']);
|
||||
/*if (!file_exists($image)) {
|
||||
return PEAR::raiseError('The image file ' . $image . ' does\'t exist', true);
|
||||
}*/
|
||||
$this->image = $image;
|
||||
$this->_get_image_details($image);
|
||||
} // End load
|
||||
|
||||
/**
|
||||
* Resize Action
|
||||
*
|
||||
* @param int new_x new width
|
||||
* @param int new_y new height
|
||||
*
|
||||
* @return none
|
||||
* @see PEAR::isError()
|
||||
*/
|
||||
function _resize($new_x, $new_y)
|
||||
{
|
||||
/*if (isset($this->command['resize'])) {
|
||||
return PEAR::raiseError("You cannot scale or resize an image more than once without calling save or display", true);
|
||||
}*/
|
||||
$this->command['resize'] = "-geometry ${new_x}x${new_y}!";
|
||||
|
||||
$this->new_x = $new_x;
|
||||
$this->new_y = $new_y;
|
||||
} // End resize
|
||||
|
||||
/**
|
||||
* Crop the image
|
||||
*
|
||||
* @param int $crop_x left column of the image
|
||||
* @param int $crop_y top row of the image
|
||||
* @param int $crop_width new cropped image width
|
||||
* @param int $crop_height new cropped image height
|
||||
*/
|
||||
function crop($crop_x, $crop_y, $crop_width, $crop_height)
|
||||
{
|
||||
$this->command['crop'] = "-crop {$crop_width}x{$crop_height}+{$crop_x}+{$crop_y}";
|
||||
}
|
||||
|
||||
/**
|
||||
* Flip the image horizontally or vertically
|
||||
*
|
||||
* @param boolean $horizontal true if horizontal flip, vertical otherwise
|
||||
*/
|
||||
function flip($horizontal)
|
||||
{
|
||||
if($horizontal)
|
||||
$this->command['flop'] = "-flop";
|
||||
else
|
||||
$this->command['flip'] = "-flip";
|
||||
}
|
||||
/**
|
||||
* rotate
|
||||
*
|
||||
* @param int angle rotation angle
|
||||
* @param array options no option allowed
|
||||
*
|
||||
*/
|
||||
function rotate($angle, $options=null)
|
||||
{
|
||||
if ('-' == $angle{0}) {
|
||||
$angle = 360 - substr($angle, 1);
|
||||
}
|
||||
$this->command['rotate'] = "-rotate $angle";
|
||||
} // End rotate
|
||||
|
||||
/**
|
||||
* addText
|
||||
*
|
||||
* @param array options Array contains options
|
||||
* array(
|
||||
* 'text' The string to draw
|
||||
* 'x' Horizontal position
|
||||
* 'y' Vertical Position
|
||||
* 'Color' Font color
|
||||
* 'font' Font to be used
|
||||
* 'size' Size of the fonts in pixel
|
||||
* 'resize_first' Tell if the image has to be resized
|
||||
* before drawing the text
|
||||
* )
|
||||
*
|
||||
* @return none
|
||||
* @see PEAR::isError()
|
||||
*/
|
||||
function addText($params)
|
||||
{
|
||||
$default_params = array(
|
||||
'text' => 'This is Text',
|
||||
'x' => 10,
|
||||
'y' => 20,
|
||||
'color' => 'red',
|
||||
'font' => 'Arial.ttf',
|
||||
'resize_first' => false // Carry out the scaling of the image before annotation?
|
||||
);
|
||||
$params = array_merge($default_params, $params);
|
||||
extract($params);
|
||||
if (true === $resize_first) {
|
||||
// Set the key so that this will be the last item in the array
|
||||
$key = 'ztext';
|
||||
} else {
|
||||
$key = 'text';
|
||||
}
|
||||
$this->command[$key] = "-font $font -fill $color -draw 'text $x,$y \"$text\"'";
|
||||
// Producing error: gs: not found gs: not found convert: Postscript delegate failed [No such file or directory].
|
||||
} // End addText
|
||||
|
||||
/**
|
||||
* Adjust the image gamma
|
||||
*
|
||||
* @param float $outputgamma
|
||||
*
|
||||
* @return none
|
||||
*/
|
||||
function gamma($outputgamma=1.0) {
|
||||
$this->command['gamma'] = "-gamma $outputgamma";
|
||||
}
|
||||
|
||||
function reduce_colors($number = 256)
|
||||
{
|
||||
$this->command['colors'] = "-colors $number";
|
||||
}
|
||||
/**
|
||||
* Save the image file
|
||||
*
|
||||
* @param string $filename the name of the file to write to
|
||||
* @param quality $quality image dpi, default=75
|
||||
* @param string $type (JPG,PNG...)
|
||||
*
|
||||
* @return none
|
||||
*/
|
||||
function save($filename, $type='', $quality = 85)
|
||||
{
|
||||
$type == '' ? $this->type : $type;
|
||||
$cmd = '' . IMAGE_TRANSFORM_LIB_PATH . 'convert ';
|
||||
$cmd .= implode(' ', $this->command) . " -quality $quality ";
|
||||
$cmd .= '"'.($this->image) . '" "' . ($filename) . '"';
|
||||
|
||||
//$cmd = str_replace('/', '\\', $cmd);
|
||||
//echo($cmd.'<br>');
|
||||
exec($cmd,$retval);
|
||||
//error_log('IM '.print_r($retval,true));
|
||||
} // End save
|
||||
|
||||
/**
|
||||
* Display image without saving and lose changes
|
||||
*
|
||||
* @param string type (JPG,PNG...);
|
||||
* @param int quality 75
|
||||
*
|
||||
* @return none
|
||||
*/
|
||||
function display($type = '', $quality = 75)
|
||||
{
|
||||
if ($type == '') {
|
||||
header('Content-type: image/' . $this->type);
|
||||
passthru(IMAGE_TRANSFORM_LIB_PATH . ' ' . implode(' ', $this->command) . " -quality $quality " . escapeshellarg($this->image) . ' ' . strtoupper($this->type) . ":-");
|
||||
} else {
|
||||
header('Content-type: image/' . $type);
|
||||
passthru(IMAGE_TRANSFORM_LIB_PATH . 'convert ' . implode(' ', $this->command) . " -quality $quality " . escapeshellarg($this->image) . ' ' . strtoupper($type) . ":-");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Destroy image handle
|
||||
*
|
||||
* @return none
|
||||
*/
|
||||
function free()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
} // End class ImageIM
|
||||
?>
|
||||
@@ -0,0 +1,495 @@
|
||||
<?php
|
||||
/**
|
||||
* Image Editor. Editing tools, crop, rotate, scale and save.
|
||||
* @author $Author:ray $
|
||||
* @version $Id:ImageEditor.php 938 2008-01-22 20:13:47Z ray $
|
||||
* @package ImageManager
|
||||
*/
|
||||
|
||||
require_once('../ImageManager/Classes/Transform.php');
|
||||
|
||||
/**
|
||||
* Handles the basic image editing capbabilities.
|
||||
* @author $Author:ray $
|
||||
* @version $Id:ImageEditor.php 938 2008-01-22 20:13:47Z ray $
|
||||
* @package ImageManager
|
||||
* @subpackage Editor
|
||||
*/
|
||||
class ImageEditor
|
||||
{
|
||||
/**
|
||||
* ImageManager instance.
|
||||
*/
|
||||
var $manager;
|
||||
|
||||
/**
|
||||
* user based on IP address
|
||||
*/
|
||||
var $_uid;
|
||||
|
||||
/**
|
||||
* tmp file storage time.
|
||||
*/
|
||||
var $lapse_time =900; //15 mins
|
||||
|
||||
var $filesaved = 0;
|
||||
|
||||
/**
|
||||
* Create a new ImageEditor instance. Editing requires a
|
||||
* tmp file, which is saved in the current directory where the
|
||||
* image is edited. The tmp file is assigned by md5 hash of the
|
||||
* user IP address. This hashed is used as an ID for cleaning up
|
||||
* the tmp files. In addition, any tmp files older than the
|
||||
* the specified period will be deleted.
|
||||
* @param ImageManager $manager the image manager, we need this
|
||||
* for some file and path handling functions.
|
||||
*/
|
||||
function ImageEditor($manager)
|
||||
{
|
||||
$this->manager = $manager;
|
||||
$this->_uid = md5($_SERVER['REMOTE_ADDR']);
|
||||
}
|
||||
|
||||
/**
|
||||
* Did we save a file?
|
||||
* @return int 1 if the file was saved sucessfully,
|
||||
* 0 no save operation, -1 file save error.
|
||||
*/
|
||||
function isFileSaved()
|
||||
{
|
||||
Return $this->filesaved;
|
||||
}
|
||||
|
||||
/**
|
||||
* Process the image, if not action, just display the image.
|
||||
* @return array with image information, empty array if not an image.
|
||||
* <code>array('src'=>'url of the image', 'dimensions'=>'width="xx" height="yy"',
|
||||
* 'file'=>'image file, relative', 'fullpath'=>'full path to the image');</code>
|
||||
*/
|
||||
function processImage()
|
||||
{
|
||||
if(isset($_GET['img']))
|
||||
$relative = rawurldecode($_GET['img']);
|
||||
else
|
||||
Return array();
|
||||
|
||||
//$relative = '/Series2004NoteFront.jpg';
|
||||
|
||||
$imgURL = $this->manager->getFileURL($relative);
|
||||
$fullpath = $this->manager->getFullPath($relative);
|
||||
|
||||
$imgInfo = @getImageSize($fullpath);
|
||||
if(!is_array($imgInfo))
|
||||
Return array();
|
||||
|
||||
$action = $this->getAction();
|
||||
|
||||
if(!is_null($action))
|
||||
{
|
||||
$image = $this->processAction($action, $relative, $fullpath);
|
||||
}
|
||||
else
|
||||
{
|
||||
$image['src'] = $imgURL;
|
||||
$image['dimensions'] = $imgInfo[3];
|
||||
$image['file'] = $relative;
|
||||
$image['fullpath'] = $fullpath;
|
||||
$image['filesize'] = @filesize($fullpath);
|
||||
}
|
||||
|
||||
Return $image;
|
||||
}
|
||||
|
||||
/**
|
||||
* Process the actions, crop, scale(resize), rotate, flip, and save.
|
||||
* When ever an action is performed, the result is save into a
|
||||
* temporary image file, see createUnique on the filename specs.
|
||||
* It does not return the saved file, alway returning the tmp file.
|
||||
* @param string $action, should be 'crop', 'scale', 'rotate','flip', or 'save'
|
||||
* @param string $relative the relative image filename
|
||||
* @param string $fullpath the fullpath to the image file
|
||||
* @return array with image information
|
||||
* <code>array('src'=>'url of the image', 'dimensions'=>'width="xx" height="yy"',
|
||||
* 'file'=>'image file, relative', 'fullpath'=>'full path to the image');</code>
|
||||
*/
|
||||
function processAction($action, $relative, $fullpath)
|
||||
{
|
||||
$params = '';
|
||||
|
||||
if(isset($_GET['params']))
|
||||
$params = $_GET['params'];
|
||||
|
||||
$values = explode(',',$params);
|
||||
$saveFile = $this->getSaveFileName($values[0]);
|
||||
|
||||
$img = Image_Transform::factory(IMAGE_CLASS);
|
||||
$img->load($fullpath);
|
||||
|
||||
if ( is_callable( array($img,'paletteToTrueColorWithTransparency')) && !imageistruecolor($img->imageHandle))
|
||||
{
|
||||
$img->paletteToTrueColorWithTransparency();
|
||||
}
|
||||
switch ($action)
|
||||
{
|
||||
case 'crop':
|
||||
$img->crop(intval($values[0]),intval($values[1]),
|
||||
intval($values[2]),intval($values[3]));
|
||||
break;
|
||||
case 'scale':
|
||||
$img->resize(intval($values[0]),intval($values[1]));
|
||||
break;
|
||||
case 'rotate':
|
||||
$img->rotate(floatval($values[0]));
|
||||
break;
|
||||
case 'flip':
|
||||
if ($values[0] == 'hoz')
|
||||
$img->flip(true);
|
||||
else if($values[0] == 'ver')
|
||||
$img->flip(false);
|
||||
break;
|
||||
case 'save':
|
||||
if(!is_null($saveFile))
|
||||
{
|
||||
$quality = intval($values[1]);
|
||||
if($quality <0) $quality = 85;
|
||||
$newSaveFile = $this->makeRelative($relative, $saveFile);
|
||||
$newSaveFile = $this->getUniqueFilename($newSaveFile);
|
||||
|
||||
//get unique filename just returns the filename, so
|
||||
//we need to make the relative path once more.
|
||||
$newSaveFile = $this->makeRelative($relative, $newSaveFile);
|
||||
$image['saveFile'] = $newSaveFile;
|
||||
$newSaveFullpath = $this->manager->getFullPath($newSaveFile);
|
||||
if ( $values[0] == 'gif' && is_callable(array($img, 'preserveTransparencyForPalette')))
|
||||
{
|
||||
$img->preserveTransparencyForPalette();
|
||||
}
|
||||
$img->save($newSaveFullpath, $values[0], $quality);
|
||||
if(is_file($newSaveFullpath))
|
||||
$this->filesaved = 1;
|
||||
else
|
||||
$this->filesaved = -1;
|
||||
}
|
||||
break;
|
||||
case 'preview':
|
||||
$quality = intval($values[1]);
|
||||
|
||||
|
||||
$image['file'] = $relative;
|
||||
$image['fullpath'] = $fullpath;
|
||||
|
||||
//create the tmp image file
|
||||
$filename = $this->createUnique($fullpath);
|
||||
$newRelative = $this->makeRelative($relative, $filename);
|
||||
$newFullpath = $this->manager->getFullPath($newRelative);
|
||||
$newURL = $this->manager->getFileURL($newRelative);
|
||||
|
||||
|
||||
if ( $values[0] == 'gif' && is_callable(array($img, 'preserveTransparencyForPalette')))
|
||||
{
|
||||
$img->preserveTransparencyForPalette();
|
||||
}
|
||||
$img->save($newFullpath, $values[0] );
|
||||
$img->free();
|
||||
|
||||
//get the image information
|
||||
$imgInfo = @getimagesize($newFullpath);
|
||||
|
||||
$image['src'] = $newURL;
|
||||
$image['width'] = $imgInfo[0];
|
||||
$image['height'] = $imgInfo[1];
|
||||
$image['dimensions'] = $imgInfo[3];
|
||||
$image['file'] = $relative;
|
||||
$image['fullpath'] = $fullpath;
|
||||
$image['filesize'] = @filesize($newFullpath);
|
||||
|
||||
Return $image;
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
//create the tmp image file
|
||||
$filename = $this->createUnique($fullpath);
|
||||
$newRelative = $this->makeRelative($relative, $filename);
|
||||
$newFullpath = $this->manager->getFullPath($newRelative);
|
||||
$newURL = $this->manager->getFileURL($newRelative);
|
||||
|
||||
//save the file.
|
||||
$img->save($newFullpath, 'png' );
|
||||
$img->free();
|
||||
|
||||
//get the image information
|
||||
$imgInfo = @getimagesize($newFullpath);
|
||||
|
||||
$image['src'] = $newURL;
|
||||
$image['width'] = $imgInfo[0];
|
||||
$image['height'] = $imgInfo[1];
|
||||
$image['dimensions'] = $imgInfo[3];
|
||||
$image['file'] = $newRelative;
|
||||
$image['fullpath'] = $newFullpath;
|
||||
$image['filesize'] = @filesize($newFullpath);
|
||||
$image['type'] = image_type_to_mime_type($imgInfo[2]);
|
||||
|
||||
Return $image;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the file name base on the save name
|
||||
* and the save type.
|
||||
* @param string $type image type, 'jpeg', 'png', or 'gif'
|
||||
* @return string the filename according to save type
|
||||
*/
|
||||
function getSaveFileName($type)
|
||||
{
|
||||
if(!isset($_GET['file']))
|
||||
Return null;
|
||||
|
||||
$filename = Files::escape(rawurldecode($_GET['file']));
|
||||
$index = strrpos($filename,'.');
|
||||
$base = substr($filename,0,$index);
|
||||
$ext = strtolower(substr($filename,$index+1,strlen($filename)));
|
||||
|
||||
if($type == 'jpeg' && !($ext=='jpeg' || $ext=='jpg'))
|
||||
{
|
||||
Return $base.'.jpeg';
|
||||
}
|
||||
if($type=='png' && $ext != 'png')
|
||||
Return $base.'.png';
|
||||
if($type=='gif' && $ext != 'gif')
|
||||
Return $base.'.gif';
|
||||
|
||||
Return $filename;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the default save file name, used by editor.php.
|
||||
* @return string a suggestive filename, this should be unique
|
||||
*/
|
||||
function getDefaultSaveFile()
|
||||
{
|
||||
if(isset($_GET['img']))
|
||||
$relative = rawurldecode($_GET['img']);
|
||||
else
|
||||
Return null;
|
||||
|
||||
Return $this->getUniqueFilename($relative);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a unique filename. If the file exists, the filename
|
||||
* base is appended with an increasing integer.
|
||||
* @param string $relative the relative filename to the base_dir
|
||||
* @return string a unique filename in the current path
|
||||
*/
|
||||
function getUniqueFilename($relative)
|
||||
{
|
||||
$fullpath = $this->manager->getFullPath($relative);
|
||||
|
||||
$pathinfo = pathinfo($fullpath);
|
||||
|
||||
$path = Files::fixPath($pathinfo['dirname']);
|
||||
$file = Files::escape($pathinfo['basename']);
|
||||
|
||||
$filename = $file;
|
||||
|
||||
$dotIndex = strrpos($file, '.');
|
||||
$ext = '';
|
||||
|
||||
if(is_int($dotIndex))
|
||||
{
|
||||
$ext = substr($file, $dotIndex);
|
||||
$base = substr($file, 0, $dotIndex);
|
||||
}
|
||||
|
||||
$counter = 0;
|
||||
while(is_file($path.$filename))
|
||||
{
|
||||
$counter++;
|
||||
$filename = $base.'_'.$counter.$ext;
|
||||
}
|
||||
|
||||
Return $filename;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Specifiy the original relative path, a new filename
|
||||
* and return the new filename with relative path.
|
||||
* i.e. $pathA (-filename) + $file
|
||||
* @param string $pathA the relative file
|
||||
* @param string $file the new filename
|
||||
* @return string relative path with the new filename
|
||||
*/
|
||||
function makeRelative($pathA, $file)
|
||||
{
|
||||
$index = strrpos($pathA,'/');
|
||||
if(!is_int($index))
|
||||
Return $file;
|
||||
|
||||
$path = substr($pathA, 0, $index);
|
||||
Return Files::fixPath($path).$file;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the action GET parameter
|
||||
* @return string action parameter
|
||||
*/
|
||||
function getAction()
|
||||
{
|
||||
$action = null;
|
||||
if(isset($_GET['action']))
|
||||
$action = $_GET['action'];
|
||||
Return $action;
|
||||
}
|
||||
|
||||
/**
|
||||
* Generate a unique string based on md5(microtime()).
|
||||
* Well not so uniqe, as it is limited to 6 characters
|
||||
* @return string unique string.
|
||||
*/
|
||||
function uniqueStr()
|
||||
{
|
||||
return substr(md5(microtime()),0,6);
|
||||
}
|
||||
|
||||
/**
|
||||
* Create unique tmp image file name.
|
||||
* The filename is based on the tmp file prefix
|
||||
* specified in config.inc.php plus
|
||||
* the UID (basically a md5 of the remote IP)
|
||||
* and some random 6 character string.
|
||||
* This function also calls to clean up the tmp files.
|
||||
* @param string $file the fullpath to a file
|
||||
* @return string a unique filename for that path
|
||||
* NOTE: it only returns the filename, path no included.
|
||||
*/
|
||||
function createUnique($file)
|
||||
{
|
||||
$pathinfo = pathinfo($file);
|
||||
$path = Files::fixPath($pathinfo['dirname']);
|
||||
$imgType = $this->getImageType($file);
|
||||
|
||||
$unique_str = $this->manager->getTmpPrefix().$this->_uid.'_'.$this->uniqueStr().".".$imgType;
|
||||
|
||||
//make sure the the unique temp file does not exists
|
||||
while (file_exists($path.$unique_str))
|
||||
{
|
||||
$unique_str = $this->manager->getTmpPrefix().$this->_uid.'_'.$this->uniqueStr().".".$imgType;
|
||||
}
|
||||
|
||||
$this->cleanUp($path,$pathinfo['basename']);
|
||||
|
||||
Return $unique_str;
|
||||
}
|
||||
|
||||
/**
|
||||
* Delete any tmp image files.
|
||||
* @param string $path the full path
|
||||
* where the clean should take place.
|
||||
*/
|
||||
function cleanUp($path,$file)
|
||||
{
|
||||
$path = Files::fixPath($path);
|
||||
|
||||
if(!is_dir($path))
|
||||
Return false;
|
||||
|
||||
$d = @dir($path);
|
||||
|
||||
$tmp = $this->manager->getTmpPrefix();
|
||||
$tmpLen = strlen($tmp);
|
||||
|
||||
$prefix = $tmp.$this->_uid;
|
||||
$len = strlen($prefix);
|
||||
|
||||
while (false !== ($entry = $d->read()))
|
||||
{
|
||||
//echo $entry."<br>";
|
||||
if(is_file($path.$entry) && $this->manager->isTmpFile($entry))
|
||||
{
|
||||
if(substr($entry,0,$len)==$prefix && $entry != $file)
|
||||
Files::delFile($path.$entry);
|
||||
else if(substr($entry,0,$tmpLen)==$tmp && $entry != $file)
|
||||
{
|
||||
if(filemtime($path.$entry)+$this->lapse_time < time())
|
||||
Files::delFile($path.$entry);
|
||||
}
|
||||
}
|
||||
}
|
||||
$d->close();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the image type base on an image file.
|
||||
* @param string $file the full path to the image file.
|
||||
* @return string of either 'gif', 'jpeg', 'png' or 'bmp'
|
||||
* otherwise it will return null.
|
||||
*/
|
||||
function getImageType($file)
|
||||
{
|
||||
$imageInfo = @getImageSize($file);
|
||||
|
||||
if(!is_array($imageInfo))
|
||||
Return null;
|
||||
|
||||
switch($imageInfo[2])
|
||||
{
|
||||
case 1:
|
||||
Return 'gif';
|
||||
case 2:
|
||||
Return 'jpeg';
|
||||
case 3:
|
||||
Return 'png';
|
||||
case 6:
|
||||
Return 'bmp';
|
||||
}
|
||||
|
||||
Return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if the specified image can be edit by GD
|
||||
* mainly to check that GD can read and save GIFs
|
||||
* @return int 0 if it is not a GIF file, 1 is GIF is editable, -1 if not editable.
|
||||
*/
|
||||
function isGDEditable()
|
||||
{
|
||||
if(isset($_GET['img']))
|
||||
$relative = rawurldecode($_GET['img']);
|
||||
else
|
||||
Return 0;
|
||||
if(IMAGE_CLASS != 'GD')
|
||||
Return 0;
|
||||
|
||||
$fullpath = $this->manager->getFullPath($relative);
|
||||
|
||||
$type = $this->getImageType($fullpath);
|
||||
if($type != 'gif')
|
||||
Return 0;
|
||||
|
||||
if(function_exists('ImageCreateFrom'.$type)
|
||||
&& function_exists('image'.$type))
|
||||
Return 1;
|
||||
else
|
||||
Return -1;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if GIF can be edit by GD.
|
||||
* @return int 0 if it is not using the GD library, 1 is GIF is editable, -1 if not editable.
|
||||
*/
|
||||
function isGDGIFAble()
|
||||
{
|
||||
if(IMAGE_CLASS != 'GD')
|
||||
Return 0;
|
||||
|
||||
if(function_exists('ImageCreateFromGif')
|
||||
&& function_exists('imagegif'))
|
||||
Return 1;
|
||||
else
|
||||
Return -1;
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
@@ -0,0 +1,664 @@
|
||||
<?php
|
||||
/**
|
||||
* ImageManager, list images, directories, and thumbnails.
|
||||
* @author $Author:ray $
|
||||
* @version $Id:ImageManager.php 709 2007-01-30 23:22:04Z ray $
|
||||
* @package ImageManager
|
||||
*/
|
||||
|
||||
require_once('../ImageManager/Classes/Files.php');
|
||||
|
||||
// uncomment to turn on debugging
|
||||
|
||||
// _ddtOn();
|
||||
|
||||
/**
|
||||
* ImageManager Class.
|
||||
* @author $Author:ray $
|
||||
* @version $Id:ImageManager.php 709 2007-01-30 23:22:04Z ray $
|
||||
*/
|
||||
class ImageManager
|
||||
{
|
||||
/**
|
||||
* Configuration array.
|
||||
*/
|
||||
var $config;
|
||||
|
||||
/**
|
||||
* Array of directory information.
|
||||
*/
|
||||
var $dirs;
|
||||
|
||||
/**
|
||||
* Constructor. Create a new Image Manager instance.
|
||||
* @param array $config configuration array, see config.inc.php
|
||||
*/
|
||||
function ImageManager($config)
|
||||
{
|
||||
$this->config = $config;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the images base directory.
|
||||
* @return string base dir, see config.inc.php
|
||||
*/
|
||||
function getImagesDir()
|
||||
{
|
||||
Return $this->config['images_dir'];
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the images base URL.
|
||||
* @return string base url, see config.inc.php
|
||||
*/
|
||||
function getImagesURL()
|
||||
{
|
||||
Return $this->config['images_url'];
|
||||
}
|
||||
|
||||
function isValidBase()
|
||||
{
|
||||
return is_dir($this->getImagesDir());
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the tmp file prefix.
|
||||
* @return string tmp file prefix.
|
||||
*/
|
||||
function getTmpPrefix()
|
||||
{
|
||||
Return $this->config['tmp_prefix'];
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the sub directories in the base dir.
|
||||
* Each array element contain
|
||||
* the relative path (relative to the base dir) as key and the
|
||||
* full path as value.
|
||||
* @return array of sub directries
|
||||
* <code>array('path name' => 'full directory path', ...)</code>
|
||||
*/
|
||||
function getDirs()
|
||||
{
|
||||
if(is_null($this->dirs))
|
||||
{
|
||||
$dirs = $this->_dirs($this->getImagesDir(),'/');
|
||||
ksort($dirs);
|
||||
$this->dirs = $dirs;
|
||||
}
|
||||
return $this->dirs;
|
||||
}
|
||||
|
||||
/**
|
||||
* Recursively travese the directories to get a list
|
||||
* of accessable directories.
|
||||
* @param string $base the full path to the current directory
|
||||
* @param string $path the relative path name
|
||||
* @return array of accessiable sub-directories
|
||||
* <code>array('path name' => 'full directory path', ...)</code>
|
||||
*/
|
||||
function _dirs($base, $path)
|
||||
{
|
||||
$base = Files::fixPath($base);
|
||||
$dirs = array();
|
||||
|
||||
if($this->isValidBase() == false)
|
||||
return $dirs;
|
||||
|
||||
$d = @dir($base);
|
||||
|
||||
while (false !== ($entry = $d->read()))
|
||||
{
|
||||
//If it is a directory, and it doesn't start with
|
||||
// a dot, and if is it not the thumbnail directory
|
||||
if(is_dir($base.$entry)
|
||||
&& substr($entry,0,1) != '.'
|
||||
&& $this->isThumbDir($entry) == false)
|
||||
{
|
||||
$relative = Files::fixPath($path.$entry);
|
||||
$fullpath = Files::fixPath($base.$entry);
|
||||
$dirs[$relative] = $fullpath;
|
||||
$dirs = array_merge($dirs, $this->_dirs($fullpath, $relative));
|
||||
}
|
||||
}
|
||||
$d->close();
|
||||
|
||||
Return $dirs;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get all the files and directories of a relative path.
|
||||
* @param string $path relative path to be base path.
|
||||
* @return array of file and path information.
|
||||
* <code>array(0=>array('relative'=>'fullpath',...), 1=>array('filename'=>fileinfo array(),...)</code>
|
||||
* fileinfo array: <code>array('url'=>'full url',
|
||||
* 'relative'=>'relative to base',
|
||||
* 'fullpath'=>'full file path',
|
||||
* 'image'=>imageInfo array() false if not image,
|
||||
* 'stat' => filestat)</code>
|
||||
*/
|
||||
function getFiles($path)
|
||||
{
|
||||
$files = array();
|
||||
$dirs = array();
|
||||
|
||||
if($this->isValidBase() == false)
|
||||
return array($files,$dirs);
|
||||
|
||||
$path = Files::fixPath($path);
|
||||
$base = Files::fixPath($this->getImagesDir());
|
||||
$fullpath = Files::makePath($base,$path);
|
||||
|
||||
|
||||
$d = @dir($fullpath);
|
||||
|
||||
while (false !== ($entry = $d->read()))
|
||||
{
|
||||
//not a dot file or directory
|
||||
if(substr($entry,0,1) != '.')
|
||||
{
|
||||
if(is_dir($fullpath.$entry)
|
||||
&& $this->isThumbDir($entry) == false)
|
||||
{
|
||||
$relative = Files::fixPath($path.$entry);
|
||||
$full = Files::fixPath($fullpath.$entry);
|
||||
$count = $this->countFiles($full);
|
||||
$dirs[$relative] = array('fullpath'=>$full,'entry'=>$entry,'count'=>$count);
|
||||
}
|
||||
else if(is_file($fullpath.$entry) && $this->isThumb($entry)==false && $this->isTmpFile($entry) == false)
|
||||
{
|
||||
$img = $this->getImageInfo($fullpath.$entry);
|
||||
|
||||
if(!(!is_array($img)&&$this->config['validate_images']))
|
||||
{
|
||||
$file['url'] = Files::makePath($this->config['base_url'],$path).$entry;
|
||||
$file['relative'] = $path.$entry;
|
||||
$file['fullpath'] = $fullpath.$entry;
|
||||
$file['image'] = $img;
|
||||
$file['stat'] = stat($fullpath.$entry);
|
||||
$files[$entry] = $file;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
$d->close();
|
||||
ksort($dirs);
|
||||
ksort($files);
|
||||
|
||||
Return array($dirs, $files);
|
||||
}
|
||||
|
||||
/**
|
||||
* Count the number of files and directories in a given folder
|
||||
* minus the thumbnail folders and thumbnails.
|
||||
*/
|
||||
function countFiles($path)
|
||||
{
|
||||
$total = 0;
|
||||
|
||||
if(is_dir($path))
|
||||
{
|
||||
$d = @dir($path);
|
||||
|
||||
while (false !== ($entry = $d->read()))
|
||||
{
|
||||
//echo $entry."<br>";
|
||||
if(substr($entry,0,1) != '.'
|
||||
&& $this->isThumbDir($entry) == false
|
||||
&& $this->isTmpFile($entry) == false
|
||||
&& $this->isThumb($entry) == false)
|
||||
{
|
||||
$total++;
|
||||
}
|
||||
}
|
||||
$d->close();
|
||||
}
|
||||
return $total;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get image size information.
|
||||
* @param string $file the image file
|
||||
* @return array of getImageSize information,
|
||||
* false if the file is not an image.
|
||||
*/
|
||||
function getImageInfo($file)
|
||||
{
|
||||
Return @getImageSize($file);
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if the file contains the thumbnail prefix.
|
||||
* @param string $file filename to be checked
|
||||
* @return true if the file contains the thumbnail prefix, false otherwise.
|
||||
*/
|
||||
function isThumb($file)
|
||||
{
|
||||
$len = strlen($this->config['thumbnail_prefix']);
|
||||
if(substr($file,0,$len)==$this->config['thumbnail_prefix'])
|
||||
Return true;
|
||||
else
|
||||
Return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if the given directory is a thumbnail directory.
|
||||
* @param string $entry directory name
|
||||
* @return true if it is a thumbnail directory, false otherwise
|
||||
*/
|
||||
function isThumbDir($entry)
|
||||
{
|
||||
if($this->config['thumbnail_dir'] == false
|
||||
|| strlen(trim($this->config['thumbnail_dir'])) == 0)
|
||||
Return false;
|
||||
else
|
||||
Return ($entry == $this->config['thumbnail_dir']);
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if the given file is a tmp file.
|
||||
* @param string $file file name
|
||||
* @return boolean true if it is a tmp file, false otherwise
|
||||
*/
|
||||
function isTmpFile($file)
|
||||
{
|
||||
$len = strlen($this->config['tmp_prefix']);
|
||||
if(substr($file,0,$len)==$this->config['tmp_prefix'])
|
||||
Return true;
|
||||
else
|
||||
Return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* For a given image file, get the respective thumbnail filename
|
||||
* no file existence check is done.
|
||||
* @param string $fullpathfile the full path to the image file
|
||||
* @return string of the thumbnail file
|
||||
*/
|
||||
function getThumbName($fullpathfile)
|
||||
{
|
||||
$path_parts = pathinfo($fullpathfile);
|
||||
|
||||
$thumbnail = $this->config['thumbnail_prefix'].$path_parts['basename'];
|
||||
|
||||
if( strlen(trim($this->config['thumbnail_dir'])) == 0 || $this->config['safe_mode'] == true)
|
||||
{
|
||||
Return Files::makeFile($path_parts['dirname'],$thumbnail);
|
||||
}
|
||||
else
|
||||
{
|
||||
$path = Files::makePath($path_parts['dirname'],$this->config['thumbnail_dir']);
|
||||
if(!is_dir($path))
|
||||
Files::createFolder($path);
|
||||
Return Files::makeFile($path,$thumbnail);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Similar to getThumbName, but returns the URL, base on the
|
||||
* given base_url in config.inc.php
|
||||
* @param string $relative the relative image file name,
|
||||
* relative to the base_dir path
|
||||
* @return string the url of the thumbnail
|
||||
*/
|
||||
function getThumbURL($relative)
|
||||
{
|
||||
|
||||
_ddt( __FILE__, __LINE__, "getThumbURL(): relative is '$relative'" );
|
||||
|
||||
$path_parts = pathinfo($relative);
|
||||
$thumbnail = $this->config['thumbnail_prefix'].$path_parts['basename'];
|
||||
if($path_parts['dirname']=='\\') $path_parts['dirname']='/';
|
||||
|
||||
if($this->config['safe_mode'] == true
|
||||
|| strlen(trim($this->config['thumbnail_dir'])) == 0)
|
||||
{
|
||||
Return Files::makeFile($this->getImagesURL(),$thumbnail);
|
||||
}
|
||||
else
|
||||
{
|
||||
if(strlen(trim($this->config['thumbnail_dir'])) > 0)
|
||||
{
|
||||
$path = Files::makePath($path_parts['dirname'],$this->config['thumbnail_dir']);
|
||||
$url_path = Files::makePath($this->getImagesURL(), $path);
|
||||
|
||||
_ddt( __FILE__, __LINE__, "getThumbURL(): url_path is '$url_path'" );
|
||||
|
||||
Return Files::makeFile($url_path,$thumbnail);
|
||||
}
|
||||
else //should this ever happen?
|
||||
{
|
||||
//error_log('ImageManager: Error in creating thumbnail url');
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* For a given image file, get the respective resized filename
|
||||
* no file existence check is done.
|
||||
* @param string $fullpathfile the full path to the image file
|
||||
* @param integer $width the intended width
|
||||
* @param integer $height the intended height
|
||||
* @param boolean $mkDir whether to attempt to make the resized_dir if it doesn't exist
|
||||
* @return string of the resized filename
|
||||
*/
|
||||
function getResizedName($fullpathfile, $width, $height, $mkDir = TRUE)
|
||||
{
|
||||
$path_parts = pathinfo($fullpathfile);
|
||||
|
||||
$thumbnail = $this->config['resized_prefix']."_{$width}x{$height}_{$path_parts['basename']}";
|
||||
|
||||
if( strlen(trim($this->config['resized_dir'])) == 0 || $this->config['safe_mode'] == true )
|
||||
{
|
||||
Return Files::makeFile($path_parts['dirname'],$thumbnail);
|
||||
}
|
||||
else
|
||||
{
|
||||
$path = Files::makePath($path_parts['dirname'],$this->config['resized_dir']);
|
||||
if($mkDir && !is_dir($path))
|
||||
Files::createFolder($path);
|
||||
Return Files::makeFile($path,$thumbnail);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if the given path is part of the subdirectories
|
||||
* under the base_dir.
|
||||
* @param string $path the relative path to be checked
|
||||
* @return boolean true if the path exists, false otherwise
|
||||
*/
|
||||
function validRelativePath($path)
|
||||
{
|
||||
$dirs = $this->getDirs();
|
||||
if($path == '/')
|
||||
Return true;
|
||||
//check the path given in the url against the
|
||||
//list of paths in the system.
|
||||
for($i = 0; $i < count($dirs); $i++)
|
||||
{
|
||||
$key = key($dirs);
|
||||
//we found the path
|
||||
if($key == $path)
|
||||
Return true;
|
||||
|
||||
next($dirs);
|
||||
}
|
||||
Return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Process uploaded files, assumes the file is in
|
||||
* $_FILES['upload'] and $_POST['dir'] is set.
|
||||
* The dir must be relative to the base_dir and exists.
|
||||
* If 'validate_images' is set to true, only file with
|
||||
* image dimensions will be accepted.
|
||||
* @return null
|
||||
*/
|
||||
function processUploads()
|
||||
{
|
||||
if($this->isValidBase() == false)
|
||||
return;
|
||||
|
||||
$relative = null;
|
||||
|
||||
if(isset($_POST['dir']))
|
||||
$relative = rawurldecode($_POST['dir']);
|
||||
else
|
||||
return;
|
||||
|
||||
//check for the file, and must have valid relative path
|
||||
if(isset($_FILES['upload']) && $this->validRelativePath($relative))
|
||||
{
|
||||
$this->_processFiles($relative, $_FILES['upload']);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Process upload files. The file must be an
|
||||
* uploaded file. If 'validate_images' is set to
|
||||
* true, only images will be processed. Any duplicate
|
||||
* file will be renamed. See Files::copyFile for details
|
||||
* on renaming.
|
||||
* @param string $relative the relative path where the file
|
||||
* should be copied to.
|
||||
* @param array $file the uploaded file from $_FILES
|
||||
* @return boolean true if the file was processed successfully,
|
||||
* false otherwise
|
||||
*/
|
||||
function _processFiles($relative, $file)
|
||||
{
|
||||
|
||||
if($file['error']!=0)
|
||||
{
|
||||
Return false;
|
||||
}
|
||||
|
||||
if(!is_file($file['tmp_name']))
|
||||
{
|
||||
Return false;
|
||||
}
|
||||
|
||||
if(!is_uploaded_file($file['tmp_name']))
|
||||
{
|
||||
Files::delFile($file['tmp_name']);
|
||||
Return false;
|
||||
}
|
||||
|
||||
|
||||
if($this->config['validate_images'] == true)
|
||||
{
|
||||
$imgInfo = @getImageSize($file['tmp_name']);
|
||||
if(!is_array($imgInfo))
|
||||
{
|
||||
Files::delFile($file['tmp_name']);
|
||||
Return false;
|
||||
}
|
||||
}
|
||||
|
||||
//now copy the file
|
||||
$path = Files::makePath($this->getImagesDir(),$relative);
|
||||
$result = Files::copyFile($file['tmp_name'], $path, $file['name']);
|
||||
|
||||
//no copy error
|
||||
if(!is_int($result))
|
||||
{
|
||||
Files::delFile($file['tmp_name']);
|
||||
Return true;
|
||||
}
|
||||
|
||||
//delete tmp files.
|
||||
Files::delFile($file['tmp_name']);
|
||||
Return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the URL of the relative file.
|
||||
* basically appends the relative file to the
|
||||
* base_url given in config.inc.php
|
||||
* @param string $relative a file the relative to the base_dir
|
||||
* @return string the URL of the relative file.
|
||||
*/
|
||||
function getFileURL($relative)
|
||||
{
|
||||
Return Files::makeFile($this->getImagesURL(),$relative);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the fullpath to a relative file.
|
||||
* @param string $relative the relative file.
|
||||
* @return string the full path, .ie. the base_dir + relative.
|
||||
*/
|
||||
function getFullPath($relative)
|
||||
{
|
||||
Return Files::makeFile($this->getImagesDir(),$relative);;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the default thumbnail.
|
||||
* @return string default thumbnail, empty string if
|
||||
* the thumbnail doesn't exist.
|
||||
*/
|
||||
function getDefaultThumb()
|
||||
{
|
||||
|
||||
// FIXME: hack
|
||||
|
||||
Return $this->config['default_thumbnail'];
|
||||
|
||||
if(is_file($this->config['default_thumbnail']))
|
||||
{
|
||||
Return $this->config['default_thumbnail'];
|
||||
}
|
||||
else
|
||||
Return '';
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get the thumbnail url to be displayed.
|
||||
* If the thumbnail exists, and it is up-to-date
|
||||
* the thumbnail url will be returns. If the
|
||||
* file is not an image, a default image will be returned.
|
||||
* If it is an image file, and no thumbnail exists or
|
||||
* the thumbnail is out-of-date (i.e. the thumbnail
|
||||
* modified time is less than the original file)
|
||||
* then a thumbs.php?img=filename.jpg is returned.
|
||||
* The thumbs.php url will generate a new thumbnail
|
||||
* on the fly. If the image is less than the dimensions
|
||||
* of the thumbnails, the image will be display instead.
|
||||
* @param string $relative the relative image file.
|
||||
* @return string the url of the thumbnail, be it
|
||||
* actually thumbnail or a script to generate the
|
||||
* thumbnail on the fly.
|
||||
*/
|
||||
function getThumbnail($relative)
|
||||
{
|
||||
|
||||
global $IMConfig;
|
||||
|
||||
_ddt( __FILE__, __LINE__, "getThumbnail(): top with '$relative'" );
|
||||
|
||||
$fullpath = Files::makeFile($this->getImagesDir(),$relative);
|
||||
|
||||
//not a file???
|
||||
if(!is_file($fullpath))
|
||||
Return $this->getDefaultThumb();
|
||||
|
||||
$imgInfo = @getImageSize($fullpath);
|
||||
|
||||
//not an image
|
||||
if(!is_array($imgInfo))
|
||||
Return $this->getDefaultThumb();
|
||||
|
||||
//the original image is smaller than thumbnails,
|
||||
//so just return the url to the original image.
|
||||
if ($imgInfo[0] <= $this->config['thumbnail_width']
|
||||
&& $imgInfo[1] <= $this->config['thumbnail_height'])
|
||||
Return $this->getFileURL($relative);
|
||||
|
||||
$thumbnail = $this->getThumbName($fullpath);
|
||||
|
||||
//check for thumbnails, if exists and
|
||||
// it is up-to-date, return the thumbnail url
|
||||
if(is_file($thumbnail))
|
||||
{
|
||||
if(filemtime($thumbnail) >= filemtime($fullpath))
|
||||
{
|
||||
_ddt( __FILE__, __LINE__, "getThumbnail(): returning url '" . $this->getThumbURL($relative) . "'" );
|
||||
|
||||
Return $this->getThumbURL($relative);
|
||||
}
|
||||
}
|
||||
|
||||
//well, no thumbnail was found, so ask the thumbs.php
|
||||
//to generate the thumbnail on the fly.
|
||||
Return $IMConfig['backend_url'] . '__function=thumbs&img='.rawurlencode($relative);
|
||||
}
|
||||
|
||||
/**
|
||||
* Delete and specified files.
|
||||
* @return boolean true if delete, false otherwise
|
||||
*/
|
||||
function deleteFiles()
|
||||
{
|
||||
if(isset($_GET['delf']))
|
||||
$this->_delFile(rawurldecode($_GET['delf']));
|
||||
}
|
||||
|
||||
/**
|
||||
* Delete and specified directories.
|
||||
* @return boolean true if delete, false otherwise
|
||||
*/
|
||||
function deleteDirs()
|
||||
{
|
||||
if(isset($_GET['deld']))
|
||||
return $this->_delDir(rawurldecode($_GET['deld']));
|
||||
else
|
||||
Return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Delete the relative file, and any thumbnails.
|
||||
* @param string $relative the relative file.
|
||||
* @return boolean true if deleted, false otherwise.
|
||||
*/
|
||||
function _delFile($relative)
|
||||
{
|
||||
$fullpath = Files::makeFile($this->getImagesDir(),$relative);
|
||||
|
||||
//check that the file is an image
|
||||
if($this->config['validate_images'] == true)
|
||||
{
|
||||
if(!is_array($this->getImageInfo($fullpath)))
|
||||
return false; //hmmm not an Image!!???
|
||||
}
|
||||
|
||||
$thumbnail = $this->getThumbName($fullpath);
|
||||
|
||||
if(Files::delFile($fullpath))
|
||||
Return Files::delFile($thumbnail);
|
||||
else
|
||||
Return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Delete directories recursively.
|
||||
* @param string $relative the relative path to be deleted.
|
||||
* @return boolean true if deleted, false otherwise.
|
||||
*/
|
||||
function _delDir($relative)
|
||||
{
|
||||
$fullpath = Files::makePath($this->getImagesDir(),$relative);
|
||||
if($this->countFiles($fullpath) <= 0)
|
||||
return Files::delFolder($fullpath,true); //delete recursively.
|
||||
else
|
||||
Return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Create new directories.
|
||||
* If in safe_mode, nothing happens.
|
||||
* @return boolean true if created, false otherwise.
|
||||
*/
|
||||
function processNewDir()
|
||||
{
|
||||
if($this->config['safe_mode'] == true)
|
||||
Return false;
|
||||
|
||||
if(isset($_GET['newDir']) && isset($_GET['dir']))
|
||||
{
|
||||
$newDir = rawurldecode($_GET['newDir']);
|
||||
$dir = rawurldecode($_GET['dir']);
|
||||
$path = Files::makePath($this->getImagesDir(),$dir);
|
||||
$fullpath = Files::makePath($path, Files::escape($newDir));
|
||||
if(is_dir($fullpath))
|
||||
Return false;
|
||||
|
||||
Return Files::createFolder($fullpath);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
@@ -0,0 +1,257 @@
|
||||
<?php
|
||||
/***********************************************************************
|
||||
** Title.........: NetPBM Driver
|
||||
** Version.......: 1.0
|
||||
** Author........: Xiang Wei ZHUO <wei@zhuo.org>
|
||||
** Filename......: NetPBM.php
|
||||
** Last changed..: 30 Aug 2003
|
||||
** Notes.........: Orginal is from PEAR
|
||||
**/
|
||||
|
||||
// +----------------------------------------------------------------------+
|
||||
// | PHP Version 4 |
|
||||
// +----------------------------------------------------------------------+
|
||||
// | Copyright (c) 1997-2002 The PHP Group |
|
||||
// +----------------------------------------------------------------------+
|
||||
// | This source file is subject to version 2.02 of the PHP license, |
|
||||
// | that is bundled with this package in the file LICENSE, and is |
|
||||
// | available at through the world-wide-web at |
|
||||
// | http://www.php.net/license/2_02.txt. |
|
||||
// | If you did not receive a copy of the PHP license and are unable to |
|
||||
// | obtain it through the world-wide-web, please send a note to |
|
||||
// | license@php.net so we can mail you a copy immediately. |
|
||||
// +----------------------------------------------------------------------+
|
||||
// | Authors: Peter Bowyer <peter@mapledesign.co.uk> |
|
||||
// +----------------------------------------------------------------------+
|
||||
//
|
||||
// $Id:NetPBM.php 709 2007-01-30 23:22:04Z ray $
|
||||
//
|
||||
// Image Transformation interface using command line NetPBM
|
||||
|
||||
require_once "../ImageManager/Classes/Transform.php";
|
||||
|
||||
Class Image_Transform_Driver_NetPBM extends Image_Transform
|
||||
{
|
||||
|
||||
/**
|
||||
* associative array commands to be executed
|
||||
* @var array
|
||||
*/
|
||||
var $command = array();
|
||||
|
||||
/**
|
||||
* Class Constructor
|
||||
*/
|
||||
function Image_Transform_Driver_NetPBM()
|
||||
{
|
||||
$this->uid = md5($_SERVER['REMOTE_ADDR']);
|
||||
|
||||
return true;
|
||||
} // End function Image_NetPBM
|
||||
|
||||
/**
|
||||
* Load image
|
||||
*
|
||||
* @param string filename
|
||||
*
|
||||
* @return mixed none or a PEAR error object on error
|
||||
* @see PEAR::isError()
|
||||
*/
|
||||
function load($image)
|
||||
{
|
||||
//echo $image;
|
||||
$this->image = $image;
|
||||
$this->_get_image_details($image);
|
||||
} // End load
|
||||
|
||||
/**
|
||||
* Resizes the image
|
||||
*
|
||||
* @return none
|
||||
* @see PEAR::isError()
|
||||
*/
|
||||
function _resize($new_x, $new_y)
|
||||
{
|
||||
// there's no technical reason why resize can't be called multiple
|
||||
// times...it's just silly to do so
|
||||
|
||||
$this->command[] = IMAGE_TRANSFORM_LIB_PATH .
|
||||
"pnmscale -width $new_x -height $new_y";
|
||||
|
||||
$this->_set_new_x($new_x);
|
||||
$this->_set_new_y($new_y);
|
||||
} // End resize
|
||||
|
||||
/**
|
||||
* Crop the image
|
||||
*
|
||||
* @param int $crop_x left column of the image
|
||||
* @param int $crop_y top row of the image
|
||||
* @param int $crop_width new cropped image width
|
||||
* @param int $crop_height new cropped image height
|
||||
*/
|
||||
function crop($crop_x, $crop_y, $crop_width, $crop_height)
|
||||
{
|
||||
$this->command[] = IMAGE_TRANSFORM_LIB_PATH .
|
||||
"pnmcut -left $crop_x -top $crop_y -width $crop_width -height $crop_height";
|
||||
}
|
||||
|
||||
/**
|
||||
* Rotates the image
|
||||
*
|
||||
* @param int $angle The angle to rotate the image through
|
||||
*/
|
||||
function rotate($angle)
|
||||
{
|
||||
$angle = -1*floatval($angle);
|
||||
|
||||
if($angle > 90)
|
||||
{
|
||||
$this->command[] = IMAGE_TRANSFORM_LIB_PATH . "pnmrotate -noantialias 90";
|
||||
$this->rotate(-1*($angle-90));
|
||||
}
|
||||
else if ($angle < -90)
|
||||
{
|
||||
$this->command[] = IMAGE_TRANSFORM_LIB_PATH . "pnmrotate -noantialias -90";
|
||||
$this->rotate(-1*($angle+90));
|
||||
}
|
||||
else
|
||||
$this->command[] = IMAGE_TRANSFORM_LIB_PATH . "pnmrotate -noantialias $angle";
|
||||
} // End rotate
|
||||
|
||||
/**
|
||||
* Flip the image horizontally or vertically
|
||||
*
|
||||
* @param boolean $horizontal true if horizontal flip, vertical otherwise
|
||||
*/
|
||||
function flip($horizontal)
|
||||
{
|
||||
if($horizontal)
|
||||
$this->command[] = IMAGE_TRANSFORM_LIB_PATH . "pnmflip -lr";
|
||||
else
|
||||
$this->command[] = IMAGE_TRANSFORM_LIB_PATH . "pnmflip -tb";
|
||||
}
|
||||
|
||||
/**
|
||||
* Adjust the image gamma
|
||||
*
|
||||
* @param float $outputgamma
|
||||
*
|
||||
* @return none
|
||||
*/
|
||||
function gamma($outputgamma = 1.0) {
|
||||
$this->command[13] = IMAGE_TRANSFORM_LIB_PATH . "pnmgamma $outputgamma";
|
||||
}
|
||||
|
||||
/**
|
||||
* adds text to an image
|
||||
*
|
||||
* @param array options Array contains options
|
||||
* array(
|
||||
* 'text' // The string to draw
|
||||
* 'x' // Horizontal position
|
||||
* 'y' // Vertical Position
|
||||
* 'Color' // Font color
|
||||
* 'font' // Font to be used
|
||||
* 'size' // Size of the fonts in pixel
|
||||
* 'resize_first' // Tell if the image has to be resized
|
||||
* // before drawing the text
|
||||
* )
|
||||
*
|
||||
* @return none
|
||||
*/
|
||||
function addText($params)
|
||||
{
|
||||
$default_params = array('text' => 'This is Text',
|
||||
'x' => 10,
|
||||
'y' => 20,
|
||||
'color' => 'red',
|
||||
'font' => 'Arial.ttf',
|
||||
'size' => '12',
|
||||
'angle' => 0,
|
||||
'resize_first' => false);
|
||||
// we ignore 'resize_first' since the more logical approach would be
|
||||
// for the user to just call $this->_resize() _first_ ;)
|
||||
extract(array_merge($default_params, $params));
|
||||
$this->command[] = "ppmlabel -angle $angle -colour $color -size "
|
||||
."$size -x $x -y ".$y+$size." -text \"$text\"";
|
||||
} // End addText
|
||||
|
||||
function _postProcess($type, $quality, $save_type)
|
||||
{
|
||||
$type = is_null($type) || $type==''? $this->type : $type;
|
||||
$save_type = is_null($save_type) || $save_type==''? $this->type : $save_type;
|
||||
//echo "TYPE:". $this->type;
|
||||
array_unshift($this->command, IMAGE_TRANSFORM_LIB_PATH
|
||||
. $type.'topnm '. $this->image);
|
||||
$arg = '';
|
||||
switch(strtolower($save_type)){
|
||||
case 'gif':
|
||||
$this->command[] = IMAGE_TRANSFORM_LIB_PATH . "ppmquant 256";
|
||||
$this->command[] = IMAGE_TRANSFORM_LIB_PATH . "ppmto$save_type";
|
||||
break;
|
||||
case 'jpg':
|
||||
case 'jpeg':
|
||||
$arg = "--quality=$quality";
|
||||
$this->command[] = IMAGE_TRANSFORM_LIB_PATH . "ppmto$save_type $arg";
|
||||
break;
|
||||
default:
|
||||
$this->command[] = IMAGE_TRANSFORM_LIB_PATH . "pnmto$save_type $arg";
|
||||
break;
|
||||
} // switch
|
||||
return implode('|', $this->command);
|
||||
}
|
||||
|
||||
/**
|
||||
* Save the image file
|
||||
*
|
||||
* @param string $filename the name of the file to write to
|
||||
* @param string $type (jpeg,png...);
|
||||
* @param int $quality 75
|
||||
* @return none
|
||||
*/
|
||||
function save($filename, $type=null, $quality = 85)
|
||||
{
|
||||
$cmd = $this->_postProcess('', $quality, $type) . ">$filename";
|
||||
|
||||
//if we have windows server
|
||||
if(isset($_ENV['OS']) && eregi('window',$_ENV['OS']))
|
||||
$cmd = ereg_replace('/','\\',$cmd);
|
||||
//echo $cmd."##";
|
||||
$output = system($cmd);
|
||||
error_log('NETPBM: '.$cmd);
|
||||
//error_log($output);
|
||||
$this->command = array();
|
||||
} // End save
|
||||
|
||||
|
||||
/**
|
||||
* Display image without saving and lose changes
|
||||
*
|
||||
* @param string $type (jpeg,png...);
|
||||
* @param int $quality 75
|
||||
* @return none
|
||||
*/
|
||||
function display($type = null, $quality = 75)
|
||||
{
|
||||
header('Content-type: image/' . $type);
|
||||
$cmd = $this->_postProcess($type, $quality);
|
||||
|
||||
passthru($cmd);
|
||||
$this->command = array();
|
||||
}
|
||||
|
||||
/**
|
||||
* Destroy image handle
|
||||
*
|
||||
* @return none
|
||||
*/
|
||||
function free()
|
||||
{
|
||||
// there is no image handle here
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
} // End class NetPBM
|
||||
?>
|
||||
@@ -0,0 +1,125 @@
|
||||
<?php
|
||||
/**
|
||||
* Create thumbnails.
|
||||
* @author $Author:ray $
|
||||
* @version $Id:Thumbnail.php 709 2007-01-30 23:22:04Z ray $
|
||||
* @package ImageManager
|
||||
*/
|
||||
|
||||
|
||||
require_once('../ImageManager/Classes/Transform.php');
|
||||
|
||||
/**
|
||||
* Thumbnail creation
|
||||
* @author $Author:ray $
|
||||
* @version $Id:Thumbnail.php 709 2007-01-30 23:22:04Z ray $
|
||||
* @package ImageManager
|
||||
* @subpackage Images
|
||||
*/
|
||||
class Thumbnail
|
||||
{
|
||||
/**
|
||||
* Graphics driver, GD, NetPBM or ImageMagick.
|
||||
*/
|
||||
var $driver;
|
||||
|
||||
/**
|
||||
* Thumbnail default width.
|
||||
*/
|
||||
var $width = 96;
|
||||
|
||||
/**
|
||||
* Thumbnail default height.
|
||||
*/
|
||||
var $height = 96;
|
||||
|
||||
/**
|
||||
* Thumbnail default JPEG quality.
|
||||
*/
|
||||
var $quality = 85;
|
||||
|
||||
/**
|
||||
* Thumbnail is proportional
|
||||
*/
|
||||
var $proportional = true;
|
||||
|
||||
/**
|
||||
* Default image type is JPEG.
|
||||
*/
|
||||
var $type = 'jpeg';
|
||||
|
||||
/**
|
||||
* Create a new Thumbnail instance.
|
||||
* @param int $width thumbnail width
|
||||
* @param int $height thumbnail height
|
||||
*/
|
||||
function Thumbnail($width=96, $height=96)
|
||||
{
|
||||
$this->driver = Image_Transform::factory(IMAGE_CLASS);
|
||||
$this->width = $width;
|
||||
$this->height = $height;
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a thumbnail.
|
||||
* @param string $file the image for the thumbnail
|
||||
* @param string $thumbnail if not null, the thumbnail will be saved
|
||||
* as this parameter value.
|
||||
* @return boolean true if thumbnail is created, false otherwise
|
||||
*/
|
||||
function createThumbnail($file, $thumbnail=null)
|
||||
{
|
||||
if(!is_file($file))
|
||||
Return false;
|
||||
|
||||
//error_log('Creating Thumbs: '.$file);
|
||||
|
||||
$this->driver->load($file);
|
||||
|
||||
if($this->proportional)
|
||||
{
|
||||
$width = $this->driver->img_x;
|
||||
$height = $this->driver->img_y;
|
||||
|
||||
if ($width > $height)
|
||||
$this->height = intval($this->width/$width*$height);
|
||||
else if ($height > $width)
|
||||
$this->width = intval($this->height/$height*$width);
|
||||
}
|
||||
|
||||
$this->driver->resize($this->width, $this->height);
|
||||
|
||||
if(is_null($thumbnail))
|
||||
$this->save($file);
|
||||
else
|
||||
$this->save($thumbnail);
|
||||
|
||||
|
||||
$this->free();
|
||||
|
||||
if(is_file($thumbnail))
|
||||
Return true;
|
||||
else
|
||||
Return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Save the thumbnail file.
|
||||
* @param string $file file name to be saved as.
|
||||
*/
|
||||
function save($file)
|
||||
{
|
||||
$this->driver->save($file);
|
||||
}
|
||||
|
||||
/**
|
||||
* Free up the graphic driver resources.
|
||||
*/
|
||||
function free()
|
||||
{
|
||||
$this->driver->free();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
?>
|
||||
@@ -0,0 +1,569 @@
|
||||
<?php
|
||||
/***********************************************************************
|
||||
** Title.........: Image Transformation Interface
|
||||
** Version.......: 1.0
|
||||
** Author........: Xiang Wei ZHUO <wei@zhuo.org>
|
||||
** Filename......: Transform.php
|
||||
** Last changed..: 30 Aug 2003
|
||||
** Notes.........: Orginal is from PEAR
|
||||
|
||||
Added a few extra,
|
||||
- create unique filename in a particular directory,
|
||||
used for temp image files.
|
||||
- added cropping to GD, NetPBM, ImageMagick
|
||||
**/
|
||||
|
||||
// +----------------------------------------------------------------------+
|
||||
// | PHP Version 4 |
|
||||
// +----------------------------------------------------------------------+
|
||||
// | Copyright (c) 1997-2002 The PHP Group |
|
||||
// +----------------------------------------------------------------------+
|
||||
// | This source file is subject to version 2.02 of the PHP license, |
|
||||
// | that is bundled with this package in the file LICENSE, and is |
|
||||
// | available at through the world-wide-web at |
|
||||
// | http://www.php.net/license/2_02.txt. |
|
||||
// | If you did not receive a copy of the PHP license and are unable to |
|
||||
// | obtain it through the world-wide-web, please send a note to |
|
||||
// | license@php.net so we can mail you a copy immediately. |
|
||||
// +----------------------------------------------------------------------+
|
||||
// | Authors: Peter Bowyer <peter@mapledesign.co.uk> |
|
||||
// | Alan Knowles <alan@akbkhome.com> |
|
||||
// | Vincent Oostindie <vincent@sunlight.tmfweb.nl> |
|
||||
// +----------------------------------------------------------------------+
|
||||
//
|
||||
// $Id:Transform.php 709 2007-01-30 23:22:04Z ray $
|
||||
//
|
||||
// Image Transformation interface
|
||||
//
|
||||
|
||||
|
||||
/**
|
||||
* The main "Image_Resize" class is a container and base class which
|
||||
* provides the static methods for creating Image objects as well as
|
||||
* some utility functions (maths) common to all parts of Image Resize.
|
||||
*
|
||||
* The object model of DB is as follows (indentation means inheritance):
|
||||
*
|
||||
* Image_Resize The base for each Image implementation. Provides default
|
||||
* | implementations (in OO lingo virtual methods) for
|
||||
* | the actual Image implementations as well as a bunch of
|
||||
* | maths methods.
|
||||
* |
|
||||
* +-Image_GD The Image implementation for the PHP GD extension . Inherits
|
||||
* Image_Resize
|
||||
* When calling DB::setup for GD images the object returned is an
|
||||
* instance of this class.
|
||||
*
|
||||
* @package Image Resize
|
||||
* @version 1.00
|
||||
* @author Peter Bowyer <peter@mapledesign.co.uk>
|
||||
* @since PHP 4.0
|
||||
*/
|
||||
Class Image_Transform
|
||||
{
|
||||
/**
|
||||
* Name of the image file
|
||||
* @var string
|
||||
*/
|
||||
var $image = '';
|
||||
/**
|
||||
* Type of the image file (eg. jpg, gif png ...)
|
||||
* @var string
|
||||
*/
|
||||
var $type = '';
|
||||
/**
|
||||
* Original image width in x direction
|
||||
* @var int
|
||||
*/
|
||||
var $img_x = '';
|
||||
/**
|
||||
* Original image width in y direction
|
||||
* @var int
|
||||
*/
|
||||
var $img_y = '';
|
||||
/**
|
||||
* New image width in x direction
|
||||
* @var int
|
||||
*/
|
||||
var $new_x = '';
|
||||
/**
|
||||
* New image width in y direction
|
||||
* @var int
|
||||
*/
|
||||
var $new_y = '';
|
||||
/**
|
||||
* Path the the library used
|
||||
* e.g. /usr/local/ImageMagick/bin/ or
|
||||
* /usr/local/netpbm/
|
||||
*/
|
||||
var $lib_path = '';
|
||||
/**
|
||||
* Flag to warn if image has been resized more than once before displaying
|
||||
* or saving.
|
||||
*/
|
||||
var $resized = false;
|
||||
|
||||
|
||||
var $uid = '';
|
||||
|
||||
var $lapse_time =900; //15 mins
|
||||
|
||||
/**
|
||||
* Create a new Image_resize object
|
||||
*
|
||||
* @param string $driver name of driver class to initialize
|
||||
*
|
||||
* @return mixed a newly created Image_Transform object, or a PEAR
|
||||
* error object on error
|
||||
*
|
||||
* @see PEAR::isError()
|
||||
* @see Image_Transform::setOption()
|
||||
*/
|
||||
function &factory($driver)
|
||||
{
|
||||
if ('' == $driver) {
|
||||
die("No image library specified... aborting. You must call ::factory() with one parameter, the library to load.");
|
||||
|
||||
}
|
||||
$this->uid = md5($_SERVER['REMOTE_ADDR']);
|
||||
|
||||
include_once "../ImageManager/Classes/$driver.php";
|
||||
|
||||
$classname = "Image_Transform_Driver_{$driver}";
|
||||
$obj =& new $classname;
|
||||
return $obj;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Resize the Image in the X and/or Y direction
|
||||
* If either is 0 it will be scaled proportionally
|
||||
*
|
||||
* @access public
|
||||
*
|
||||
* @param mixed $new_x (0, number, percentage 10% or 0.1)
|
||||
* @param mixed $new_y (0, number, percentage 10% or 0.1)
|
||||
*
|
||||
* @return mixed none or PEAR_error
|
||||
*/
|
||||
function resize($new_x = 0, $new_y = 0)
|
||||
{
|
||||
// 0 means keep original size
|
||||
$new_x = (0 == $new_x) ? $this->img_x : $this->_parse_size($new_x, $this->img_x);
|
||||
$new_y = (0 == $new_y) ? $this->img_y : $this->_parse_size($new_y, $this->img_y);
|
||||
// Now do the library specific resizing.
|
||||
return $this->_resize($new_x, $new_y);
|
||||
} // End resize
|
||||
|
||||
|
||||
/**
|
||||
* Scale the image to have the max x dimension specified.
|
||||
*
|
||||
* @param int $new_x Size to scale X-dimension to
|
||||
* @return none
|
||||
*/
|
||||
function scaleMaxX($new_x)
|
||||
{
|
||||
$new_y = round(($new_x / $this->img_x) * $this->img_y, 0);
|
||||
return $this->_resize($new_x, $new_y);
|
||||
} // End resizeX
|
||||
|
||||
/**
|
||||
* Scale the image to have the max y dimension specified.
|
||||
*
|
||||
* @access public
|
||||
* @param int $new_y Size to scale Y-dimension to
|
||||
* @return none
|
||||
*/
|
||||
function scaleMaxY($new_y)
|
||||
{
|
||||
$new_x = round(($new_y / $this->img_y) * $this->img_x, 0);
|
||||
return $this->_resize($new_x, $new_y);
|
||||
} // End resizeY
|
||||
|
||||
/**
|
||||
* Scale Image to a maximum or percentage
|
||||
*
|
||||
* @access public
|
||||
* @param mixed (number, percentage 10% or 0.1)
|
||||
* @return mixed none or PEAR_error
|
||||
*/
|
||||
function scale($size)
|
||||
{
|
||||
if ((strlen($size) > 1) && (substr($size,-1) == '%')) {
|
||||
return $this->scaleByPercentage(substr($size, 0, -1));
|
||||
} elseif ($size < 1) {
|
||||
return $this->scaleByFactor($size);
|
||||
} else {
|
||||
return $this->scaleByLength($size);
|
||||
}
|
||||
} // End scale
|
||||
|
||||
/**
|
||||
* Scales an image to a percentage of its original size. For example, if
|
||||
* my image was 640x480 and I called scaleByPercentage(10) then the image
|
||||
* would be resized to 64x48
|
||||
*
|
||||
* @access public
|
||||
* @param int $size Percentage of original size to scale to
|
||||
* @return none
|
||||
*/
|
||||
function scaleByPercentage($size)
|
||||
{
|
||||
return $this->scaleByFactor($size / 100);
|
||||
} // End scaleByPercentage
|
||||
|
||||
/**
|
||||
* Scales an image to a factor of its original size. For example, if
|
||||
* my image was 640x480 and I called scaleByFactor(0.5) then the image
|
||||
* would be resized to 320x240.
|
||||
*
|
||||
* @access public
|
||||
* @param float $size Factor of original size to scale to
|
||||
* @return none
|
||||
*/
|
||||
function scaleByFactor($size)
|
||||
{
|
||||
$new_x = round($size * $this->img_x, 0);
|
||||
$new_y = round($size * $this->img_y, 0);
|
||||
return $this->_resize($new_x, $new_y);
|
||||
} // End scaleByFactor
|
||||
|
||||
/**
|
||||
* Scales an image so that the longest side has this dimension.
|
||||
*
|
||||
* @access public
|
||||
* @param int $size Max dimension in pixels
|
||||
* @return none
|
||||
*/
|
||||
function scaleByLength($size)
|
||||
{
|
||||
if ($this->img_x >= $this->img_y) {
|
||||
$new_x = $size;
|
||||
$new_y = round(($new_x / $this->img_x) * $this->img_y, 0);
|
||||
} else {
|
||||
$new_y = $size;
|
||||
$new_x = round(($new_y / $this->img_y) * $this->img_x, 0);
|
||||
}
|
||||
return $this->_resize($new_x, $new_y);
|
||||
} // End scaleByLength
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
function _get_image_details($image)
|
||||
{
|
||||
//echo $image;
|
||||
$data = @GetImageSize($image);
|
||||
#1 = GIF, 2 = JPG, 3 = PNG, 4 = SWF, 5 = PSD, 6 = BMP, 7 = TIFF(intel byte order), 8 = TIFF(motorola byte order,
|
||||
# 9 = JPC, 10 = JP2, 11 = JPX, 12 = JB2, 13 = SWC
|
||||
if (is_array($data)){
|
||||
switch($data[2]){
|
||||
case 1:
|
||||
$type = 'gif';
|
||||
break;
|
||||
case 2:
|
||||
$type = 'jpeg';
|
||||
break;
|
||||
case 3:
|
||||
$type = 'png';
|
||||
break;
|
||||
case 4:
|
||||
$type = 'swf';
|
||||
break;
|
||||
case 5:
|
||||
$type = 'psd';
|
||||
case 6:
|
||||
$type = 'bmp';
|
||||
case 7:
|
||||
case 8:
|
||||
$type = 'tiff';
|
||||
default:
|
||||
echo("We do not recognize this image format");
|
||||
}
|
||||
$this->img_x = $data[0];
|
||||
$this->img_y = $data[1];
|
||||
$this->type = $type;
|
||||
|
||||
return true;
|
||||
} else {
|
||||
echo("Cannot fetch image or images details.");
|
||||
return null;
|
||||
}
|
||||
/*
|
||||
$output = array(
|
||||
'width' => $data[0],
|
||||
'height' => $data[1],
|
||||
'type' => $type
|
||||
);
|
||||
return $output;
|
||||
*/
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Parse input and convert
|
||||
* If either is 0 it will be scaled proportionally
|
||||
*
|
||||
* @access private
|
||||
*
|
||||
* @param mixed $new_size (0, number, percentage 10% or 0.1)
|
||||
* @param int $old_size
|
||||
*
|
||||
* @return mixed none or PEAR_error
|
||||
*/
|
||||
function _parse_size($new_size, $old_size)
|
||||
{
|
||||
if ('%' == $new_size) {
|
||||
$new_size = str_replace('%','',$new_size);
|
||||
$new_size = $new_size / 100;
|
||||
}
|
||||
if ($new_size > 1) {
|
||||
return (int) $new_size;
|
||||
} elseif ($new_size == 0) {
|
||||
return (int) $old_size;
|
||||
} else {
|
||||
return (int) round($new_size * $old_size, 0);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function uniqueStr()
|
||||
{
|
||||
return substr(md5(microtime()),0,6);
|
||||
}
|
||||
|
||||
//delete old tmp files, and allow only 1 file per remote host.
|
||||
function cleanUp($id, $dir)
|
||||
{
|
||||
$d = dir($dir);
|
||||
$id_length = strlen($id);
|
||||
|
||||
while (false !== ($entry = $d->read())) {
|
||||
if (is_file($dir.'/'.$entry) && substr($entry,0,1) == '.' && !ereg($entry, $this->image))
|
||||
{
|
||||
//echo filemtime($this->directory.'/'.$entry)."<br>";
|
||||
//echo time();
|
||||
|
||||
if (filemtime($dir.'/'.$entry) + $this->lapse_time < time())
|
||||
unlink($dir.'/'.$entry);
|
||||
|
||||
if (substr($entry, 1, $id_length) == $id)
|
||||
{
|
||||
if (is_file($dir.'/'.$entry))
|
||||
unlink($dir.'/'.$entry);
|
||||
}
|
||||
}
|
||||
}
|
||||
$d->close();
|
||||
}
|
||||
|
||||
|
||||
function createUnique($dir)
|
||||
{
|
||||
$unique_str = '.'.$this->uid.'_'.$this->uniqueStr().".".$this->type;
|
||||
|
||||
//make sure the the unique temp file does not exists
|
||||
while (file_exists($dir.$unique_str))
|
||||
{
|
||||
$unique_str = '.'.$this->uid.'_'.$this->uniqueStr().".".$this->type;
|
||||
}
|
||||
|
||||
$this->cleanUp($this->uid, $dir);
|
||||
|
||||
return $unique_str;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Set the image width
|
||||
* @param int $size dimension to set
|
||||
* @since 29/05/02 13:36:31
|
||||
* @return
|
||||
*/
|
||||
function _set_img_x($size)
|
||||
{
|
||||
$this->img_x = $size;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the image height
|
||||
* @param int $size dimension to set
|
||||
* @since 29/05/02 13:36:31
|
||||
* @return
|
||||
*/
|
||||
function _set_img_y($size)
|
||||
{
|
||||
$this->img_y = $size;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the image width
|
||||
* @param int $size dimension to set
|
||||
* @since 29/05/02 13:36:31
|
||||
* @return
|
||||
*/
|
||||
function _set_new_x($size)
|
||||
{
|
||||
$this->new_x = $size;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the image height
|
||||
* @param int $size dimension to set
|
||||
* @since 29/05/02 13:36:31
|
||||
* @return
|
||||
*/
|
||||
function _set_new_y($size)
|
||||
{
|
||||
$this->new_y = $size;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the type of the image being manipulated
|
||||
*
|
||||
* @return string $this->type the image type
|
||||
*/
|
||||
function getImageType()
|
||||
{
|
||||
return $this->type;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @access public
|
||||
* @return string web-safe image type
|
||||
*/
|
||||
function getWebSafeFormat()
|
||||
{
|
||||
switch($this->type){
|
||||
case 'gif':
|
||||
case 'png':
|
||||
return 'png';
|
||||
break;
|
||||
default:
|
||||
return 'jpeg';
|
||||
} // switch
|
||||
}
|
||||
|
||||
/**
|
||||
* Place holder for the real resize method
|
||||
* used by extended methods to do the resizing
|
||||
*
|
||||
* @access private
|
||||
* @return PEAR_error
|
||||
*/
|
||||
function _resize() {
|
||||
return null; //PEAR::raiseError("No Resize method exists", true);
|
||||
}
|
||||
|
||||
/**
|
||||
* Place holder for the real load method
|
||||
* used by extended methods to do the resizing
|
||||
*
|
||||
* @access public
|
||||
* @return PEAR_error
|
||||
*/
|
||||
function load($filename) {
|
||||
return null; //PEAR::raiseError("No Load method exists", true);
|
||||
}
|
||||
|
||||
/**
|
||||
* Place holder for the real display method
|
||||
* used by extended methods to do the resizing
|
||||
*
|
||||
* @access public
|
||||
* @param string filename
|
||||
* @return PEAR_error
|
||||
*/
|
||||
function display($type, $quality) {
|
||||
return null; //PEAR::raiseError("No Display method exists", true);
|
||||
}
|
||||
|
||||
/**
|
||||
* Place holder for the real save method
|
||||
* used by extended methods to do the resizing
|
||||
*
|
||||
* @access public
|
||||
* @param string filename
|
||||
* @return PEAR_error
|
||||
*/
|
||||
function save($filename, $type, $quality) {
|
||||
return null; //PEAR::raiseError("No Save method exists", true);
|
||||
}
|
||||
|
||||
/**
|
||||
* Place holder for the real free method
|
||||
* used by extended methods to do the resizing
|
||||
*
|
||||
* @access public
|
||||
* @return PEAR_error
|
||||
*/
|
||||
function free() {
|
||||
return null; //PEAR::raiseError("No Free method exists", true);
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse of rgb2colorname.
|
||||
*
|
||||
* @access public
|
||||
* @return PEAR_error
|
||||
*
|
||||
* @see rgb2colorname
|
||||
*/
|
||||
function colorhex2colorarray($colorhex) {
|
||||
$r = hexdec(substr($colorhex, 1, 2));
|
||||
$g = hexdec(substr($colorhex, 3, 2));
|
||||
$b = hexdec(substr($colorhex, 4, 2));
|
||||
return array($r,$g,$b);
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse of rgb2colorname.
|
||||
*
|
||||
* @access public
|
||||
* @return PEAR_error
|
||||
*
|
||||
* @see rgb2colorname
|
||||
*/
|
||||
function colorarray2colorhex($color) {
|
||||
$color = '#'.dechex($color[0]).dechex($color[1]).dechex($color[2]);
|
||||
return strlen($color)>6?false:$color;
|
||||
}
|
||||
|
||||
|
||||
/* Methods to add to the driver classes in the future */
|
||||
function addText()
|
||||
{
|
||||
return null; //PEAR::raiseError("No addText method exists", true);
|
||||
}
|
||||
|
||||
function addDropShadow()
|
||||
{
|
||||
return null; //PEAR::raiseError("No AddDropShadow method exists", true);
|
||||
}
|
||||
|
||||
function addBorder()
|
||||
{
|
||||
return null; //PEAR::raiseError("No addBorder method exists", true);
|
||||
}
|
||||
|
||||
function crop()
|
||||
{
|
||||
return null; //PEAR::raiseError("No crop method exists", true);
|
||||
}
|
||||
|
||||
function flip()
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
function gamma()
|
||||
{
|
||||
return null; //PEAR::raiseError("No gamma method exists", true);
|
||||
}
|
||||
}
|
||||
?>
|
||||
@@ -0,0 +1,150 @@
|
||||
Originally Developed by: http://www.zhuo.org/htmlarea/
|
||||
|
||||
> This is a plug-in for HTMLArea 3.0
|
||||
>
|
||||
> The PHP ImageManager + Editor provides an interface to
|
||||
> browser for image files on your web server. The Editor
|
||||
> allows some basic image manipulations such as, cropping,
|
||||
> rotation, flip, and scaling.
|
||||
>
|
||||
> Further and up-to-date documentation can be found at
|
||||
> http://www.zhuo.org/htmlarea/docs/index.html
|
||||
>
|
||||
> Cheer,
|
||||
> Wei
|
||||
|
||||
2005-03-20
|
||||
by Yermo Lamers of DTLink, LLC (http://www.formvista.com/contact.html)
|
||||
|
||||
Please post questions/comments/flames about this plugin in the Xinha forums
|
||||
at
|
||||
|
||||
http://xinha.gogo.co.nz/punbb/viewforum.php?id=1
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
If you have GD installed and configured in PHP this should work out of the
|
||||
box.
|
||||
|
||||
For production use see config.inc.php for configuration values. You will
|
||||
want to adjust images_dir and images_url for your application.
|
||||
|
||||
For demo purposes ImageManager is set up to view images in the
|
||||
|
||||
/xinha/plugins/ImageManager/demo_images
|
||||
|
||||
directory. This is governed by the images_dir and images_url config options.
|
||||
|
||||
The permissions on the demo_images directory may not be correct. The directory
|
||||
should be owned by the user your webserver runs as and should have 755
|
||||
permissions.
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
By default this ImageManager is set up to browse some graphics
|
||||
in plugins/ImageManager/demo_images.
|
||||
|
||||
For security reasons image uploading is turned off by default.
|
||||
You can enable it by editing config.inc.php.
|
||||
|
||||
---------------------------------
|
||||
For Developers
|
||||
---------------------------------
|
||||
|
||||
CHANGES FROM Wei's Original Code:
|
||||
|
||||
Single Backend:
|
||||
---------------
|
||||
|
||||
All requests from the javascript code back to the server now
|
||||
are routed through a single configurable backend script,
|
||||
backend.php.
|
||||
|
||||
Request URLs are of the form:
|
||||
|
||||
<config backend URL>(?|&)__plugin=ImageManager&__function=<function>&arg=value&arg=value
|
||||
|
||||
The default URL is plugins/xinha/backend.php.
|
||||
|
||||
This approach makes it possible to completely replace the
|
||||
backend with a perl or ASP implementation without having to
|
||||
change any of the client side code.
|
||||
|
||||
You can override the location and name of the backend.php
|
||||
script by setting the config.ImageManager.backend property from
|
||||
the calling page. Make sure the URL ends in an "&". The code,
|
||||
for now, assumes it can just tack on variables.
|
||||
|
||||
For the moment the javascript files in the assets directory do
|
||||
not have access to the main editor object and as a result have
|
||||
not access to the config. For the moment we use a _backend_url
|
||||
variable output from PHP to communicate the location of the
|
||||
backend to these assets. It's a kludge. Ideally all these
|
||||
config values should be set from the calling page and be
|
||||
available through the editor.config.ImageManager object.
|
||||
|
||||
Debug Messages
|
||||
---------------
|
||||
|
||||
The php files include a simple debugging library, ddt.php. See
|
||||
config.inc.php for how to turn it on. It can display trace
|
||||
messages to the browser or dump them to a log file.
|
||||
|
||||
I'll try to package up the client-side tracing-to-textarea
|
||||
_ddt() functions I've put together. Having a trace message
|
||||
infrastructure has always served me well.
|
||||
|
||||
-------------
|
||||
Flakey Editor
|
||||
-------------
|
||||
|
||||
The editor I use is flakey (but very very fast). It has
|
||||
problems with tab to space conversion so if the indenting looks
|
||||
weird that's why.
|
||||
|
||||
----
|
||||
TODO
|
||||
----
|
||||
|
||||
ImageManager really needs a complete rewrite.
|
||||
|
||||
. ImageManager should appear in a pane instead of a popup
|
||||
window using Sleeman's windowpane support.
|
||||
|
||||
. html and php code are intermixed. It would be very nice to
|
||||
use some kind of templating for the dialogs; this templating
|
||||
should be done long hand so it can be re-used regardless of the
|
||||
backend implementation language.
|
||||
|
||||
. the config should probably be some format that would be
|
||||
easily read by multiple implementations of the back end. It
|
||||
would be nice to have a single configuration system regardless
|
||||
of whether the backend is PHP, Perl or ASP.
|
||||
|
||||
. javascript assets are not objects. Passing config options to
|
||||
the assets functions requires intermediate variables which is
|
||||
really ugly. Everything should be cleanly integrated into the
|
||||
object heirarchy akin to the way Linker is done.
|
||||
|
||||
. if an image is selected from the document editor window it
|
||||
should be focused and highlighted in the image selection
|
||||
window.
|
||||
|
||||
. fix fully-qualified url in image selection box under MSIE.
|
||||
|
||||
. per-image permissions. We should include some kind of backend
|
||||
permissions management so users can only
|
||||
delete/edit/move/rename images that they have uploaded.
|
||||
|
||||
. add a CANCEL button and a SAVE AS button to the editor.
|
||||
|
||||
. add a list view akin to EFM. (and include image properties
|
||||
width/height/depth/etc.)
|
||||
|
||||
. figure out a way for ImageManager to work "out of the box"
|
||||
regardless of install.
|
||||
|
||||
. client-side tracing.
|
||||
|
||||
. fancy stuff like adding a UI to define rollovers, animations,
|
||||
etc.
|
||||
|
||||
@@ -0,0 +1,660 @@
|
||||
/* This compressed file is part of Xinha. For uncompressed sources, forum, and bug reports, go to xinha.org */
|
||||
/* This file is part of version 0.95 released Mon, 12 May 2008 17:33:15 +0200 */
|
||||
/* The URL of the most recent version of this file is http://svn.xinha.webfactional.com/trunk/plugins/ImageManager/assets/EditorContent.js */
|
||||
function MM_findObj(n,d){
|
||||
var p,i,x;
|
||||
if(!d){
|
||||
d=document;
|
||||
}
|
||||
if((p=n.indexOf("?"))>0&&parent.frames.length){
|
||||
d=parent.frames[n.substring(p+1)].document;
|
||||
n=n.substring(0,p);
|
||||
}
|
||||
if(!(x=d[n])&&d.all){
|
||||
x=d.all[n];
|
||||
}
|
||||
for(i=0;!x&&i<d.forms.length;i++){
|
||||
x=d.forms[i][n];
|
||||
}
|
||||
for(i=0;!x&&d.layers&&i<d.layers.length;i++){
|
||||
x=MM_findObj(n,d.layers[i].document);
|
||||
}
|
||||
if(!x&&d.getElementById){
|
||||
x=d.getElementById(n);
|
||||
}
|
||||
return x;
|
||||
}
|
||||
var pic_x,pic_y;
|
||||
function P7_Snap(){
|
||||
var x,y,ox,bx,oy,p,tx,a,b,k,d,da,e,el,args=P7_Snap.arguments;
|
||||
a=parseInt(a);
|
||||
for(k=0;k<(args.length-3);k+=4){
|
||||
if((g=MM_findObj(args[k]))!=null){
|
||||
el=eval(MM_findObj(args[k+1]));
|
||||
a=parseInt(args[k+2]);
|
||||
b=parseInt(args[k+3]);
|
||||
x=0;
|
||||
y=0;
|
||||
ox=0;
|
||||
oy=0;
|
||||
p="";
|
||||
tx=1;
|
||||
da="document.all['"+args[k]+"']";
|
||||
if(document.getElementById){
|
||||
d="document.getElementsByName('"+args[k]+"')[0]";
|
||||
if(!eval(d)){
|
||||
d="document.getElementById('"+args[k]+"')";
|
||||
if(!eval(d)){
|
||||
d=da;
|
||||
}
|
||||
}
|
||||
}else{
|
||||
if(document.all){
|
||||
d=da;
|
||||
}
|
||||
}
|
||||
if(document.all||document.getElementById){
|
||||
while(tx==1){
|
||||
p+=".offsetParent";
|
||||
if(eval(d+p)){
|
||||
x+=parseInt(eval(d+p+".offsetLeft"));
|
||||
y+=parseInt(eval(d+p+".offsetTop"));
|
||||
}else{
|
||||
tx=0;
|
||||
}
|
||||
}
|
||||
ox=parseInt(g.offsetLeft);
|
||||
oy=parseInt(g.offsetTop);
|
||||
var tw=x+ox+y+oy;
|
||||
if(tw==0||(navigator.appVersion.indexOf("MSIE 4")>-1&&navigator.appVersion.indexOf("Mac")>-1)){
|
||||
ox=0;
|
||||
oy=0;
|
||||
if(g.style.left){
|
||||
x=parseInt(g.style.left);
|
||||
y=parseInt(g.style.top);
|
||||
}else{
|
||||
var w1=parseInt(el.style.width);
|
||||
bx=(a<0)?-5-w1:-10;
|
||||
a=(Math.abs(a)<1000)?0:a;
|
||||
b=(Math.abs(b)<1000)?0:b;
|
||||
if(event==null){
|
||||
x=document.body.scrollLeft+bx;
|
||||
}else{
|
||||
x=document.body.scrollLeft+event.clientX+bx;
|
||||
}
|
||||
if(event==null){
|
||||
y=document.body.scrollTop;
|
||||
}else{
|
||||
y=document.body.scrollTop+event.clientY;
|
||||
}
|
||||
}
|
||||
}
|
||||
}else{
|
||||
if(document.layers){
|
||||
x=g.x;
|
||||
y=g.y;
|
||||
var q0=document.layers,dd="";
|
||||
for(var s=0;s<q0.length;s++){
|
||||
dd="document."+q0[s].name;
|
||||
if(eval(dd+".document."+args[k])){
|
||||
x+=eval(dd+".left");
|
||||
y+=eval(dd+".top");
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if(el){
|
||||
e=(document.layers)?el:el.style;
|
||||
var xx=parseInt(x+ox+a),yy=parseInt(y+oy+b);
|
||||
if(navigator.appName=="Netscape"&&parseInt(navigator.appVersion)>4){
|
||||
xx+="px";
|
||||
yy+="px";
|
||||
}
|
||||
if(navigator.appVersion.indexOf("MSIE 5")>-1&&navigator.appVersion.indexOf("Mac")>-1){
|
||||
xx+=parseInt(document.body.leftMargin);
|
||||
yy+=parseInt(document.body.topMargin);
|
||||
xx+="px";
|
||||
yy+="px";
|
||||
}
|
||||
e.left=xx;
|
||||
e.top=yy;
|
||||
}
|
||||
pic_x=parseInt(xx);
|
||||
pic_y=parseInt(yy);
|
||||
}
|
||||
}
|
||||
}
|
||||
var ie=document.all;
|
||||
var ns6=document.getElementById&&!document.all;
|
||||
var dragapproved=false;
|
||||
var z,x,y,status,ant,canvas,content,pic_width,pic_height,image,resizeHandle,oa_w,oa_h,oa_x,oa_y,mx2,my2;
|
||||
function init_resize(){
|
||||
if(mode=="scale"){
|
||||
P7_Snap("theImage","ant",0,0);
|
||||
if(canvas==null){
|
||||
canvas=MM_findObj("imgCanvas");
|
||||
}
|
||||
if(pic_width==null||pic_height==null){
|
||||
image=MM_findObj("theImage");
|
||||
pic_width=image.width;
|
||||
pic_height=image.height;
|
||||
}
|
||||
if(ant==null){
|
||||
ant=MM_findObj("ant");
|
||||
}
|
||||
ant.style.left=pic_x;
|
||||
ant.style.top=pic_y;
|
||||
ant.style.width=pic_width;
|
||||
ant.style.height=pic_height;
|
||||
ant.style.visibility="visible";
|
||||
drawBoundHandle();
|
||||
jg_doc.paint();
|
||||
}
|
||||
}
|
||||
initEditor=function(){
|
||||
init_crop();
|
||||
init_resize();
|
||||
var _a=MM_findObj("markerImg",window.top.document);
|
||||
if(_a.src.indexOf("img/t_white.gif")>0){
|
||||
toggleMarker();
|
||||
}
|
||||
};
|
||||
function init_crop(){
|
||||
P7_Snap("theImage","ant",0,0);
|
||||
}
|
||||
function setMode(_b){
|
||||
mode=_b;
|
||||
reset();
|
||||
}
|
||||
function reset(){
|
||||
if(ant==null){
|
||||
ant=MM_findObj("ant");
|
||||
}
|
||||
ant.style.visibility="hidden";
|
||||
ant.style.left=0;
|
||||
ant.style.top=0;
|
||||
ant.style.width=0;
|
||||
ant.style.height=0;
|
||||
mx2=null;
|
||||
my2=null;
|
||||
jg_doc.clear();
|
||||
if(mode!="measure"){
|
||||
showStatus();
|
||||
}
|
||||
if(mode=="scale"){
|
||||
init_resize();
|
||||
}
|
||||
P7_Snap("theImage","ant",0,0);
|
||||
}
|
||||
function toggleMarker(){
|
||||
if(ant==null){
|
||||
ant=MM_findObj("ant");
|
||||
}
|
||||
if(ant.className=="selection"){
|
||||
ant.className="selectionWhite";
|
||||
}else{
|
||||
ant.className="selection";
|
||||
}
|
||||
if(jg_doc.getColor()=="#000000"){
|
||||
jg_doc.setColor("#FFFFFF");
|
||||
}else{
|
||||
jg_doc.setColor("#000000");
|
||||
}
|
||||
drawBoundHandle;
|
||||
jg_doc.paint();
|
||||
}
|
||||
function move(e){
|
||||
if(dragapproved){
|
||||
var w=ns6?temp1+e.clientX-x:temp1+event.clientX-x;
|
||||
var h=ns6?temp2+e.clientY-y:temp2+event.clientY-y;
|
||||
if(ant!=null){
|
||||
if(w>=0){
|
||||
ant.style.left=x;
|
||||
ant.style.width=w;
|
||||
}else{
|
||||
ant.style.left=x+w;
|
||||
ant.style.width=-1*w;
|
||||
}
|
||||
if(h>=0){
|
||||
ant.style.top=y;
|
||||
ant.style.height=h;
|
||||
}else{
|
||||
ant.style.top=y+h;
|
||||
ant.style.height=-1*h;
|
||||
}
|
||||
}
|
||||
showStatus();
|
||||
return false;
|
||||
}
|
||||
}
|
||||
function moveContent(e){
|
||||
if(dragapproved){
|
||||
var dx=ns6?oa_x+e.clientX-x:oa_x+event.clientX-x;
|
||||
var dy=ns6?oa_y+e.clientY-y:oa_y+event.clientY-y;
|
||||
ant.style.left=dx;
|
||||
ant.style.top=dy;
|
||||
showStatus();
|
||||
return false;
|
||||
}
|
||||
}
|
||||
function moveHandle(e){
|
||||
if(dragapproved){
|
||||
var w=ns6?e.clientX-x:event.clientX-x;
|
||||
var h=ns6?e.clientY-y:event.clientY-y;
|
||||
var _15=MM_findObj("constProp",window.top.document);
|
||||
var _16=document.theImage.height;
|
||||
var _17=document.theImage.width;
|
||||
rapp=_17/_16;
|
||||
rapp_inv=_16/_17;
|
||||
switch(resizeHandle){
|
||||
case "s-resize":
|
||||
if(oa_h+h>=0){
|
||||
ant.style.height=oa_h+h;
|
||||
if(_15.checked){
|
||||
ant.style.width=rapp*(oa_h+h);
|
||||
ant.style.left=oa_x-rapp*h/2;
|
||||
}
|
||||
}
|
||||
break;
|
||||
case "e-resize":
|
||||
if(oa_w+w>=0){
|
||||
ant.style.width=oa_w+w;
|
||||
if(_15.checked){
|
||||
ant.style.height=rapp_inv*(oa_w+w);
|
||||
ant.style.top=oa_y-rapp_inv*w/2;
|
||||
}
|
||||
}
|
||||
break;
|
||||
case "n-resize":
|
||||
if(oa_h-h>=0){
|
||||
ant.style.top=oa_y+h;
|
||||
ant.style.height=oa_h-h;
|
||||
if(_15.checked){
|
||||
ant.style.width=rapp*(oa_h-h);
|
||||
ant.style.left=oa_x+rapp*h/2;
|
||||
}
|
||||
}
|
||||
break;
|
||||
case "w-resize":
|
||||
if(oa_w-w>=0){
|
||||
ant.style.left=oa_x+w;
|
||||
ant.style.width=oa_w-w;
|
||||
if(_15.checked){
|
||||
ant.style.height=rapp_inv*(oa_w-w);
|
||||
ant.style.top=oa_y+rapp_inv*w/2;
|
||||
}
|
||||
}
|
||||
break;
|
||||
case "nw-resize":
|
||||
if(oa_h-h>=0&&oa_w-w>=0){
|
||||
ant.style.left=oa_x+w;
|
||||
ant.style.width=oa_w-w;
|
||||
ant.style.top=oa_y+h;
|
||||
if(_15.checked){
|
||||
ant.style.height=rapp_inv*(oa_w-w);
|
||||
}else{
|
||||
ant.style.height=oa_h-h;
|
||||
}
|
||||
}
|
||||
break;
|
||||
case "ne-resize":
|
||||
if(oa_h-h>=0&&oa_w+w>=0){
|
||||
ant.style.top=oa_y+h;
|
||||
ant.style.width=oa_w+w;
|
||||
if(_15.checked){
|
||||
ant.style.height=rapp_inv*(oa_w+w);
|
||||
}else{
|
||||
ant.style.height=oa_h-h;
|
||||
}
|
||||
}
|
||||
break;
|
||||
case "se-resize":
|
||||
if(oa_h+h>=0&&oa_w+w>=0){
|
||||
ant.style.width=oa_w+w;
|
||||
if(_15.checked){
|
||||
ant.style.height=rapp_inv*(oa_w+w);
|
||||
}else{
|
||||
ant.style.height=oa_h+h;
|
||||
}
|
||||
}
|
||||
break;
|
||||
case "sw-resize":
|
||||
if(oa_h+h>=0&&oa_w-w>=0){
|
||||
ant.style.left=oa_x+w;
|
||||
ant.style.width=oa_w-w;
|
||||
if(_15.checked){
|
||||
ant.style.height=rapp_inv*(oa_w-w);
|
||||
}else{
|
||||
ant.style.height=oa_h+h;
|
||||
}
|
||||
}
|
||||
}
|
||||
showStatus();
|
||||
return false;
|
||||
}
|
||||
}
|
||||
function drags(e){
|
||||
if(!ie&&!ns6){
|
||||
return;
|
||||
}
|
||||
var _19=ns6?e.target:event.srcElement;
|
||||
var _1a=ns6?"HTML":"BODY";
|
||||
while(_19.tagName!=_1a&&!(_19.className=="crop"||_19.className=="handleBox"||_19.className=="selection"||_19.className=="selectionWhite")){
|
||||
_19=ns6?_19.parentNode:_19.parentElement;
|
||||
}
|
||||
if(_19.className=="handleBox"){
|
||||
if(content!=null){
|
||||
if(content.width!=null&&content.height!=null){
|
||||
content.width=0;
|
||||
content.height=0;
|
||||
}
|
||||
}
|
||||
resizeHandle=_19.id;
|
||||
x=ns6?e.clientX:event.clientX;
|
||||
y=ns6?e.clientY:event.clientY;
|
||||
oa_w=parseInt(ant.style.width);
|
||||
oa_h=parseInt(ant.style.height);
|
||||
oa_x=parseInt(ant.style.left);
|
||||
oa_y=parseInt(ant.style.top);
|
||||
dragapproved=true;
|
||||
document.onmousemove=moveHandle;
|
||||
return false;
|
||||
}else{
|
||||
if((_19.className=="selection"||_19.className=="selectionWhite")&&mode=="crop"){
|
||||
x=ns6?e.clientX:event.clientX;
|
||||
y=ns6?e.clientY:event.clientY;
|
||||
oa_x=parseInt(ant.style.left);
|
||||
oa_y=parseInt(ant.style.top);
|
||||
dragapproved=true;
|
||||
document.onmousemove=moveContent;
|
||||
return false;
|
||||
}else{
|
||||
if(_19.className=="crop"&&mode=="crop"){
|
||||
if(content!=null){
|
||||
if(content.width!=null&&content.height!=null){
|
||||
content.width=0;
|
||||
content.height=0;
|
||||
}
|
||||
}
|
||||
if(status==null){
|
||||
status=MM_findObj("status");
|
||||
}
|
||||
if(ant==null){
|
||||
ant=MM_findObj("ant");
|
||||
}
|
||||
if(canvas==null){
|
||||
canvas=MM_findObj("imgCanvas");
|
||||
}
|
||||
if(content==null){
|
||||
content=MM_findObj("cropContent");
|
||||
}
|
||||
if(pic_width==null||pic_height==null){
|
||||
image=MM_findObj("theImage");
|
||||
pic_width=image.width;
|
||||
pic_height=image.height;
|
||||
}
|
||||
ant.style.visibility="visible";
|
||||
obj=_19;
|
||||
dragapproved=true;
|
||||
z=_19;
|
||||
temp1=parseInt(z.style.left+0);
|
||||
temp2=parseInt(z.style.top+0);
|
||||
x=ns6?e.clientX:event.clientX;
|
||||
y=ns6?e.clientY:event.clientY;
|
||||
document.onmousemove=move;
|
||||
return false;
|
||||
}else{
|
||||
if(_19.className=="crop"&&mode=="measure"){
|
||||
if(ant==null){
|
||||
ant=MM_findObj("ant");
|
||||
}
|
||||
if(canvas==null){
|
||||
canvas=MM_findObj("imgCanvas");
|
||||
}
|
||||
x=ns6?e.clientX:event.clientX;
|
||||
y=ns6?e.clientY:event.clientY;
|
||||
dragapproved=true;
|
||||
document.onmousemove=measure;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
function measure(e){
|
||||
if(dragapproved){
|
||||
mx2=ns6?e.clientX:event.clientX;
|
||||
my2=ns6?e.clientY:event.clientY;
|
||||
jg_doc.clear();
|
||||
jg_doc.setStroke(Stroke.DOTTED);
|
||||
jg_doc.drawLine(x,y,mx2,my2);
|
||||
jg_doc.paint();
|
||||
showStatus();
|
||||
return false;
|
||||
}
|
||||
}
|
||||
function setMarker(nx,ny,nw,nh){
|
||||
if(isNaN(nx)){
|
||||
nx=0;
|
||||
}
|
||||
if(isNaN(ny)){
|
||||
ny=0;
|
||||
}
|
||||
if(isNaN(nw)){
|
||||
nw=0;
|
||||
}
|
||||
if(isNaN(nh)){
|
||||
nh=0;
|
||||
}
|
||||
if(ant==null){
|
||||
ant=MM_findObj("ant");
|
||||
}
|
||||
if(canvas==null){
|
||||
canvas=MM_findObj("imgCanvas");
|
||||
}
|
||||
if(content==null){
|
||||
content=MM_findObj("cropContent");
|
||||
}
|
||||
if(pic_width==null||pic_height==null){
|
||||
image=MM_findObj("theImage");
|
||||
pic_width=image.width;
|
||||
pic_height=image.height;
|
||||
}
|
||||
ant.style.visibility="visible";
|
||||
nx=pic_x+nx;
|
||||
ny=pic_y+ny;
|
||||
if(nw>=0){
|
||||
ant.style.left=nx;
|
||||
ant.style.width=nw;
|
||||
}else{
|
||||
ant.style.left=nx+nw;
|
||||
ant.style.width=-1*nw;
|
||||
}
|
||||
if(nh>=0){
|
||||
ant.style.top=ny;
|
||||
ant.style.height=nh;
|
||||
}else{
|
||||
ant.style.top=ny+nh;
|
||||
ant.style.height=-1*nh;
|
||||
}
|
||||
}
|
||||
function max(x,y){
|
||||
if(y>x){
|
||||
return x;
|
||||
}else{
|
||||
return y;
|
||||
}
|
||||
}
|
||||
function drawBoundHandle(){
|
||||
if(ant==null||ant.style==null){
|
||||
return false;
|
||||
}
|
||||
var ah=parseInt(ant.style.height);
|
||||
var aw=parseInt(ant.style.width);
|
||||
var ax=parseInt(ant.style.left);
|
||||
var ay=parseInt(ant.style.top);
|
||||
jg_doc.drawHandle(ax-15,ay-15,30,30,"nw-resize");
|
||||
jg_doc.drawHandle(ax-15,ay+ah-15,30,30,"sw-resize");
|
||||
jg_doc.drawHandle(ax+aw-15,ay-15,30,30,"ne-resize");
|
||||
jg_doc.drawHandle(ax+aw-15,ay+ah-15,30,30,"se-resize");
|
||||
jg_doc.drawHandle(ax+max(15,aw/10),ay-8,aw-2*max(15,aw/10),8,"n-resize");
|
||||
jg_doc.drawHandle(ax+max(15,aw/10),ay+ah,aw-2*max(15,aw/10),8,"s-resize");
|
||||
jg_doc.drawHandle(ax-8,ay+max(15,ah/10),8,ah-2*max(15,ah/10),"w-resize");
|
||||
jg_doc.drawHandle(ax+aw,ay+max(15,ah/10),8,ah-2*max(15,ah/10),"e-resize");
|
||||
jg_doc.drawHandleBox(ax-4,ay-4,8,8,"nw-resize");
|
||||
jg_doc.drawHandleBox(ax-4,ay+ah-4,8,8,"sw-resize");
|
||||
jg_doc.drawHandleBox(ax+aw-4,ay-4,8,8,"ne-resize");
|
||||
jg_doc.drawHandleBox(ax+aw-4,ay+ah-4,8,8,"se-resize");
|
||||
jg_doc.drawHandleBox(ax+aw/2-4,ay-4,8,8,"n-resize");
|
||||
jg_doc.drawHandleBox(ax+aw/2-4,ay+ah-4,8,8,"s-resize");
|
||||
jg_doc.drawHandleBox(ax-4,ay+ah/2-4,8,8,"w-resize");
|
||||
jg_doc.drawHandleBox(ax+aw-4,ay+ah/2-4,8,8,"e-resize");
|
||||
}
|
||||
function showStatus(){
|
||||
if(ant==null||ant.style==null){
|
||||
return false;
|
||||
}
|
||||
if(mode=="measure"){
|
||||
mx1=x-pic_x;
|
||||
my1=y-pic_y;
|
||||
mw=mx2-x;
|
||||
mh=my2-y;
|
||||
md=parseInt(Math.sqrt(mw*mw+mh*mh)*100)/100;
|
||||
ma=(Math.atan(-1*mh/mw)/Math.PI)*180;
|
||||
if(mw<0&&mh<0){
|
||||
ma=ma+180;
|
||||
}
|
||||
if(mw<0&&mh>0){
|
||||
ma=ma-180;
|
||||
}
|
||||
ma=parseInt(ma*100)/100;
|
||||
if(m_sx!=null&&!isNaN(mx1)){
|
||||
m_sx.value=mx1+"px";
|
||||
}
|
||||
if(m_sy!=null&&!isNaN(my1)){
|
||||
m_sy.value=my1+"px";
|
||||
}
|
||||
if(m_w!=null&&!isNaN(mw)){
|
||||
m_w.value=mw+"px";
|
||||
}
|
||||
if(m_h!=null&&!isNaN(mh)){
|
||||
m_h.value=mh+"px";
|
||||
}
|
||||
if(m_d!=null&&!isNaN(md)){
|
||||
m_d.value=md+"px";
|
||||
}
|
||||
if(m_a!=null&&!isNaN(ma)){
|
||||
m_a.value=ma+"";
|
||||
}
|
||||
if(r_ra!=null&&!isNaN(ma)){
|
||||
r_ra.value=ma;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
var ah=parseInt(ant.style.height);
|
||||
var aw=parseInt(ant.style.width);
|
||||
var ax=parseInt(ant.style.left);
|
||||
var ay=parseInt(ant.style.top);
|
||||
var cx=ax-pic_x<0?0:ax-pic_x;
|
||||
var cy=ay-pic_y<0?0:ay-pic_y;
|
||||
cx=cx>pic_width?pic_width:cx;
|
||||
cy=cy>pic_height?pic_height:cy;
|
||||
var cw=ax-pic_x>0?aw:aw-(pic_x-ax);
|
||||
var ch=ay-pic_y>0?ah:ah-(pic_y-ay);
|
||||
ch=ay+ah<pic_y+pic_height?ch:ch-(ay+ah-pic_y-pic_height);
|
||||
cw=ax+aw<pic_x+pic_width?cw:cw-(ax+aw-pic_x-pic_width);
|
||||
ch=ch<0?0:ch;
|
||||
cw=cw<0?0:cw;
|
||||
if(ant.style.visibility=="hidden"){
|
||||
cx="";
|
||||
cy="";
|
||||
cw="";
|
||||
ch="";
|
||||
}
|
||||
if(mode=="crop"){
|
||||
if(t_cx!=null){
|
||||
t_cx.value=cx;
|
||||
}
|
||||
if(t_cy!=null){
|
||||
t_cy.value=cy;
|
||||
}
|
||||
if(t_cw!=null){
|
||||
t_cw.value=cw;
|
||||
}
|
||||
if(t_ch!=null){
|
||||
t_ch.value=ch;
|
||||
}
|
||||
}else{
|
||||
if(mode=="scale"){
|
||||
var sw=aw,sh=ah;
|
||||
if(s_sw.value.indexOf("%")>0&&s_sh.value.indexOf("%")>0){
|
||||
sw=cw/pic_width;
|
||||
sh=ch/pic_height;
|
||||
}
|
||||
if(s_sw!=null){
|
||||
s_sw.value=sw;
|
||||
}
|
||||
if(s_sh!=null){
|
||||
s_sh.value=sh;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
function dragStopped(){
|
||||
dragapproved=false;
|
||||
if(ant==null||ant.style==null){
|
||||
return false;
|
||||
}
|
||||
if(mode=="measure"){
|
||||
jg_doc.drawLine(x-4,y,x+4,y);
|
||||
jg_doc.drawLine(x,y-4,x,y+4);
|
||||
jg_doc.drawLine(mx2-4,my2,mx2+4,my2);
|
||||
jg_doc.drawLine(mx2,my2-4,mx2,my2+4);
|
||||
jg_doc.paint();
|
||||
showStatus();
|
||||
return false;
|
||||
}
|
||||
var ah=parseInt(ant.style.height);
|
||||
var aw=parseInt(ant.style.width);
|
||||
var ax=parseInt(ant.style.left);
|
||||
var ay=parseInt(ant.style.top);
|
||||
jg_doc.clear();
|
||||
if(content!=null){
|
||||
if(content.width!=null&&content.height!=null){
|
||||
content.width=aw-1;
|
||||
content.height=ah-1;
|
||||
}
|
||||
}
|
||||
if(mode=="crop"){
|
||||
jg_doc.fillRectPattern(pic_x,pic_y,pic_width,ay-pic_y,pattern);
|
||||
var h1=ah;
|
||||
var y1=ay;
|
||||
if(ah+ay>=pic_height+pic_y){
|
||||
h1=pic_height+pic_y-ay;
|
||||
}else{
|
||||
if(ay<=pic_y){
|
||||
h1=ay+ah-pic_y;
|
||||
y1=pic_y;
|
||||
}
|
||||
}
|
||||
jg_doc.fillRectPattern(pic_x,y1,ax-pic_x,h1,pattern);
|
||||
jg_doc.fillRectPattern(ax+aw,y1,pic_x+pic_width-ax-aw,h1,pattern);
|
||||
jg_doc.fillRectPattern(pic_x,ay+ah,pic_width,pic_height+pic_y-ay-ah,pattern);
|
||||
}else{
|
||||
if(mode=="scale"){
|
||||
document.theImage.height=ah;
|
||||
document.theImage.width=aw;
|
||||
document.theImage.style.height=ah+" px";
|
||||
document.theImage.style.width=aw+" px";
|
||||
P7_Snap("theImage","ant",0,0);
|
||||
}
|
||||
}
|
||||
drawBoundHandle();
|
||||
jg_doc.paint();
|
||||
showStatus();
|
||||
return false;
|
||||
}
|
||||
document.onmousedown=drags;
|
||||
document.onmouseup=dragStopped;
|
||||
|
||||
@@ -0,0 +1,76 @@
|
||||
.icons {
|
||||
font: 11px Tahoma,Verdana,sans-serif;
|
||||
color: #666699;
|
||||
text-align: center;
|
||||
text-decoration: none;
|
||||
border: 1px solid #EEEEFF;
|
||||
-Moz-Border-Radius: 6px 6px 6px 6px;
|
||||
}
|
||||
|
||||
body, td, p {
|
||||
font: 11px Tahoma,Verdana,sans-serif;
|
||||
}
|
||||
.iconsOver {
|
||||
font: 11px Tahoma,Verdana,sans-serif;
|
||||
color: #666699;
|
||||
text-align: center;
|
||||
text-decoration: none;
|
||||
background-color: #F9F9FF;
|
||||
border: 1px solid #666699;
|
||||
-Moz-Border-Radius: 6px 6px 6px 6px;
|
||||
}
|
||||
.topBar {
|
||||
font: 11px Tahoma,Verdana,sans-serif;
|
||||
color: #666699;
|
||||
}
|
||||
.iconsSel {
|
||||
font: 11px Tahoma,Verdana,sans-serif;
|
||||
color: #666699;
|
||||
text-align: center;
|
||||
text-decoration: none;
|
||||
border: 1px solid #666699;
|
||||
-Moz-Border-Radius: 6px 6px 6px 6px;
|
||||
}
|
||||
.iconText {
|
||||
font: 11px Tahoma,Verdana,sans-serif;
|
||||
color: #666699;
|
||||
text-decoration: none;
|
||||
text-align: center;
|
||||
}
|
||||
.measureStats{
|
||||
width: 50px;
|
||||
}
|
||||
|
||||
#slidercasing {
|
||||
/*border:1px solid #CCCCCC;
|
||||
background-color:#FFFFFF;*/
|
||||
width:100px;
|
||||
height:5px;
|
||||
position:relative;
|
||||
z-index:4;
|
||||
padding:10px;
|
||||
}
|
||||
|
||||
|
||||
#slidertrack {
|
||||
position:relative;
|
||||
border:1px solid #CCCCCC;
|
||||
background-color:#FFFFCC;
|
||||
z-index:5;
|
||||
height:5px;
|
||||
}
|
||||
|
||||
|
||||
#sliderbar {
|
||||
position:absolute;
|
||||
z-index:6;
|
||||
border:1px solid #CCCCCC;
|
||||
background-color:#DDDDDD;
|
||||
width:15px;
|
||||
padding:0px;
|
||||
height:20px;
|
||||
cursor: pointer;
|
||||
top:2px;
|
||||
}
|
||||
|
||||
select, input, button { font: 11px Tahoma,Verdana,sans-serif; }
|
||||
@@ -0,0 +1,83 @@
|
||||
/* This compressed file is part of Xinha. For uncompressed sources, forum, and bug reports, go to xinha.org */
|
||||
/* This file is part of version 0.95 released Mon, 12 May 2008 17:33:15 +0200 */
|
||||
/* The URL of the most recent version of this file is http://svn.xinha.webfactional.com/trunk/plugins/ImageManager/assets/dialog.js */
|
||||
function Dialog(_1,_2,_3){
|
||||
if(typeof _3=="undefined"){
|
||||
_3=window;
|
||||
}
|
||||
if(typeof window.showModalDialog=="function"){
|
||||
Dialog._return=_2;
|
||||
var r=window.showModalDialog(_1,_3,"dialogheight=10;dialogwidth=10;resizable=yes");
|
||||
}else{
|
||||
Dialog._geckoOpenModal(_1,_2,_3);
|
||||
}
|
||||
}
|
||||
Dialog._parentEvent=function(ev){
|
||||
setTimeout(function(){
|
||||
if(Dialog._modal&&!Dialog._modal.closed){
|
||||
Dialog._modal.focus();
|
||||
}
|
||||
},50);
|
||||
if(Dialog._modal&&!Dialog._modal.closed){
|
||||
Dialog._stopEvent(ev);
|
||||
}
|
||||
};
|
||||
Dialog._return=null;
|
||||
Dialog._modal=null;
|
||||
Dialog._arguments=null;
|
||||
Dialog._geckoOpenModal=function(_6,_7,_8){
|
||||
var _9="hadialog"+_6;
|
||||
var _a=/\W/g;
|
||||
_9=_9.replace(_a,"_");
|
||||
var _b=window.open(_6,_9,"toolbar=no,menubar=no,personalbar=no,width=10,height=10,"+"scrollbars=no,resizable=yes,modal=yes,dependable=yes");
|
||||
Dialog._modal=_b;
|
||||
Dialog._arguments=_8;
|
||||
function capwin(w){
|
||||
Dialog._addEvent(w,"click",Dialog._parentEvent);
|
||||
Dialog._addEvent(w,"mousedown",Dialog._parentEvent);
|
||||
Dialog._addEvent(w,"focus",Dialog._parentEvent);
|
||||
}
|
||||
function relwin(w){
|
||||
Dialog._removeEvent(w,"click",Dialog._parentEvent);
|
||||
Dialog._removeEvent(w,"mousedown",Dialog._parentEvent);
|
||||
Dialog._removeEvent(w,"focus",Dialog._parentEvent);
|
||||
}
|
||||
capwin(window);
|
||||
for(var i=0;i<window.frames.length;capwin(window.frames[i++])){
|
||||
}
|
||||
Dialog._return=function(_f){
|
||||
if(_f&&_7){
|
||||
_7(_f);
|
||||
}
|
||||
relwin(window);
|
||||
for(var i=0;i<window.frames.length;relwin(window.frames[i++])){
|
||||
}
|
||||
Dialog._modal=null;
|
||||
};
|
||||
};
|
||||
Dialog._addEvent=function(el,_12,_13){
|
||||
if(Dialog.is_ie){
|
||||
el.attachEvent("on"+_12,_13);
|
||||
}else{
|
||||
el.addEventListener(_12,_13,true);
|
||||
}
|
||||
};
|
||||
Dialog._removeEvent=function(el,_15,_16){
|
||||
if(Dialog.is_ie){
|
||||
el.detachEvent("on"+_15,_16);
|
||||
}else{
|
||||
el.removeEventListener(_15,_16,true);
|
||||
}
|
||||
};
|
||||
Dialog._stopEvent=function(ev){
|
||||
if(Dialog.is_ie){
|
||||
ev.cancelBubble=true;
|
||||
ev.returnValue=false;
|
||||
}else{
|
||||
ev.preventDefault();
|
||||
ev.stopPropagation();
|
||||
}
|
||||
};
|
||||
Dialog.agt=navigator.userAgent.toLowerCase();
|
||||
Dialog.is_ie=((Dialog.agt.indexOf("msie")!=-1)&&(Dialog.agt.indexOf("opera")==-1));
|
||||
|
||||
@@ -0,0 +1,194 @@
|
||||
body
|
||||
{
|
||||
margin: 0; padding: 0;
|
||||
font: 11px Tahoma,Verdana,sans-serif;
|
||||
}
|
||||
select, input, button { font: 11px Tahoma,Verdana,sans-serif; }
|
||||
|
||||
#indicator
|
||||
{
|
||||
width: 25px;
|
||||
height: 20px;
|
||||
background-color: #eef;
|
||||
padding: 15px 20px;
|
||||
position: absolute;
|
||||
left: 0; top: 0;
|
||||
}
|
||||
* html #indicator
|
||||
{
|
||||
padding: 14px 22px;
|
||||
}
|
||||
#tools
|
||||
{
|
||||
width: 600px;
|
||||
height: 50px;
|
||||
background-color: #eef;
|
||||
padding: 0;
|
||||
position: absolute;
|
||||
left: 63px;
|
||||
border-left: 1px solid white;
|
||||
border-bottom: 1px solid white;
|
||||
}
|
||||
#toolbar
|
||||
{
|
||||
width: 53px;
|
||||
height: 435px;
|
||||
background-color: #eef;
|
||||
float: left;
|
||||
text-align: center;
|
||||
padding: 5px;
|
||||
position: absolute;
|
||||
top: 50px;
|
||||
border-top: 1px solid white;
|
||||
border-right: 1px solid white;
|
||||
}
|
||||
|
||||
#contents
|
||||
{
|
||||
width: 600px;
|
||||
height: 445px;
|
||||
position: absolute;
|
||||
left: 64px; top: 51px;
|
||||
}
|
||||
|
||||
#editor
|
||||
{
|
||||
width: 600px;
|
||||
height: 445px;
|
||||
}
|
||||
|
||||
#toolbar a
|
||||
{
|
||||
padding: 5px;
|
||||
width: 40px;
|
||||
display: block;
|
||||
border: 1px solid #eef;
|
||||
text-align: center;
|
||||
text-decoration: none;
|
||||
color: #669;
|
||||
margin: 5px 0;
|
||||
}
|
||||
#toolbar a:hover
|
||||
{
|
||||
background-color: #F9F9FF;
|
||||
border-color: #669;
|
||||
}
|
||||
|
||||
#toolbar a.iconActive
|
||||
{
|
||||
border-color: #669;
|
||||
}
|
||||
|
||||
#toolbar a span
|
||||
{
|
||||
display: block;
|
||||
text-decoration: none;
|
||||
|
||||
}
|
||||
#toolbar a img
|
||||
{
|
||||
border: 0 none;
|
||||
}
|
||||
|
||||
#tools .textInput
|
||||
{
|
||||
width: 3em;
|
||||
vertical-align: 0px;
|
||||
|
||||
}
|
||||
* html #tools .textInput
|
||||
{
|
||||
vertical-align: middle;
|
||||
}
|
||||
#tools .measureStats
|
||||
{
|
||||
width: 4.5em;
|
||||
border: 0 none;
|
||||
background-color: #eef;
|
||||
vertical-align: 0px;
|
||||
}
|
||||
* html #tools .measureStats
|
||||
{
|
||||
vertical-align: middle;
|
||||
}
|
||||
#tools label
|
||||
{
|
||||
margin: 0 2px 0 5px;
|
||||
}
|
||||
#tools input
|
||||
{
|
||||
vertical-align: middle;
|
||||
}
|
||||
#tools #tool_inputs
|
||||
{
|
||||
padding-top: 10px;
|
||||
float: left;
|
||||
}
|
||||
#tools .div
|
||||
{
|
||||
vertical-align: middle;
|
||||
margin: 0 5px;
|
||||
}
|
||||
#tools img
|
||||
{
|
||||
border: 0 none;
|
||||
}
|
||||
#tools a.buttons
|
||||
{
|
||||
margin-top: 10px;
|
||||
border: 1px solid #eef;
|
||||
display: block;
|
||||
float: left;
|
||||
}
|
||||
#tools a.buttons:hover
|
||||
{
|
||||
background-color: #F9F9FF;
|
||||
border-color: #669;
|
||||
}
|
||||
#slidercasing {
|
||||
/*border:1px solid #CCCCCC;
|
||||
background-color:#FFFFFF;*/
|
||||
width:100px;
|
||||
height:5px;
|
||||
position:relative;
|
||||
z-index:4;
|
||||
padding:10px;
|
||||
top: 6px;
|
||||
margin: 0 -5px 0 -10px;
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
#slidertrack {
|
||||
position:relative;
|
||||
border:1px solid #CCCCCC;
|
||||
background-color:#FFFFCC;
|
||||
z-index:5;
|
||||
height:5px;
|
||||
}
|
||||
|
||||
|
||||
#sliderbar {
|
||||
position:absolute;
|
||||
z-index:6;
|
||||
border:1px solid #CCCCCC;
|
||||
background-color:#DDDDDD;
|
||||
width:15px;
|
||||
padding:0px;
|
||||
height:20px;
|
||||
cursor: pointer;
|
||||
top:2px;
|
||||
}
|
||||
|
||||
* html #slidercasing
|
||||
{
|
||||
top:0;
|
||||
}
|
||||
|
||||
|
||||
#bottom
|
||||
{
|
||||
position: relative;
|
||||
top: 490px;
|
||||
}
|
||||
@@ -0,0 +1,130 @@
|
||||
/* This compressed file is part of Xinha. For uncompressed sources, forum, and bug reports, go to xinha.org */
|
||||
/* This file is part of version 0.95 released Mon, 12 May 2008 17:33:15 +0200 */
|
||||
/* The URL of the most recent version of this file is http://svn.xinha.webfactional.com/trunk/plugins/ImageManager/assets/editor.js */
|
||||
var current_action=null;
|
||||
var actions=["crop","scale","rotate","measure","save"];
|
||||
var orginal_width=null,orginal_height=null;
|
||||
function toggle(_1){
|
||||
if(current_action!=_1){
|
||||
for(var i in actions){
|
||||
if(actions[i]!=_1){
|
||||
var _3=document.getElementById("tools_"+actions[i]);
|
||||
_3.style.display="none";
|
||||
var _4=document.getElementById("icon_"+actions[i]);
|
||||
_4.className="";
|
||||
}
|
||||
}
|
||||
current_action=_1;
|
||||
var _3=document.getElementById("tools_"+_1);
|
||||
_3.style.display="block";
|
||||
var _4=document.getElementById("icon_"+_1);
|
||||
_4.className="iconActive";
|
||||
var _5=document.getElementById("indicator_image");
|
||||
_5.src="img/"+_1+".gif";
|
||||
editor.setMode(current_action);
|
||||
if(_1=="scale"){
|
||||
var _6=editor.window.document.getElementById("theImage");
|
||||
orginal_width=_6.width;
|
||||
orginal_height=_6.height;
|
||||
var w=document.getElementById("sw");
|
||||
w.value=orginal_width;
|
||||
var h=document.getElementById("sh");
|
||||
h.value=orginal_height;
|
||||
}
|
||||
}
|
||||
}
|
||||
function toggleMarker(){
|
||||
var _9=document.getElementById("markerImg");
|
||||
if(_9!=null&&_9.src!=null){
|
||||
if(_9.src.indexOf("t_black.gif")>=0){
|
||||
_9.src="img/t_white.gif";
|
||||
}else{
|
||||
_9.src="img/t_black.gif";
|
||||
}
|
||||
editor.toggleMarker();
|
||||
}
|
||||
}
|
||||
function toggleConstraints(){
|
||||
var _a=document.getElementById("scaleConstImg");
|
||||
var _b=document.getElementById("constProp");
|
||||
if(_a!=null&&_a.src!=null){
|
||||
if(_a.src.indexOf("unlocked2.gif")>=0){
|
||||
_a.src="img/islocked2.gif";
|
||||
_b.checked=true;
|
||||
checkConstrains("width");
|
||||
}else{
|
||||
_a.src="img/unlocked2.gif";
|
||||
_b.checked=false;
|
||||
}
|
||||
}
|
||||
}
|
||||
function checkConstrains(_c){
|
||||
var _d=document.getElementById("constProp");
|
||||
if(_d.checked){
|
||||
var w=document.getElementById("sw");
|
||||
var _f=w.value;
|
||||
var h=document.getElementById("sh");
|
||||
var _11=h.value;
|
||||
if(orginal_width>0&&orginal_height>0){
|
||||
if(_c=="width"&&_f>0){
|
||||
h.value=parseInt((_f/orginal_width)*orginal_height);
|
||||
}else{
|
||||
if(_c=="height"&&_11>0){
|
||||
w.value=parseInt((_11/orginal_height)*orginal_width);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
updateMarker("scale");
|
||||
}
|
||||
function updateMarker(_12){
|
||||
if(_12=="crop"){
|
||||
var _13=document.getElementById("cx");
|
||||
var _14=document.getElementById("cy");
|
||||
var _15=document.getElementById("cw");
|
||||
var _16=document.getElementById("ch");
|
||||
editor.setMarker(parseInt(_13.value),parseInt(_14.value),parseInt(_15.value),parseInt(_16.value));
|
||||
}else{
|
||||
if(_12=="scale"){
|
||||
var _17=document.getElementById("sw");
|
||||
var _18=document.getElementById("sh");
|
||||
editor.setMarker(0,0,parseInt(_17.value),parseInt(_18.value));
|
||||
}
|
||||
}
|
||||
}
|
||||
function rotatePreset(_19){
|
||||
var _1a=_19.options[_19.selectedIndex].value;
|
||||
if(_1a.length>0&&parseInt(_1a)!=0){
|
||||
var ra=document.getElementById("ra");
|
||||
ra.value=parseInt(_1a);
|
||||
}
|
||||
}
|
||||
function updateFormat(_1c){
|
||||
var _1d=_1c.options[_1c.selectedIndex].value;
|
||||
var _1e=_1d.split(",");
|
||||
if(_1e.length>1){
|
||||
updateSlider(parseInt(_1e[1]));
|
||||
}
|
||||
}
|
||||
function addEvent(obj,_20,fn){
|
||||
if(obj.addEventListener){
|
||||
obj.addEventListener(_20,fn,true);
|
||||
return true;
|
||||
}else{
|
||||
if(obj.attachEvent){
|
||||
var r=obj.attachEvent("on"+_20,fn);
|
||||
return r;
|
||||
}else{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
init=function(){
|
||||
var _23=document.getElementById("bottom");
|
||||
if(window.opener){
|
||||
__dlg_init(_23);
|
||||
__dlg_translate("ImageManager");
|
||||
}
|
||||
};
|
||||
addEvent(window,"load",init);
|
||||
|
||||
@@ -0,0 +1,8 @@
|
||||
body { margin: 0; padding: 0; background-color: #eee; }
|
||||
table { width: 100%; }
|
||||
table td { text-align: center; }
|
||||
.crop{cursor:crosshair;}
|
||||
.selection { border: dotted 1px #000000; position:absolute; width: 0px; height: 1px; z-index:5; }
|
||||
.selectionWhite{ border: dotted 1px #FFFFFF; position:absolute; width: 0px; height: 1px; z-index:5; }
|
||||
.handleBox{ z-index:105; }
|
||||
.error { font-size:large; font-weight:bold; color:#c00; font-family: Helvetica, sans-serif; }
|
||||
@@ -0,0 +1,76 @@
|
||||
/* This compressed file is part of Xinha. For uncompressed sources, forum, and bug reports, go to xinha.org */
|
||||
/* This file is part of version 0.95 released Mon, 12 May 2008 17:33:15 +0200 */
|
||||
/* The URL of the most recent version of this file is http://svn.xinha.webfactional.com/trunk/plugins/ImageManager/assets/editorFrame.js */
|
||||
var topDoc=window.top.document;
|
||||
var t_cx=topDoc.getElementById("cx");
|
||||
var t_cy=topDoc.getElementById("cy");
|
||||
var t_cw=topDoc.getElementById("cw");
|
||||
var t_ch=topDoc.getElementById("ch");
|
||||
var m_sx=topDoc.getElementById("sx");
|
||||
var m_sy=topDoc.getElementById("sy");
|
||||
var m_w=topDoc.getElementById("mw");
|
||||
var m_h=topDoc.getElementById("mh");
|
||||
var m_a=topDoc.getElementById("ma");
|
||||
var m_d=topDoc.getElementById("md");
|
||||
var s_sw=topDoc.getElementById("sw");
|
||||
var s_sh=topDoc.getElementById("sh");
|
||||
var r_ra=topDoc.getElementById("ra");
|
||||
var pattern="img/2x2.gif";
|
||||
function doSubmit(_1){
|
||||
if(_1=="crop"){
|
||||
var _2=_backend_url+"__function=editorFrame&img="+currentImageFile+"&action=crop¶ms="+parseInt(t_cx.value)+","+parseInt(t_cy.value)+","+parseInt(t_cw.value)+","+parseInt(t_ch.value);
|
||||
location.href=_2;
|
||||
}else{
|
||||
if(_1=="scale"){
|
||||
var _2=_backend_url+"__function=editorFrame&img="+currentImageFile+"&action=scale¶ms="+parseInt(s_sw.value)+","+parseInt(s_sh.value);
|
||||
location.href=_2;
|
||||
}else{
|
||||
if(_1=="rotate"){
|
||||
var _3=topDoc.getElementById("flip");
|
||||
if(_3.value=="hoz"||_3.value=="ver"){
|
||||
location.href=_backend_url+"__function=editorFrame&img="+currentImageFile+"&action=flip¶ms="+_3.value;
|
||||
}else{
|
||||
if(isNaN(parseFloat(r_ra.value))==false){
|
||||
location.href=_backend_url+"__function=editorFrame&img="+currentImageFile+"&action=rotate¶ms="+parseFloat(r_ra.value);
|
||||
}
|
||||
}
|
||||
}else{
|
||||
if(_1=="save"){
|
||||
var _4=topDoc.getElementById("save_filename");
|
||||
var _5=topDoc.getElementById("save_format");
|
||||
var _6=topDoc.getElementById("quality");
|
||||
var _7=_5.value.split(",");
|
||||
if(_4.value.length<=0){
|
||||
alert(i18n("Please enter a filename to save."));
|
||||
}else{
|
||||
var _8=encodeURI(_4.value);
|
||||
var _9=parseInt(_6.value);
|
||||
var _2=_backend_url+"__function=editorFrame&img="+currentImageFile+"&action=save¶ms="+_7[0]+","+_9+"&file="+_8;
|
||||
location.href=_2;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
function addEvent(_a,_b,fn){
|
||||
if(_a.addEventListener){
|
||||
_a.addEventListener(_b,fn,true);
|
||||
return true;
|
||||
}else{
|
||||
if(_a.attachEvent){
|
||||
var r=_a.attachEvent("on"+_b,fn);
|
||||
return r;
|
||||
}else{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
var jg_doc;
|
||||
init=function(){
|
||||
jg_doc=new jsGraphics("imgCanvas");
|
||||
jg_doc.setColor("#000000");
|
||||
initEditor();
|
||||
};
|
||||
addEvent(window,"load",init);
|
||||
|
||||
@@ -0,0 +1,34 @@
|
||||
<attach event="onmouseover" handler="hoverRollOver" />
|
||||
<attach event="onmouseout" handler="hoverRollOff" />
|
||||
<script type="text/javascript">
|
||||
//
|
||||
// Simple behaviour for IE5+ to emulate :hover CSS pseudo-class.
|
||||
// Experimental ver 0.1
|
||||
//
|
||||
// This is an experimental version! Handle with care!
|
||||
// Manual at: http://www.hszk.bme.hu/~hj130/css/list_menu/hover/
|
||||
//
|
||||
|
||||
function hoverRollOver() {
|
||||
|
||||
element.origClassName = element.className; // backup origonal className
|
||||
|
||||
var tempClassStr = element.className;
|
||||
|
||||
tempClassStr += "Hover"; // convert name+'Hover' the last class name to emulate tag.class:hover
|
||||
|
||||
tempClassStr = tempClassStr.replace(/\s/g,"Hover "); //convert name+'Hover' the others to emulate tag.class:hover
|
||||
|
||||
tempClassStr += " hover"; // add simple 'hover' class name to emulate tag:hover
|
||||
|
||||
element.className = element.className + " " + tempClassStr;
|
||||
|
||||
//alert(element.className);
|
||||
//window.status = element.className; // only for TEST
|
||||
}
|
||||
function hoverRollOff() {
|
||||
element.className = element.origClassName;
|
||||
}
|
||||
|
||||
</script>
|
||||
|
||||
@@ -0,0 +1,46 @@
|
||||
body { margin: 0; padding: 0; }
|
||||
.edit { font-size: small; font-family: small-caption, sans-serif; padding-top: 3px;}
|
||||
.edit a { border: none; padding: 3px; text-decoration:none; }
|
||||
.edit a:hover { background-color: ButtonHighlight; }
|
||||
.edit a img { border: none; vertical-align: bottom; }
|
||||
.noResult { font-size:large; font-weight:bold; color:#ccc; font-family: Helvetica, sans-serif; text-align: center; padding-top: 60px; }
|
||||
.error { color:#c00; font-weight:bold; font-size: medium; font-family: Helvetica, sans-serif; text-align: center; padding-top: 65px;}
|
||||
|
||||
.dir_holder, .thumb_holder
|
||||
{
|
||||
width:110px; height:132px;
|
||||
float:left;
|
||||
margin:6px;
|
||||
background-color:ButtonFace;
|
||||
border: 1px outset;
|
||||
}
|
||||
|
||||
.thumb_holder.active
|
||||
{
|
||||
background:Highlight;
|
||||
color:HighlightText;
|
||||
border:1px dashed Highlight;
|
||||
}
|
||||
|
||||
.dir_holder a.dir, .thumb_holder a.thumb
|
||||
{
|
||||
height:100px;
|
||||
display:block;
|
||||
text-align:center;
|
||||
padding:5px;
|
||||
text-decoration:none;
|
||||
}
|
||||
|
||||
.thumb_holder a.thumb img
|
||||
{
|
||||
border:1px solid black;
|
||||
}
|
||||
|
||||
.dir_holder a.dir img
|
||||
{
|
||||
border:none;
|
||||
}
|
||||
.listview { width:100% }
|
||||
.listview td, .listview th { text-align:left; font-size:small; }
|
||||
.listview td.actions { text-align:right; }
|
||||
.listview td.actions img { border:0px; }
|
||||
@@ -0,0 +1,119 @@
|
||||
/* This compressed file is part of Xinha. For uncompressed sources, forum, and bug reports, go to xinha.org */
|
||||
/* This file is part of version 0.95 released Mon, 12 May 2008 17:33:15 +0200 */
|
||||
/* The URL of the most recent version of this file is http://svn.xinha.webfactional.com/trunk/plugins/ImageManager/assets/images.js */
|
||||
function i18n(_1){
|
||||
return Xinha._lc(_1,"ImageManager");
|
||||
}
|
||||
function changeDir(_2){
|
||||
showMessage("Loading");
|
||||
location.href=_backend_url+"__function=images&dir="+encodeURIComponent(_2);
|
||||
}
|
||||
function newFolder(_3,_4){
|
||||
location.href=_backend_url+"__function=images&dir="+encodeURIComponent(_3)+"&newDir="+encodeURIComponent(_4);
|
||||
}
|
||||
function updateDir(_5){
|
||||
var _6=window.top.document.getElementById("dirPath");
|
||||
if(_6){
|
||||
for(var i=0;i<_6.length;i++){
|
||||
var _8=_6.options[i].text;
|
||||
if(_8==_5){
|
||||
_6.selectedIndex=i;
|
||||
showMessage("Loading");
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
function selectImage(_9,_a,_b,_c){
|
||||
var _d=window.top.document;
|
||||
var _e=_d.getElementById("f_url");
|
||||
_e.value=_9;
|
||||
var _e=_d.getElementById("f_width");
|
||||
_e.value=_b;
|
||||
var _e=_d.getElementById("f_width");
|
||||
_e.value=_b;
|
||||
var _e=_d.getElementById("f_height");
|
||||
_e.value=_c;
|
||||
var _e=_d.getElementById("f_alt");
|
||||
_e.value=_a;
|
||||
var _e=_d.getElementById("orginal_width");
|
||||
_e.value=_b;
|
||||
var _e=_d.getElementById("orginal_height");
|
||||
_e.value=_c;
|
||||
_d.getElementById("f_preview").src=window.parent._backend_url+"__function=thumbs&img="+_9;
|
||||
update_selected();
|
||||
}
|
||||
var _current_selected=null;
|
||||
function update_selected(){
|
||||
var _f=window.top.document;
|
||||
if(_current_selected){
|
||||
_current_selected.className=_current_selected.className.replace(/(^| )active( |$)/,"$1$2");
|
||||
_current_selected=null;
|
||||
}
|
||||
var _10=_f.getElementById("f_url").value;
|
||||
var _11=_f.getElementById("dirPath");
|
||||
var _12=_11.options[_11.selectedIndex].text;
|
||||
var dRe=new RegExp("^("+_12.replace(/([\/\^$*+?.()|{}[\]])/g,"\\$1")+")([^/]*)$");
|
||||
if(dRe.test(_10)){
|
||||
var _14=document.getElementById("holder_"+asc2hex(RegExp.$2));
|
||||
if(_14){
|
||||
_current_selected=_14;
|
||||
_14.className+=" active";
|
||||
}
|
||||
}
|
||||
}
|
||||
function asc2hex(str){
|
||||
var _16="";
|
||||
for(var i=0;i<str.length;i++){
|
||||
var hex=(str.charCodeAt(i)).toString(16);
|
||||
if(hex.length==1){
|
||||
hex="0"+hex;
|
||||
}
|
||||
_16+=hex;
|
||||
}
|
||||
return _16;
|
||||
}
|
||||
function showMessage(_19){
|
||||
var _1a=window.top.document;
|
||||
var _1b=_1a.getElementById("message");
|
||||
var _1c=_1a.getElementById("messages");
|
||||
if(_1b&&_1c){
|
||||
if(_1b.firstChild){
|
||||
_1b.removeChild(_1b.firstChild);
|
||||
}
|
||||
_1b.appendChild(_1a.createTextNode(i18n(_19)));
|
||||
_1c.style.display="block";
|
||||
}
|
||||
}
|
||||
function addEvent(obj,_1e,fn){
|
||||
if(obj.addEventListener){
|
||||
obj.addEventListener(_1e,fn,true);
|
||||
return true;
|
||||
}else{
|
||||
if(obj.attachEvent){
|
||||
var r=obj.attachEvent("on"+_1e,fn);
|
||||
return r;
|
||||
}else{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
function confirmDeleteFile(_21){
|
||||
if(confirm(i18n("Delete file?"))){
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
function confirmDeleteDir(dir,_23){
|
||||
if(_23>0){
|
||||
alert(i18n("Please delete all files/folders inside the folder you wish to delete first."));
|
||||
return;
|
||||
}
|
||||
if(confirm(i18n("Delete folder?"))){
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
addEvent(window,"load",init);
|
||||
Xinha=window.parent.Xinha;
|
||||
|
||||
@@ -0,0 +1,46 @@
|
||||
html, body, .dialog { background-color: ButtonFace; color: ButtonText; font: 11px Tahoma,Verdana,sans-serif; margin: 0; padding: 0;}
|
||||
body { padding: 5px; }
|
||||
fieldset { padding: 0;}
|
||||
.title { background-color: #ddf; color: #000; font-weight: bold; font-size: 120%; padding: 3px 10px; margin-bottom: 10px; border-bottom: 1px solid black; letter-spacing: 2px;}
|
||||
form { padding: 0px; margin: 0 auto; width: 550px;}
|
||||
|
||||
a { padding: 5px; border: 1px solid ButtonFace; }
|
||||
a img { border: 0; }
|
||||
a:hover { border-color: ButtonHighlight ButtonShadow ButtonShadow ButtonHighlight; }
|
||||
.dirs { padding: 1em; }
|
||||
.imageFrame { width: 100%; height: 145px; margin: 0 auto; margin-top: 1em; background-color: White;}
|
||||
.smallWidth{ width: 4em; }
|
||||
.largelWidth{ width: 22em; }
|
||||
.inputTable { margin: 1em auto; }
|
||||
select, input, button { font: 11px Tahoma,Verdana,sans-serif; }
|
||||
.buttons { width: 70px; text-align: center; }
|
||||
.clearboth{ clear: both; }
|
||||
#messages { position: relative; left: 175px; top: 115px; background-color: white; width:200px; float: left; margin-top: -52px; border: 1px solid #ccc; text-align: center; padding: 15px; }
|
||||
#message { font-size: 15px; font-weight: bold; color: #69c; }
|
||||
iframe { border:1px inset; border-right:none; border-left:none; border-bottom:none; }
|
||||
|
||||
table { margin-top:10px; }
|
||||
th, td { padding-right:3px; text-align:left; font-family:small-caption,helvetica,sans-serif; }
|
||||
|
||||
.buttonColor {
|
||||
width :1em;
|
||||
margin-left: 2px;
|
||||
cursor: default;
|
||||
}
|
||||
|
||||
.buttonColor .chooser, .buttonColor .nocolor {
|
||||
height: 0.6em;
|
||||
border: 1px solid;
|
||||
padding: 0px 1em;
|
||||
border-color: ButtonHighlight ButtonShadow ButtonShadow ButtonHighlight;
|
||||
}
|
||||
|
||||
.buttonColor .buttonClick {
|
||||
border-color: ButtonShadow ButtonHighlight ButtonHighlight ButtonShadow;
|
||||
}
|
||||
.buttonColor .buttonColor-hilite {
|
||||
border-color: ButtonShadow ButtonHighlight ButtonHighlight ButtonShadow;
|
||||
}
|
||||
|
||||
.buttonColor .nocolor { padding: 0px; }
|
||||
.buttonColor .nocolor-hilite { background-color: #fff; color: #f00; }
|
||||
@@ -0,0 +1,233 @@
|
||||
/* This compressed file is part of Xinha. For uncompressed sources, forum, and bug reports, go to xinha.org */
|
||||
/* This file is part of version 0.95 released Mon, 12 May 2008 17:33:15 +0200 */
|
||||
/* The URL of the most recent version of this file is http://svn.xinha.webfactional.com/trunk/plugins/ImageManager/assets/manager.js */
|
||||
function i18n(_1){
|
||||
return Xinha._lc(_1,"ImageManager");
|
||||
}
|
||||
function setAlign(_2){
|
||||
var _3=document.getElementById("f_align");
|
||||
for(var i=0;i<_3.length;i++){
|
||||
if(_3.options[i].value==_2){
|
||||
_3.selectedIndex=i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
doneinit=0;
|
||||
init=function(){
|
||||
if(doneinit++){
|
||||
return;
|
||||
}
|
||||
__dlg_init(null,{width:600,height:460});
|
||||
__dlg_translate("ImageManager");
|
||||
document.getElementById("f_align").selectedIndex=1;
|
||||
document.getElementById("f_align").selectedIndex=0;
|
||||
var _5=document.getElementById("uploadForm");
|
||||
if(_5){
|
||||
_5.target="imgManager";
|
||||
}
|
||||
var _6=window.dialogArguments;
|
||||
if(_6){
|
||||
var _7=new RegExp("(https?://[^/]*)?"+base_url.replace(/\/$/,""));
|
||||
_6.f_url=_6.f_url.replace(_7,"");
|
||||
var rd=(_resized_dir)?_resized_dir.replace(Xinha.RE_Specials,"\\$1")+"/":"";
|
||||
var rp=_resized_prefix.replace(Xinha.RE_Specials,"\\$1");
|
||||
var _a=new RegExp("^(.*/)"+rd+rp+"_([0-9]+)x([0-9]+)_([^/]+)$");
|
||||
if(_a.test(_6.f_url)){
|
||||
_6.f_url=RegExp.$1+RegExp.$4;
|
||||
_6.f_width=RegExp.$2;
|
||||
_6.f_height=RegExp.$3;
|
||||
}
|
||||
for(var id in _6){
|
||||
if(id=="f_align"){
|
||||
continue;
|
||||
}
|
||||
if(document.getElementById(id)){
|
||||
document.getElementById(id).value=_6[id];
|
||||
}
|
||||
}
|
||||
document.getElementById("orginal_width").value=_6["f_width"];
|
||||
document.getElementById("orginal_height").value=_6["f_height"];
|
||||
setAlign(_6["f_align"]);
|
||||
var _a=new RegExp("^(.*/)([^/]+)$");
|
||||
if(_a.test(_6["f_url"])&&!(new RegExp("^https?://","i")).test(_6["f_url"])){
|
||||
changeDir(RegExp.$1);
|
||||
var _c=document.getElementById("dirPath");
|
||||
for(var i=0;i<_c.options.length;i++){
|
||||
if(_c.options[i].value==encodeURIComponent(RegExp.$1)){
|
||||
_c.options[i].selected=true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
document.getElementById("f_preview").src=_backend_url+"__function=thumbs&img="+_6.f_url;
|
||||
}
|
||||
new Xinha.colorPicker.InputBinding(document.getElementById("f_backgroundColor"));
|
||||
new Xinha.colorPicker.InputBinding(document.getElementById("f_borderColor"));
|
||||
document.getElementById("f_alt").focus();
|
||||
};
|
||||
function onCancel(){
|
||||
__dlg_close(null);
|
||||
return false;
|
||||
}
|
||||
function onOK(){
|
||||
var _e=["f_url","f_alt","f_align","f_width","f_height","f_padding","f_margin","f_border","f_borderColor","f_backgroundColor"];
|
||||
var _f=new Object();
|
||||
for(var i in _e){
|
||||
var id=_e[i];
|
||||
var el=document.getElementById(id);
|
||||
if(id=="f_url"&&el.value.indexOf("://")<0){
|
||||
if(el.value==""){
|
||||
alert(i18n("No Image selected."));
|
||||
return (false);
|
||||
}
|
||||
_f[id]=makeURL(base_url,el.value);
|
||||
}else{
|
||||
if(el){
|
||||
_f[id]=el.value;
|
||||
}else{
|
||||
alert("Missing "+_e[i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
var _13={w:document.getElementById("orginal_width").value,h:document.getElementById("orginal_height").value};
|
||||
if((_13.w!=_f.f_width)||(_13.h!=_f.f_height)){
|
||||
var _14=Xinha._geturlcontent(_backend_url+"&__function=resizer&img="+encodeURIComponent(document.getElementById("f_url").value)+"&width="+_f.f_width+"&height="+_f.f_height);
|
||||
_14=eval(_14);
|
||||
if(_14){
|
||||
_f.f_url=makeURL(base_url,_14);
|
||||
}
|
||||
}
|
||||
__dlg_close(_f);
|
||||
return false;
|
||||
}
|
||||
function makeURL(_15,_16){
|
||||
if(_15.substring(_15.length-1)!="/"){
|
||||
_15+="/";
|
||||
}
|
||||
if(_16.charAt(0)=="/"){
|
||||
}
|
||||
_16=_16.substring(1);
|
||||
return _15+_16;
|
||||
}
|
||||
function updateDir(_17){
|
||||
var _18=_17.options[_17.selectedIndex].value;
|
||||
changeDir(_18);
|
||||
}
|
||||
function goUpDir(){
|
||||
var _19=document.getElementById("dirPath");
|
||||
var _1a=_19.options[_19.selectedIndex].text;
|
||||
if(_1a.length<2){
|
||||
return false;
|
||||
}
|
||||
var _1b=_1a.split("/");
|
||||
var _1c="";
|
||||
for(var i=0;i<_1b.length-2;i++){
|
||||
_1c+=_1b[i]+"/";
|
||||
}
|
||||
for(var i=0;i<_19.length;i++){
|
||||
var _1e=_19.options[i].text;
|
||||
if(_1e==_1c){
|
||||
_19.selectedIndex=i;
|
||||
var _1f=_19.options[i].value;
|
||||
changeDir(_1f);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
function changeDir(_20){
|
||||
if(typeof imgManager!="undefined"){
|
||||
imgManager.changeDir(_20);
|
||||
}
|
||||
}
|
||||
function toggleConstrains(_21){
|
||||
var _22=document.getElementById("imgLock");
|
||||
var _21=document.getElementById("constrain_prop");
|
||||
if(_21.checked){
|
||||
_22.src="img/locked.gif";
|
||||
checkConstrains("width");
|
||||
}else{
|
||||
_22.src="img/unlocked.gif";
|
||||
}
|
||||
}
|
||||
function checkConstrains(_23){
|
||||
var _24=document.getElementById("constrain_prop");
|
||||
if(_24.checked){
|
||||
var obj=document.getElementById("orginal_width");
|
||||
var _26=parseInt(obj.value);
|
||||
var obj=document.getElementById("orginal_height");
|
||||
var _27=parseInt(obj.value);
|
||||
var _28=document.getElementById("f_width");
|
||||
var _29=document.getElementById("f_height");
|
||||
var _2a=parseInt(_28.value);
|
||||
var _2b=parseInt(_29.value);
|
||||
if(_26>0&&_27>0){
|
||||
if(_23=="width"&&_2a>0){
|
||||
_29.value=parseInt((_2a/_26)*_27);
|
||||
}
|
||||
if(_23=="height"&&_2b>0){
|
||||
_28.value=parseInt((_2b/_27)*_26);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
function showMessage(_2c){
|
||||
var _2d=document.getElementById("message");
|
||||
var _2e=document.getElementById("messages");
|
||||
if(_2d.firstChild){
|
||||
_2d.removeChild(_2d.firstChild);
|
||||
}
|
||||
_2d.appendChild(document.createTextNode(i18n(_2c)));
|
||||
_2e.style.display="";
|
||||
}
|
||||
function addEvent(obj,_30,fn){
|
||||
if(obj.addEventListener){
|
||||
obj.addEventListener(_30,fn,true);
|
||||
return true;
|
||||
}else{
|
||||
if(obj.attachEvent){
|
||||
var r=obj.attachEvent("on"+_30,fn);
|
||||
return r;
|
||||
}else{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
function doUpload(){
|
||||
var _33=document.getElementById("uploadForm");
|
||||
if(_33){
|
||||
showMessage("Uploading");
|
||||
}
|
||||
}
|
||||
function refresh(){
|
||||
var _34=document.getElementById("dirPath");
|
||||
updateDir(_34);
|
||||
}
|
||||
function newFolder(){
|
||||
function createFolder(_35){
|
||||
var _36=document.getElementById("dirPath");
|
||||
var dir=_36.options[_36.selectedIndex].value;
|
||||
if(_35==thumbdir){
|
||||
alert(i18n("Invalid folder name, please choose another folder name."));
|
||||
return false;
|
||||
}
|
||||
if(_35&&_35!=""&&typeof imgManager!="undefined"){
|
||||
imgManager.newFolder(dir,encodeURI(_35));
|
||||
}
|
||||
}
|
||||
if(Xinha.ie_version>6){
|
||||
Dialog("newFolder.html",function(_38){
|
||||
if(!_38){
|
||||
return false;
|
||||
}else{
|
||||
var _39=_38["f_foldername"];
|
||||
createFolder(_39);
|
||||
}
|
||||
},null);
|
||||
}else{
|
||||
var _3a=prompt(i18n("Please enter name for new folder..."),i18n("Untitled"));
|
||||
createFolder(_3a);
|
||||
}
|
||||
}
|
||||
addEvent(window,"load",init);
|
||||
|
||||
@@ -0,0 +1,32 @@
|
||||
/* This compressed file is part of Xinha. For uncompressed sources, forum, and bug reports, go to xinha.org */
|
||||
/* This file is part of version 0.95 released Mon, 12 May 2008 17:33:15 +0200 */
|
||||
/* The URL of the most recent version of this file is http://svn.xinha.webfactional.com/trunk/plugins/ImageManager/assets/popup.js */
|
||||
function __dlg_translate(_1){
|
||||
var _2=["span","option","td","th","button","div","label","a","img","legend"];
|
||||
for(var _3=0;_3<_2.length;++_3){
|
||||
var _4=document.getElementsByTagName(_2[_3]);
|
||||
for(var i=_4.length;--i>=0;){
|
||||
var _6=_4[i];
|
||||
if(_6.firstChild&&_6.firstChild.data){
|
||||
var _7=Xinha._lc(_6.firstChild.data,_1);
|
||||
if(_7){
|
||||
_6.firstChild.data=_7;
|
||||
}
|
||||
}
|
||||
if(_6.title){
|
||||
var _7=Xinha._lc(_6.title,_1);
|
||||
if(_7){
|
||||
_6.title=_7;
|
||||
}
|
||||
}
|
||||
if(_6.alt){
|
||||
var _7=Xinha._lc(_6.alt,_1);
|
||||
if(_7){
|
||||
_6.alt=_7;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
document.title=Xinha._lc(document.title,_1);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,87 @@
|
||||
/* This compressed file is part of Xinha. For uncompressed sources, forum, and bug reports, go to xinha.org */
|
||||
/* This file is part of version 0.95 released Mon, 12 May 2008 17:33:15 +0200 */
|
||||
/* The URL of the most recent version of this file is http://svn.xinha.webfactional.com/trunk/plugins/ImageManager/assets/slider.js */
|
||||
var ie=document.all;
|
||||
var ns6=document.getElementById&&!document.all;
|
||||
document.onmouseup=captureStop;
|
||||
var currentSlider=null,sliderField=null;
|
||||
var rangeMin=null,rangeMax=null,sx=-1,sy=-1,initX=0;
|
||||
function getMouseXY(e){
|
||||
x=ns6?e.clientX:event.clientX;
|
||||
y=ns6?e.clientY:event.clientY;
|
||||
if(sx<0){
|
||||
sx=x;
|
||||
}
|
||||
if(sy<0){
|
||||
sy=y;
|
||||
}
|
||||
var dx=initX+(x-sx);
|
||||
if(dx<=rangeMin){
|
||||
dx=rangeMin;
|
||||
}else{
|
||||
if(dx>=rangeMax){
|
||||
dx=rangeMax;
|
||||
}
|
||||
}
|
||||
var _3=(dx-rangeMin)/(rangeMax-rangeMin)*100;
|
||||
if(currentSlider!=null){
|
||||
currentSlider.style.left=dx+"px";
|
||||
}
|
||||
if(sliderField!=null){
|
||||
sliderField.value=parseInt(_3);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
function initSlider(){
|
||||
if(currentSlider==null){
|
||||
currentSlider=document.getElementById("sliderbar");
|
||||
}
|
||||
if(sliderField==null){
|
||||
sliderField=document.getElementById("quality");
|
||||
}
|
||||
if(rangeMin==null){
|
||||
rangeMin=3;
|
||||
}
|
||||
if(rangeMax==null){
|
||||
var _4=document.getElementById("slidertrack");
|
||||
rangeMax=parseInt(_4.style.width);
|
||||
}
|
||||
}
|
||||
function updateSlider(_5){
|
||||
initSlider();
|
||||
var _6=parseInt(_5)/100*(rangeMax-rangeMin);
|
||||
if(_6<=rangeMin){
|
||||
_6=rangeMin;
|
||||
}else{
|
||||
if(_6>=rangeMax){
|
||||
_6=rangeMax;
|
||||
}
|
||||
}
|
||||
if(currentSlider!=null){
|
||||
currentSlider.style.left=_6+"px";
|
||||
}
|
||||
var _7=_6/(rangeMax-rangeMin)*100;
|
||||
if(sliderField!=null){
|
||||
sliderField.value=parseInt(_7);
|
||||
}
|
||||
}
|
||||
function captureStart(){
|
||||
initSlider();
|
||||
initX=parseInt(currentSlider.style.left);
|
||||
if(initX>rangeMax){
|
||||
initX=rangeMax;
|
||||
}else{
|
||||
if(initX<rangeMin){
|
||||
initX=rangeMin;
|
||||
}
|
||||
}
|
||||
document.onmousemove=getMouseXY;
|
||||
return false;
|
||||
}
|
||||
function captureStop(){
|
||||
sx=-1;
|
||||
sy=-1;
|
||||
document.onmousemove=null;
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,505 @@
|
||||
/* This compressed file is part of Xinha. For uncompressed sources, forum, and bug reports, go to xinha.org */
|
||||
/* This file is part of version 0.95 released Mon, 12 May 2008 17:33:15 +0200 */
|
||||
/* The URL of the most recent version of this file is http://svn.xinha.webfactional.com/trunk/plugins/ImageManager/assets/wz_jsgraphics.js */
|
||||
var jg_ihtm,jg_ie,jg_dom,jg_n4=(document.layers&&typeof document.classes!="undefined");
|
||||
function chkDHTM(x,i){
|
||||
x=document.body||null;
|
||||
jg_ie=(x&&typeof x.insertAdjacentHTML!="undefined");
|
||||
jg_dom=(x&&!jg_ie&&typeof x.appendChild!="undefined"&&typeof document.createRange!="undefined"&&typeof (i=document.createRange()).setStartBefore!="undefined"&&typeof i.createContextualFragment!="undefined");
|
||||
jg_ihtm=(!jg_ie&&!jg_dom&&x&&typeof x.innerHTML!="undefined");
|
||||
}
|
||||
function pntDoc(){
|
||||
this.wnd.document.write(this.htm);
|
||||
this.htm="";
|
||||
}
|
||||
function pntCnvDom(){
|
||||
var x=document.createRange();
|
||||
x.setStartBefore(this.cnv);
|
||||
x=x.createContextualFragment(this.htm);
|
||||
this.cnv.appendChild(x);
|
||||
this.htm="";
|
||||
}
|
||||
function pntCnvIe(){
|
||||
this.cnv.insertAdjacentHTML("BeforeEnd",this.htm);
|
||||
this.htm="";
|
||||
}
|
||||
function pntCnvIhtm(){
|
||||
this.cnv.innerHTML+=this.htm;
|
||||
this.htm="";
|
||||
}
|
||||
function pntCnv(){
|
||||
this.htm="";
|
||||
}
|
||||
function mkDiv(x,y,w,h){
|
||||
this.htm+="<div style=\"position:absolute;"+"left:"+x+"px;"+"top:"+y+"px;"+"width:"+w+"px;"+"height:"+h+"px;"+"clip:rect(0,"+w+"px,"+h+"px,0);"+"overflow:hidden;background-color:"+this.color+";"+"\"></div>";
|
||||
}
|
||||
function mkDivPrint(x,y,w,h){
|
||||
this.htm+="<div style=\"position:absolute;"+"border-left:"+w+"px solid "+this.color+";"+"left:"+x+"px;"+"top:"+y+"px;"+"width:"+w+"px;"+"height:"+h+"px;"+"clip:rect(0,"+w+"px,"+h+"px,0);"+"overflow:hidden;background-color:"+this.color+";"+"\"></div>";
|
||||
}
|
||||
function mkLyr(x,y,w,h){
|
||||
this.htm+="<layer "+"left=\""+x+"\" "+"top=\""+y+"\" "+"width=\""+w+"\" "+"height=\""+h+"\" "+"bgcolor=\""+this.color+"\"></layer>\n";
|
||||
}
|
||||
function mkLbl(txt,x,y){
|
||||
this.htm+="<div style=\"position:absolute;white-space:nowrap;"+"left:"+x+"px;"+"top:"+y+"px;"+"font-family:"+this.ftFam+";"+"font-size:"+this.ftSz+";"+"color:"+this.color+";"+this.ftSty+"\">"+txt+"</div>";
|
||||
}
|
||||
function mkLin(x1,y1,x2,y2){
|
||||
if(x1>x2){
|
||||
var _x2=x2;
|
||||
var _y2=y2;
|
||||
x2=x1;
|
||||
y2=y1;
|
||||
x1=_x2;
|
||||
y1=_y2;
|
||||
}
|
||||
var dx=x2-x1,dy=Math.abs(y2-y1),x=x1,y=y1,yIncr=(y1>y2)?-1:1;
|
||||
if(dx>=dy){
|
||||
var pr=dy<<1,pru=pr-(dx<<1),p=pr-dx,ox=x;
|
||||
while((dx--)>0){
|
||||
++x;
|
||||
if(p>0){
|
||||
this.mkDiv(ox,y,x-ox,1);
|
||||
y+=yIncr;
|
||||
p+=pru;
|
||||
ox=x;
|
||||
}else{
|
||||
p+=pr;
|
||||
}
|
||||
}
|
||||
this.mkDiv(ox,y,x2-ox+1,1);
|
||||
}else{
|
||||
var pr=dx<<1,pru=pr-(dy<<1),p=pr-dy,oy=y;
|
||||
if(y2<=y1){
|
||||
while((dy--)>0){
|
||||
if(p>0){
|
||||
this.mkDiv(x++,y,1,oy-y+1);
|
||||
y+=yIncr;
|
||||
p+=pru;
|
||||
oy=y;
|
||||
}else{
|
||||
y+=yIncr;
|
||||
p+=pr;
|
||||
}
|
||||
}
|
||||
this.mkDiv(x2,y2,1,oy-y2+1);
|
||||
}else{
|
||||
while((dy--)>0){
|
||||
y+=yIncr;
|
||||
if(p>0){
|
||||
this.mkDiv(x++,oy,1,y-oy);
|
||||
p+=pru;
|
||||
oy=y;
|
||||
}else{
|
||||
p+=pr;
|
||||
}
|
||||
}
|
||||
this.mkDiv(x2,oy,1,y2-oy+1);
|
||||
}
|
||||
}
|
||||
}
|
||||
function mkLin2D(x1,y1,x2,y2){
|
||||
if(x1>x2){
|
||||
var _x2=x2;
|
||||
var _y2=y2;
|
||||
x2=x1;
|
||||
y2=y1;
|
||||
x1=_x2;
|
||||
y1=_y2;
|
||||
}
|
||||
var dx=x2-x1,dy=Math.abs(y2-y1),x=x1,y=y1,yIncr=(y1>y2)?-1:1;
|
||||
var s=this.stroke;
|
||||
if(dx>=dy){
|
||||
if(s-3>0){
|
||||
var _s=(s*dx*Math.sqrt(1+dy*dy/(dx*dx))-dx-(s>>1)*dy)/dx;
|
||||
_s=(!(s-4)?Math.ceil(_s):Math.round(_s))+1;
|
||||
}else{
|
||||
var _s=s;
|
||||
}
|
||||
var ad=Math.ceil(s/2);
|
||||
var pr=dy<<1,pru=pr-(dx<<1),p=pr-dx,ox=x;
|
||||
while((dx--)>0){
|
||||
++x;
|
||||
if(p>0){
|
||||
this.mkDiv(ox,y,x-ox+ad,_s);
|
||||
y+=yIncr;
|
||||
p+=pru;
|
||||
ox=x;
|
||||
}else{
|
||||
p+=pr;
|
||||
}
|
||||
}
|
||||
this.mkDiv(ox,y,x2-ox+ad+1,_s);
|
||||
}else{
|
||||
if(s-3>0){
|
||||
var _s=(s*dy*Math.sqrt(1+dx*dx/(dy*dy))-(s>>1)*dx-dy)/dy;
|
||||
_s=(!(s-4)?Math.ceil(_s):Math.round(_s))+1;
|
||||
}else{
|
||||
var _s=s;
|
||||
}
|
||||
var ad=Math.round(s/2);
|
||||
var pr=dx<<1,pru=pr-(dy<<1),p=pr-dy,oy=y;
|
||||
if(y2<=y1){
|
||||
++ad;
|
||||
while((dy--)>0){
|
||||
if(p>0){
|
||||
this.mkDiv(x++,y,_s,oy-y+ad);
|
||||
y+=yIncr;
|
||||
p+=pru;
|
||||
oy=y;
|
||||
}else{
|
||||
y+=yIncr;
|
||||
p+=pr;
|
||||
}
|
||||
}
|
||||
this.mkDiv(x2,y2,_s,oy-y2+ad);
|
||||
}else{
|
||||
while((dy--)>0){
|
||||
y+=yIncr;
|
||||
if(p>0){
|
||||
this.mkDiv(x++,oy,_s,y-oy+ad);
|
||||
p+=pru;
|
||||
oy=y;
|
||||
}else{
|
||||
p+=pr;
|
||||
}
|
||||
}
|
||||
this.mkDiv(x2,oy,_s,y2-oy+ad+1);
|
||||
}
|
||||
}
|
||||
}
|
||||
function mkLinDott(x1,y1,x2,y2){
|
||||
if(x1>x2){
|
||||
var _x2=x2;
|
||||
var _y2=y2;
|
||||
x2=x1;
|
||||
y2=y1;
|
||||
x1=_x2;
|
||||
y1=_y2;
|
||||
}
|
||||
var dx=x2-x1,dy=Math.abs(y2-y1),x=x1,y=y1,yIncr=(y1>y2)?-1:1,drw=true;
|
||||
if(dx>=dy){
|
||||
var pr=dy<<1,pru=pr-(dx<<1),p=pr-dx;
|
||||
while((dx--)>0){
|
||||
if(drw){
|
||||
this.mkDiv(x,y,1,1);
|
||||
}
|
||||
drw=!drw;
|
||||
if(p>0){
|
||||
y+=yIncr;
|
||||
p+=pru;
|
||||
}else{
|
||||
p+=pr;
|
||||
}
|
||||
++x;
|
||||
}
|
||||
if(drw){
|
||||
this.mkDiv(x,y,1,1);
|
||||
}
|
||||
}else{
|
||||
var pr=dx<<1,pru=pr-(dy<<1),p=pr-dy;
|
||||
while((dy--)>0){
|
||||
if(drw){
|
||||
this.mkDiv(x,y,1,1);
|
||||
}
|
||||
drw=!drw;
|
||||
y+=yIncr;
|
||||
if(p>0){
|
||||
++x;
|
||||
p+=pru;
|
||||
}else{
|
||||
p+=pr;
|
||||
}
|
||||
}
|
||||
if(drw){
|
||||
this.mkDiv(x,y,1,1);
|
||||
}
|
||||
}
|
||||
}
|
||||
function mkOv(_2e,top,_30,_31){
|
||||
var a=_30>>1,b=_31>>1,wod=_30&1,hod=(_31&1)+1,cx=_2e+a,cy=top+b,x=0,y=b,ox=0,oy=b,aa=(a*a)<<1,bb=(b*b)<<1,st=(aa>>1)*(1-(b<<1))+bb,tt=(bb>>1)-aa*((b<<1)-1),w,h;
|
||||
while(y>0){
|
||||
if(st<0){
|
||||
st+=bb*((x<<1)+3);
|
||||
tt+=(bb<<1)*(++x);
|
||||
}else{
|
||||
if(tt<0){
|
||||
st+=bb*((x<<1)+3)-(aa<<1)*(y-1);
|
||||
tt+=(bb<<1)*(++x)-aa*(((y--)<<1)-3);
|
||||
w=x-ox;
|
||||
h=oy-y;
|
||||
if(w&2&&h&2){
|
||||
this.mkOvQds(cx,cy,-x+2,ox+wod,-oy,oy-1+hod,1,1);
|
||||
this.mkOvQds(cx,cy,-x+1,x-1+wod,-y-1,y+hod,1,1);
|
||||
}else{
|
||||
this.mkOvQds(cx,cy,-x+1,ox+wod,-oy,oy-h+hod,w,h);
|
||||
}
|
||||
ox=x;
|
||||
oy=y;
|
||||
}else{
|
||||
tt-=aa*((y<<1)-3);
|
||||
st-=(aa<<1)*(--y);
|
||||
}
|
||||
}
|
||||
}
|
||||
this.mkDiv(cx-a,cy-oy,a-ox+1,(oy<<1)+hod);
|
||||
this.mkDiv(cx+ox+wod,cy-oy,a-ox+1,(oy<<1)+hod);
|
||||
}
|
||||
function mkOv2D(_33,top,_35,_36){
|
||||
var s=this.stroke;
|
||||
_35+=s-1;
|
||||
_36+=s-1;
|
||||
var a=_35>>1,b=_36>>1,wod=_35&1,hod=(_36&1)+1,cx=_33+a,cy=top+b,x=0,y=b,aa=(a*a)<<1,bb=(b*b)<<1,st=(aa>>1)*(1-(b<<1))+bb,tt=(bb>>1)-aa*((b<<1)-1);
|
||||
if(s-4<0&&(!(s-2)||_35-51>0&&_36-51>0)){
|
||||
var ox=0,oy=b,w,h,pxl,pxr,pxt,pxb,pxw;
|
||||
while(y>0){
|
||||
if(st<0){
|
||||
st+=bb*((x<<1)+3);
|
||||
tt+=(bb<<1)*(++x);
|
||||
}else{
|
||||
if(tt<0){
|
||||
st+=bb*((x<<1)+3)-(aa<<1)*(y-1);
|
||||
tt+=(bb<<1)*(++x)-aa*(((y--)<<1)-3);
|
||||
w=x-ox;
|
||||
h=oy-y;
|
||||
if(w-1){
|
||||
pxw=w+1+(s&1);
|
||||
h=s;
|
||||
}else{
|
||||
if(h-1){
|
||||
pxw=s;
|
||||
h+=1+(s&1);
|
||||
}else{
|
||||
pxw=h=s;
|
||||
}
|
||||
}
|
||||
this.mkOvQds(cx,cy,-x+1,ox-pxw+w+wod,-oy,-h+oy+hod,pxw,h);
|
||||
ox=x;
|
||||
oy=y;
|
||||
}else{
|
||||
tt-=aa*((y<<1)-3);
|
||||
st-=(aa<<1)*(--y);
|
||||
}
|
||||
}
|
||||
}
|
||||
this.mkDiv(cx-a,cy-oy,s,(oy<<1)+hod);
|
||||
this.mkDiv(cx+a+wod-s+1,cy-oy,s,(oy<<1)+hod);
|
||||
}else{
|
||||
var _a=(_35-((s-1)<<1))>>1,_b=(_36-((s-1)<<1))>>1,_x=0,_y=_b,_aa=(_a*_a)<<1,_bb=(_b*_b)<<1,_st=(_aa>>1)*(1-(_b<<1))+_bb,_tt=(_bb>>1)-_aa*((_b<<1)-1),pxl=new Array(),pxt=new Array(),_pxb=new Array();
|
||||
pxl[0]=0;
|
||||
pxt[0]=b;
|
||||
_pxb[0]=_b-1;
|
||||
while(y>0){
|
||||
if(st<0){
|
||||
st+=bb*((x<<1)+3);
|
||||
tt+=(bb<<1)*(++x);
|
||||
pxl[pxl.length]=x;
|
||||
pxt[pxt.length]=y;
|
||||
}else{
|
||||
if(tt<0){
|
||||
st+=bb*((x<<1)+3)-(aa<<1)*(y-1);
|
||||
tt+=(bb<<1)*(++x)-aa*(((y--)<<1)-3);
|
||||
pxl[pxl.length]=x;
|
||||
pxt[pxt.length]=y;
|
||||
}else{
|
||||
tt-=aa*((y<<1)-3);
|
||||
st-=(aa<<1)*(--y);
|
||||
}
|
||||
}
|
||||
if(_y>0){
|
||||
if(_st<0){
|
||||
_st+=_bb*((_x<<1)+3);
|
||||
_tt+=(_bb<<1)*(++_x);
|
||||
_pxb[_pxb.length]=_y-1;
|
||||
}else{
|
||||
if(_tt<0){
|
||||
_st+=_bb*((_x<<1)+3)-(_aa<<1)*(_y-1);
|
||||
_tt+=(_bb<<1)*(++_x)-_aa*(((_y--)<<1)-3);
|
||||
_pxb[_pxb.length]=_y-1;
|
||||
}else{
|
||||
_tt-=_aa*((_y<<1)-3);
|
||||
_st-=(_aa<<1)*(--_y);
|
||||
_pxb[_pxb.length-1]--;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
var ox=0,oy=b,_oy=_pxb[0],l=pxl.length,w,h;
|
||||
for(var i=0;i<l;i++){
|
||||
if(typeof _pxb[i]!="undefined"){
|
||||
if(_pxb[i]<_oy||pxt[i]<oy){
|
||||
x=pxl[i];
|
||||
this.mkOvQds(cx,cy,-x+1,ox+wod,-oy,_oy+hod,x-ox,oy-_oy);
|
||||
ox=x;
|
||||
oy=pxt[i];
|
||||
_oy=_pxb[i];
|
||||
}
|
||||
}else{
|
||||
x=pxl[i];
|
||||
this.mkDiv(cx-x+1,cy-oy,1,(oy<<1)+hod);
|
||||
this.mkDiv(cx+ox+wod,cy-oy,1,(oy<<1)+hod);
|
||||
ox=x;
|
||||
oy=pxt[i];
|
||||
}
|
||||
}
|
||||
this.mkDiv(cx-a,cy-oy,1,(oy<<1)+hod);
|
||||
this.mkDiv(cx+ox+wod,cy-oy,1,(oy<<1)+hod);
|
||||
}
|
||||
}
|
||||
function mkOvDott(_3c,top,_3e,_3f){
|
||||
var a=_3e>>1,b=_3f>>1,wod=_3e&1,hod=_3f&1,cx=_3c+a,cy=top+b,x=0,y=b,aa2=(a*a)<<1,aa4=aa2<<1,bb=(b*b)<<1,st=(aa2>>1)*(1-(b<<1))+bb,tt=(bb>>1)-aa2*((b<<1)-1),drw=true;
|
||||
while(y>0){
|
||||
if(st<0){
|
||||
st+=bb*((x<<1)+3);
|
||||
tt+=(bb<<1)*(++x);
|
||||
}else{
|
||||
if(tt<0){
|
||||
st+=bb*((x<<1)+3)-aa4*(y-1);
|
||||
tt+=(bb<<1)*(++x)-aa2*(((y--)<<1)-3);
|
||||
}else{
|
||||
tt-=aa2*((y<<1)-3);
|
||||
st-=aa4*(--y);
|
||||
}
|
||||
}
|
||||
if(drw){
|
||||
this.mkOvQds(cx,cy,-x,x+wod,-y,y+hod,1,1);
|
||||
}
|
||||
drw=!drw;
|
||||
}
|
||||
}
|
||||
function mkRect(x,y,w,h){
|
||||
var s=this.stroke;
|
||||
this.mkDiv(x,y,w,s);
|
||||
this.mkDiv(x+w,y,s,h);
|
||||
this.mkDiv(x,y+h,w+s,s);
|
||||
this.mkDiv(x,y+s,s,h-s);
|
||||
}
|
||||
function mkRectDott(x,y,w,h){
|
||||
this.drawLine(x,y,x+w,y);
|
||||
this.drawLine(x+w,y,x+w,y+h);
|
||||
this.drawLine(x,y+h,x+w,y+h);
|
||||
this.drawLine(x,y,x,y+h);
|
||||
}
|
||||
function jsgFont(){
|
||||
this.PLAIN="font-weight:normal;";
|
||||
this.BOLD="font-weight:bold;";
|
||||
this.ITALIC="font-style:italic;";
|
||||
this.ITALIC_BOLD=this.ITALIC+this.BOLD;
|
||||
this.BOLD_ITALIC=this.ITALIC_BOLD;
|
||||
}
|
||||
var Font=new jsgFont();
|
||||
function jsgStroke(){
|
||||
this.DOTTED=-1;
|
||||
}
|
||||
var Stroke=new jsgStroke();
|
||||
function jsGraphics(id,wnd){
|
||||
this.setColor=new Function("arg","this.color = arg;");
|
||||
this.getColor=new Function("return this.color");
|
||||
this.setStroke=function(x){
|
||||
this.stroke=x;
|
||||
if(!(x+1)){
|
||||
this.drawLine=mkLinDott;
|
||||
this.mkOv=mkOvDott;
|
||||
this.drawRect=mkRectDott;
|
||||
}else{
|
||||
if(x-1>0){
|
||||
this.drawLine=mkLin2D;
|
||||
this.mkOv=mkOv2D;
|
||||
this.drawRect=mkRect;
|
||||
}else{
|
||||
this.drawLine=mkLin;
|
||||
this.mkOv=mkOv;
|
||||
this.drawRect=mkRect;
|
||||
}
|
||||
}
|
||||
};
|
||||
this.setPrintable=function(arg){
|
||||
this.printable=arg;
|
||||
this.mkDiv=jg_n4?mkLyr:arg?mkDivPrint:mkDiv;
|
||||
};
|
||||
this.setFont=function(fam,sz,sty){
|
||||
this.ftFam=fam;
|
||||
this.ftSz=sz;
|
||||
this.ftSty=sty||Font.PLAIN;
|
||||
};
|
||||
this.drawPolyline=this.drawPolyLine=function(x,y,s){
|
||||
var i=x.length-1;
|
||||
while(i>=0){
|
||||
this.drawLine(x[i],y[i],x[--i],y[i]);
|
||||
}
|
||||
};
|
||||
this.fillRect=function(x,y,w,h){
|
||||
this.mkDiv(x,y,w,h);
|
||||
};
|
||||
this.fillRectPattern=function(x,y,w,h,url){
|
||||
this.htm+="<div style=\"position:absolute;"+"left:"+x+"px;"+"top:"+y+"px;"+"width:"+w+"px;"+"height:"+h+"px;"+"clip:rect(0,"+w+"px,"+h+"px,0);"+"overflow:hidden;"+"background-image: url('"+url+"');"+"layer-background-image: url('"+url+"');"+"z-index:100;\"></div>";
|
||||
};
|
||||
this.drawHandle=function(x,y,w,h,_62){
|
||||
this.htm+="<div style=\"position:absolute;"+"left:"+x+"px;"+"top:"+y+"px;"+"width:"+w+"px;"+"height:"+h+"px;"+"clip:rect(0,"+w+"px,"+h+"px,0);"+"padding: 2px;overflow:hidden;"+"cursor: '"+_62+"';"+"\" class=\"handleBox\" id=\""+_62+"\" ></div>";
|
||||
};
|
||||
this.drawHandleBox=function(x,y,w,h,_67){
|
||||
this.htm+="<div style=\"position:absolute;"+"left:"+x+"px;"+"top:"+y+"px;"+"width:"+w+"px;"+"height:"+h+"px;"+"clip:rect(0,"+(w+2)+"px,"+(h+2)+"px,0);"+"overflow:hidden; border: solid 1px "+this.color+";"+"cursor: '"+_67+"';"+"\" class=\"handleBox\" id=\""+_67+"\" ></div>";
|
||||
};
|
||||
this.drawPolygon=function(x,y){
|
||||
this.drawPolyline(x,y);
|
||||
this.drawLine(x[x.length-1],y[x.length-1],x[0],y[0]);
|
||||
};
|
||||
this.drawEllipse=this.drawOval=function(x,y,w,h){
|
||||
this.mkOv(x,y,w,h);
|
||||
};
|
||||
this.fillEllipse=this.fillOval=function(_6e,top,w,h){
|
||||
var a=(w-=1)>>1,b=(h-=1)>>1,wod=(w&1)+1,hod=(h&1)+1,cx=_6e+a,cy=top+b,x=0,y=b,ox=0,oy=b,aa2=(a*a)<<1,aa4=aa2<<1,bb=(b*b)<<1,st=(aa2>>1)*(1-(b<<1))+bb,tt=(bb>>1)-aa2*((b<<1)-1),pxl,dw,dh;
|
||||
if(w+1){
|
||||
while(y>0){
|
||||
if(st<0){
|
||||
st+=bb*((x<<1)+3);
|
||||
tt+=(bb<<1)*(++x);
|
||||
}else{
|
||||
if(tt<0){
|
||||
st+=bb*((x<<1)+3)-aa4*(y-1);
|
||||
pxl=cx-x;
|
||||
dw=(x<<1)+wod;
|
||||
tt+=(bb<<1)*(++x)-aa2*(((y--)<<1)-3);
|
||||
dh=oy-y;
|
||||
this.mkDiv(pxl,cy-oy,dw,dh);
|
||||
this.mkDiv(pxl,cy+oy-dh+hod,dw,dh);
|
||||
ox=x;
|
||||
oy=y;
|
||||
}else{
|
||||
tt-=aa2*((y<<1)-3);
|
||||
st-=aa4*(--y);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
this.mkDiv(cx-a,cy-oy,w+1,(oy<<1)+hod);
|
||||
};
|
||||
this.drawString=mkLbl;
|
||||
this.clear=function(){
|
||||
this.htm="";
|
||||
if(this.cnv){
|
||||
this.cnv.innerHTML=this.defhtm;
|
||||
}
|
||||
};
|
||||
this.mkOvQds=function(cx,cy,xl,xr,yt,yb,w,h){
|
||||
this.mkDiv(xr+cx,yt+cy,w,h);
|
||||
this.mkDiv(xr+cx,yb+cy,w,h);
|
||||
this.mkDiv(xl+cx,yb+cy,w,h);
|
||||
this.mkDiv(xl+cx,yt+cy,w,h);
|
||||
};
|
||||
this.setStroke(1);
|
||||
this.setPrintable(false);
|
||||
this.setFont("verdana,geneva,helvetica,sans-serif",String.fromCharCode(49,50,112,120),Font.PLAIN);
|
||||
this.color="#000000";
|
||||
this.htm="";
|
||||
this.wnd=wnd||window;
|
||||
if(!(jg_ie||jg_dom||jg_ihtm)){
|
||||
chkDHTM();
|
||||
}
|
||||
if(typeof id!="string"||!id){
|
||||
this.paint=pntDoc;
|
||||
}else{
|
||||
this.cnv=document.all?(this.wnd.document.all[id]||null):document.getElementById?(this.wnd.document.getElementById(id)||null):null;
|
||||
this.defhtm=(this.cnv&&this.cnv.innerHTML)?this.cnv.innerHTML:"";
|
||||
this.paint=jg_dom?pntCnvDom:jg_ie?pntCnvIe:jg_ihtm?pntCnvIhtm:pntCnv;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,155 @@
|
||||
<?php
|
||||
/**
|
||||
* Unified backend for ImageManager
|
||||
*
|
||||
* Image Manager was originally developed by:
|
||||
* Xiang Wei Zhuo, email: xiangweizhuo(at)hotmail.com Wei Shou.
|
||||
*
|
||||
* Unified backend sponsored by DTLink Software, http://www.dtlink.com
|
||||
* Implementation by Yermo Lamers, http://www.formvista.com
|
||||
*
|
||||
* (c) DTLink, LLC 2005.
|
||||
* Distributed under the same terms as HTMLArea itself.
|
||||
* This notice MUST stay intact for use (see license.txt).
|
||||
*
|
||||
* DESCRIPTION:
|
||||
*
|
||||
* Instead of using separate URL's for each function, ImageManager now
|
||||
* routes all requests to the server through this single, replaceable,
|
||||
* entry point. backend.php expects at least two URL variable parameters:
|
||||
*
|
||||
* __plugin=ImageManager for future expansion; identify the plugin being requested.
|
||||
* __function=thumbs|images|editorFrame|editor|manager function being called.
|
||||
*
|
||||
* Having a single entry point that strictly adheres to a defined interface will
|
||||
* make the backend code much easier to maintain and expand. It will make it easier
|
||||
* on integrators, not to mention it'll make it easier to have separate
|
||||
* implementations of the backend in different languages (Perl, Python, ASP, etc.)
|
||||
*
|
||||
* @see config.inc.php
|
||||
*/
|
||||
|
||||
// Strip slashes if MQGPC is on
|
||||
set_magic_quotes_runtime(0);
|
||||
if(get_magic_quotes_gpc())
|
||||
{
|
||||
$to_clean = array(&$_GET, &$_POST, &$_REQUEST, &$_COOKIE);
|
||||
while(count($to_clean))
|
||||
{
|
||||
$cleaning =& $to_clean[array_pop($junk = array_keys($to_clean))];
|
||||
unset($to_clean[array_pop($junk = array_keys($to_clean))]);
|
||||
foreach(array_keys($cleaning) as $k)
|
||||
{
|
||||
if(is_array($cleaning[$k]))
|
||||
{
|
||||
$to_clean[] =& $cleaning[$k];
|
||||
}
|
||||
else
|
||||
{
|
||||
$cleaning[$k] = stripslashes($cleaning[$k]);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* ImageManager configuration
|
||||
*/
|
||||
|
||||
require_once('config.inc.php');
|
||||
|
||||
/**
|
||||
* debug message library
|
||||
*/
|
||||
|
||||
include_once( "ddt.php" );
|
||||
|
||||
// uncomment to turn on debugging
|
||||
// _ddtOn();
|
||||
|
||||
_ddt( __FILE__, __LINE__, "backend.php: top with query '" . $_SERVER["PHP_SELF"] . "' string '" . $_SERVER["QUERY_STRING"] . "'" );
|
||||
|
||||
$formVars = empty($_POST) ? $_GET : $_POST;
|
||||
|
||||
// make sure the request is for us (this gives us the ability to eventually organize
|
||||
// a backend event handler system) For an include file the return doesn't make alot of
|
||||
// sense but eventually we'll want to turn all of this into at least functions
|
||||
// separating out all the presentation HTML from the logic. (Right now all the HTML
|
||||
// used by ImageManager is in the same files as the PHP code ...)
|
||||
|
||||
if ( @$formVars[ "__plugin" ] != "ImageManager" )
|
||||
{
|
||||
// not for us.
|
||||
|
||||
_ddt( __FILE__, __LINE__, "request was not for us" );
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
// so we don't have to re-engineer the entire thing right now, since it's probably
|
||||
// going to get rewritten anyway, we just include the correct file based on the
|
||||
// function request.
|
||||
|
||||
_ddt( __FILE__, __LINE__, "backend.php(): handling function '" . $formVars[ "__function" ] . "' base_dir is '" . $IMConfig["base_dir"] . "'" );
|
||||
|
||||
switch ( @$formVars[ "__function" ] )
|
||||
{
|
||||
|
||||
case "editor":
|
||||
|
||||
include_once( $IMConfig['base_dir'] . "/editor.php" );
|
||||
exit();
|
||||
|
||||
break;
|
||||
|
||||
case "editorFrame":
|
||||
|
||||
include_once( $IMConfig['base_dir'] . "/editorFrame.php" );
|
||||
exit();
|
||||
|
||||
break;
|
||||
|
||||
case "manager":
|
||||
|
||||
_ddt( __FILE__, __LINE__, "including '" . $IMConfig['base_dir'] . "/manager.php" );
|
||||
|
||||
include_once( $IMConfig['base_dir'] . "/manager.php" );
|
||||
exit();
|
||||
|
||||
break;
|
||||
|
||||
case "images":
|
||||
|
||||
include_once( $IMConfig['base_dir'] . "/images.php" );
|
||||
exit();
|
||||
|
||||
break;
|
||||
|
||||
case "thumbs":
|
||||
|
||||
include_once( $IMConfig['base_dir'] . "/thumbs.php" );
|
||||
exit();
|
||||
|
||||
break;
|
||||
|
||||
case "resizer":
|
||||
|
||||
include_once( $IMConfig['base_dir'] . "/resizer.php" );
|
||||
exit();
|
||||
|
||||
break;
|
||||
|
||||
default:
|
||||
|
||||
_ddt( __FILE__, __LINE__, "function request not supported" );
|
||||
_error( __FILE__, __LINE__, "function request not supported" );
|
||||
|
||||
break;
|
||||
|
||||
} // end of switch.
|
||||
|
||||
return false ;
|
||||
|
||||
// END
|
||||
|
||||
?>
|
||||
@@ -0,0 +1,346 @@
|
||||
<?php
|
||||
/**
|
||||
* Image Manager configuration file.
|
||||
* @author $Author:gogo $
|
||||
* @version $Id:config.inc.php 830 2007-05-09 13:27:34Z gogo $
|
||||
* @package ImageManager
|
||||
*
|
||||
* @todo change all these config values to defines()
|
||||
*/
|
||||
|
||||
// REVISION HISTORY:
|
||||
//
|
||||
// 2005-03-20 Yermo Lamers (www.formvista.com):
|
||||
// . unified backend.
|
||||
// . created a set of defaults that make sense for bundling with Xinha.
|
||||
|
||||
// -------------------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* Default backend URL
|
||||
*
|
||||
* URL to use for unified backend.
|
||||
*
|
||||
* The ?__plugin=ImageManager& is required.
|
||||
*/
|
||||
|
||||
$IMConfig['backend_url'] = "backend.php?__plugin=ImageManager&";
|
||||
|
||||
/**
|
||||
* Backend Installation Directory
|
||||
*
|
||||
* location of backend install; these are used to link to css and js
|
||||
* assets because we may have the front end installed in a different
|
||||
* directory than the backend. (i.e. nothing assumes that the frontend
|
||||
* and the backend are in the same directory)
|
||||
*/
|
||||
|
||||
$IMConfig['base_dir'] = getcwd();
|
||||
$IMConfig['base_url'] = '';
|
||||
|
||||
// ------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* Path to directory containing images.
|
||||
*
|
||||
* File system path to the directory you want to manage the images
|
||||
* for multiple user systems, set it dynamically.
|
||||
*
|
||||
* NOTE: This directory requires write access by PHP. That is,
|
||||
* PHP must be able to create files in this directory.
|
||||
* Able to create directories is nice, but not necessary.
|
||||
*
|
||||
* CHANGE THIS: for out-of-the-box demo purposes we're setting this to ./demo_images
|
||||
* which has some graphics in it.
|
||||
*/
|
||||
|
||||
// $IMConfig['images_dir'] = "/some/path/to/images/directory;
|
||||
|
||||
$IMConfig['images_dir'] = "demo_images";
|
||||
|
||||
// -------------------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* URL of directory containing images.
|
||||
*
|
||||
* The URL to the above path, the web browser needs to be able to see it.
|
||||
* It can be protected via .htaccess on apache or directory permissions on IIS,
|
||||
* check you web server documentation for futher information on directory protection
|
||||
* If this directory needs to be publicly accessiable, remove scripting capabilities
|
||||
* for this directory (i.e. disable PHP, Perl, CGI). We only want to store assets
|
||||
* in this directory and its subdirectories.
|
||||
*
|
||||
* CHANGE THIS: You need to change this to match the url where you have Xinha
|
||||
* installed. If the images show up blank chances are this is not set correctly.
|
||||
*/
|
||||
|
||||
// $IMConfig['images_url'] = "/url/to/above";
|
||||
|
||||
// try to figure out the URL of the sample images directory. For your installation
|
||||
// you will probably want to keep images in another directory.
|
||||
|
||||
$IMConfig['images_url'] = str_replace( "backend.php", "", $_SERVER["PHP_SELF"] ) . "demo_images";
|
||||
|
||||
// -------------------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* PHP Safe Mode?
|
||||
*
|
||||
* Possible values: true, false
|
||||
*
|
||||
* TRUE - If PHP on the web server is in safe mode, set this to true.
|
||||
* SAFE MODE restrictions: directory creation will not be possible,
|
||||
* only the GD library can be used, other libraries require
|
||||
* Safe Mode to be off.
|
||||
*
|
||||
* FALSE - Set to false if PHP on the web server is not in safe mode.
|
||||
*/
|
||||
|
||||
$IMConfig['safe_mode'] = false;
|
||||
|
||||
// -------------------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* Image Library to use.
|
||||
*
|
||||
* Possible values: 'GD', 'IM', or 'NetPBM'
|
||||
*
|
||||
* The image manipulation library to use, either GD or ImageMagick or NetPBM.
|
||||
* If you have safe mode ON, or don't have the binaries to other packages,
|
||||
* your choice is 'GD' only. Other packages require Safe Mode to be off.
|
||||
*
|
||||
* DEFAULT: GD is probably the most likely to be available.
|
||||
*/
|
||||
|
||||
$IMConfig['IMAGE_CLASS'] = 'GD';
|
||||
|
||||
|
||||
// -------------------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* NetPBM or IM binary path.
|
||||
*
|
||||
* After defining which library to use, if it is NetPBM or IM, you need to
|
||||
* specify where the binary for the selected library are. And of course
|
||||
* your server and PHP must be able to execute them (i.e. safe mode is OFF).
|
||||
* GD does not require the following definition.
|
||||
*/
|
||||
|
||||
$IMConfig['IMAGE_TRANSFORM_LIB_PATH'] ='/usr/bin/';
|
||||
|
||||
// For windows, something like
|
||||
// C:/"Program Files"/ImageMagick-5.5.7-Q16/
|
||||
|
||||
// -------------------------------------------------------------------------
|
||||
// OPTIONAL SETTINGS
|
||||
// -------------------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* Thumbnail prefix
|
||||
*
|
||||
* The prefix for thumbnail files, something like .thumb will do. The
|
||||
* thumbnails files will be named as "prefix_imagefile.ext", that is,
|
||||
* prefix + orginal filename.
|
||||
*/
|
||||
|
||||
$IMConfig['thumbnail_prefix'] = '.';
|
||||
|
||||
// -------------------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* Thumbnail Directory
|
||||
*
|
||||
* Thumbnail can also be stored in a directory, this directory
|
||||
* will be created by PHP. If PHP is in safe mode, this parameter
|
||||
* is ignored, you can not create directories.
|
||||
*
|
||||
* If you do not want to store thumbnails in a directory, set this
|
||||
* to false or empty string '';
|
||||
*/
|
||||
|
||||
$IMConfig['thumbnail_dir'] = '.thumbs';
|
||||
|
||||
// -------------------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* Resized prefix
|
||||
*
|
||||
* The prefix for resized files, something like .resized will do. The
|
||||
* resized files will be named <prefix>_<width>x<height>_<original>
|
||||
* resized files are created when one changes the dimensions of an image
|
||||
* in the image manager selection dialog - the image is scaled when the
|
||||
* user clicks the ok button.
|
||||
*/
|
||||
|
||||
$IMConfig['resized_prefix'] = '.resized';
|
||||
|
||||
// -------------------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* Resized Directory
|
||||
*
|
||||
* Resized images may also be stored in a directory, except in safe mode.
|
||||
*/
|
||||
|
||||
$IMConfig['resized_dir'] = '.resized';
|
||||
|
||||
/**
|
||||
* Full options
|
||||
*
|
||||
* Determines whether the user is given options for padding,
|
||||
* background/padding colour, margin, border and border colour.
|
||||
*/
|
||||
|
||||
$IMConfig['show_full_options'] = true;
|
||||
|
||||
// -------------------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* Allow New Directories
|
||||
*
|
||||
*
|
||||
* Possible values: true, false
|
||||
*
|
||||
* TRUE - Allow the user to create new sub-directories in the
|
||||
* $IMConfig['base_dir'].
|
||||
*
|
||||
* FALSE - No directory creation.
|
||||
*
|
||||
* NOTE: If $IMConfig['safe_mode'] = true, this parameter
|
||||
* is ignored, you can not create directories
|
||||
*
|
||||
* DEFAULT: for demo purposes we turn this off.
|
||||
*/
|
||||
|
||||
$IMConfig['allow_new_dir'] = true;
|
||||
|
||||
// -------------------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* Allow Uploads
|
||||
*
|
||||
* Possible values: true, false
|
||||
*
|
||||
* TRUE - Allow the user to upload files.
|
||||
*
|
||||
* FALSE - No uploading allowed.
|
||||
*
|
||||
* DEFAULT: for demo purposes we turn this off.
|
||||
*/
|
||||
|
||||
$IMConfig['allow_upload'] = true;
|
||||
|
||||
// -------------------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* Validate Images
|
||||
*
|
||||
* Possible values: true, false
|
||||
*
|
||||
* TRUE - If set to true, uploaded files will be validated based on the
|
||||
* function getImageSize, if we can get the image dimensions then
|
||||
* I guess this should be a valid image. Otherwise the file will be rejected.
|
||||
*
|
||||
* FALSE - All uploaded files will be processed.
|
||||
*
|
||||
* NOTE: If uploading is not allowed, this parameter is ignored.
|
||||
*/
|
||||
|
||||
$IMConfig['validate_images'] = true;
|
||||
|
||||
// -------------------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* Default Thumnail.
|
||||
*
|
||||
* The default thumbnail if the thumbnails can not be created, either
|
||||
* due to error or bad image file.
|
||||
*/
|
||||
|
||||
$IMConfig['default_thumbnail'] = 'img/default.gif';
|
||||
|
||||
// -------------------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* Thumbnail dimensions.
|
||||
*/
|
||||
|
||||
$IMConfig['thumbnail_width'] = 96;
|
||||
$IMConfig['thumbnail_height'] = 96;
|
||||
|
||||
// -------------------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* Editor Temporary File Prefix.
|
||||
*
|
||||
* Image Editor temporary filename prefix.
|
||||
*/
|
||||
|
||||
$IMConfig['tmp_prefix'] = '.editor_';
|
||||
|
||||
|
||||
$IMConfig['ViewMode'] = 'thumbs';
|
||||
|
||||
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// ================== END OF CONFIGURATION ======================= //
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
// Standard PHP Backend Data Passing
|
||||
// if data was passed using xinha_pass_to_php_backend() we merge the items
|
||||
// provided into the Config
|
||||
require_once(realpath(dirname(__FILE__) . '/../../contrib/php-xinha.php'));
|
||||
if($passed_data = xinha_read_passed_data())
|
||||
{
|
||||
$IMConfig = array_merge($IMConfig, $passed_data);
|
||||
$IMConfig['backend_url'] .= xinha_passed_data_querystring() . '&';
|
||||
}
|
||||
// Deprecated config passing, don't use this way any more!
|
||||
elseif(isset($_REQUEST['backend_config']))
|
||||
{
|
||||
if(get_magic_quotes_gpc()) {
|
||||
$_REQUEST['backend_config'] = stripslashes($_REQUEST['backend_config']);
|
||||
}
|
||||
|
||||
// Config specified from front end, check that it's valid
|
||||
session_start();
|
||||
$secret = $_SESSION[$_REQUEST['backend_config_secret_key_location']];
|
||||
|
||||
if($_REQUEST['backend_config_hash'] !== sha1($_REQUEST['backend_config'] . $secret))
|
||||
{
|
||||
die("Backend security error.");
|
||||
}
|
||||
|
||||
$to_merge = unserialize($_REQUEST['backend_config']);
|
||||
if(!is_array($to_merge))
|
||||
{
|
||||
die("Backend config syntax error.");
|
||||
}
|
||||
|
||||
$IMConfig = array_merge($IMConfig, $to_merge);
|
||||
$IMConfig['backend_url'] .= "backend_config=" . rawurlencode($_REQUEST['backend_config']) . '&';
|
||||
$IMConfig['backend_url'] .= "backend_config_hash=" . rawurlencode($_REQUEST['backend_config_hash']) . '&';
|
||||
$IMConfig['backend_url'] .= "backend_config_secret_key_location=" . rawurlencode($_REQUEST['backend_config_secret_key_location']) . '&';
|
||||
|
||||
}
|
||||
|
||||
define('IMAGE_CLASS', $IMConfig['IMAGE_CLASS']);
|
||||
define('IMAGE_TRANSFORM_LIB_PATH', $IMConfig['IMAGE_TRANSFORM_LIB_PATH']);
|
||||
define( "IM_CONFIG_LOADED", "yes" );
|
||||
|
||||
// bring in the debugging library
|
||||
|
||||
include_once( "ddt.php" );
|
||||
|
||||
// uncomment to send debug messages to a local file
|
||||
// _setDebugLog( "/tmp/debug_log.txt" );
|
||||
|
||||
// turn debugging on everywhere.
|
||||
// _ddtOn();
|
||||
|
||||
// END
|
||||
|
||||
?>
|
||||
@@ -0,0 +1,288 @@
|
||||
<?php
|
||||
/*
|
||||
This ddt library is released under the terms of the HTMLArea license.
|
||||
See license.txt that is shipped with Xinha.
|
||||
*/
|
||||
|
||||
// must be included after the configuration has been loaded.
|
||||
|
||||
if ( ! defined( "IM_CONFIG_LOADED" ) )
|
||||
die( "sorry" );
|
||||
|
||||
/**
|
||||
* Debug and Error Message functions.
|
||||
*
|
||||
* These functions implement a procedural version of the formVista DDT debug
|
||||
* message system.
|
||||
*
|
||||
* @package formVista
|
||||
* @subpackage lib
|
||||
* @copyright DTLink, LLC 2005
|
||||
* @author Yermo Lamers
|
||||
* @see http://www.formvista.com/contact.html
|
||||
*/
|
||||
|
||||
// REVISION HISTORY:
|
||||
//
|
||||
// 26 Jan 2001 YmL:
|
||||
// . initial revision
|
||||
//
|
||||
// 2002-06-19 YmL:
|
||||
// . added logging debug and error messages to a file.
|
||||
//
|
||||
// 2004-02-06 YmL:
|
||||
// . added a newline to generated messages.
|
||||
//
|
||||
// 2005-01-09 YmL:
|
||||
// . now checks global $fvDEBUG[ "logfile" ] setting for
|
||||
// logfile to output to.
|
||||
// . dumping to file has not been combined into a dumpmsg
|
||||
// method.
|
||||
//
|
||||
// 2005-02-25 YmL:
|
||||
// . added _error() support for cmdLine programs.
|
||||
//
|
||||
// 2005-03-20 YmL:
|
||||
// . changed license for this file to HTMLArea from RPL.
|
||||
// . quick hack to repurpose for Xinha.
|
||||
//
|
||||
// -------------------------------------------------------
|
||||
|
||||
/**
|
||||
* dumps message to stdout or log file depending upon global.
|
||||
*
|
||||
* checks $fvDEBUG["logfile"] global for name of file to dump
|
||||
* messages to. Opens the file once.
|
||||
*/
|
||||
|
||||
function dumpmsg( $msgline )
|
||||
{
|
||||
|
||||
global $fvDEBUG;
|
||||
|
||||
if ( @$fvDEBUG[ "logfile" ] != NULL )
|
||||
{
|
||||
|
||||
// only open the file once and store the handle in the global
|
||||
// fvDEBUG array .. for now.
|
||||
|
||||
if ( @$fvDEBUG[ "logfile_fp" ] == NULL )
|
||||
{
|
||||
|
||||
// we clear out the debug file on each run.
|
||||
|
||||
if (( $fvDEBUG[ "logfile_fp" ] = fopen( $fvDEBUG[ "logfile" ], "a" )) == NULL )
|
||||
{
|
||||
die( "ddt(): unable to open debug log" );
|
||||
return false ;
|
||||
}
|
||||
}
|
||||
|
||||
fputs( $fvDEBUG[ "logfile_fp" ], "$msgline" );
|
||||
fflush( $fvDEBUG[ "logfile_fp" ] );
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
echo $msgline;
|
||||
}
|
||||
|
||||
} // end of dumpmsg.
|
||||
|
||||
/**
|
||||
* displays a formatted debugging message.
|
||||
*
|
||||
* If ddtOn() was called, outputs a formatted debugging message.
|
||||
*
|
||||
* @param string $file filename, usually __FILE__
|
||||
* @param string $line line number in file, usually __LINE__
|
||||
* @param string $msg debugging message to display
|
||||
*/
|
||||
|
||||
function _ddt( $file, $line, $msg )
|
||||
{
|
||||
|
||||
global $_DDT;
|
||||
global $_DDT_DEBUG_LOG;
|
||||
global $_DDT_CMDLINE;
|
||||
|
||||
$basename = basename( $file );
|
||||
|
||||
if ( @$_DDT == "yes" )
|
||||
{
|
||||
|
||||
if ( @$_DDT_CMDLINE == "yes" )
|
||||
{
|
||||
dumpmsg( basename( $file ) . ":$line: $msg \n" );
|
||||
flush();
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
dumpmsg( "<p>$basename:$line: $msg</p>\n" );
|
||||
}
|
||||
}
|
||||
|
||||
} // end of _ddt
|
||||
|
||||
/**
|
||||
* displays a formatted dump of an associative array.
|
||||
*
|
||||
* If ddtOn() was called, outputs a formatted debugging message showing
|
||||
* contents of array.
|
||||
*
|
||||
* @param string $file filename, usually __FILE__
|
||||
* @param string $line line number in file, usually __LINE__
|
||||
* @param string $msg debugging message to display
|
||||
* @param array $array_var array to dump.
|
||||
*/
|
||||
|
||||
function _ddtArray( $file, $line, $msg, $array_var )
|
||||
{
|
||||
|
||||
global $_DDT;
|
||||
|
||||
if ( $_DDT == "yes" )
|
||||
{
|
||||
|
||||
dumpmsg( "<h2>$file:$line: $msg</h2>" );
|
||||
|
||||
foreach ( $array_var as $name => $value )
|
||||
{
|
||||
dumpmsg( "<p><b>$name</b> => <b>$value</b>\n" );
|
||||
}
|
||||
}
|
||||
|
||||
} // end of _ddtArray
|
||||
|
||||
// -----------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* Central Error Function.
|
||||
*
|
||||
* Displays a formatted error message to the user.
|
||||
* If the global _DDT_ERROR_LOG is set the error message is dumped
|
||||
* to that file instead of being displayed to the user.
|
||||
*/
|
||||
|
||||
function _error( $file, $line, $msg )
|
||||
{
|
||||
|
||||
global $_DDT_ERROR_LOG;
|
||||
global $_DDT_CMDLINE;
|
||||
|
||||
if ( @$_DDT_ERROR_LOG == NULL )
|
||||
{
|
||||
|
||||
if ( @$_DDT_CMDLINE == "yes" )
|
||||
{
|
||||
echo basename($file) . ":$line: $msg\n";
|
||||
}
|
||||
else
|
||||
{
|
||||
echo "<h2>$file:$line: $msg</h2>";
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
if (( $fp = fopen( $_DDT_ERROR_LOG, "a" )) != NULL )
|
||||
{
|
||||
fputs( $fp, date("D M j G:i:s T Y") . " - $file:$line: $msg\n" );
|
||||
fclose( $fp );
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
} // end of _error
|
||||
|
||||
// ----------------------------------------------------------------------
|
||||
|
||||
function errorEcho( $title, $field )
|
||||
{
|
||||
|
||||
global $error_msg;
|
||||
|
||||
if ( $error_msg[ $field ] != "" )
|
||||
{
|
||||
|
||||
echo "<FONT SIZE=\"+2\" COLOR=\"RED\">$title</FONT>";
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
echo $title;
|
||||
|
||||
}
|
||||
|
||||
} // end of errorEcho
|
||||
|
||||
/**
|
||||
* turns on procedural debugging.
|
||||
*
|
||||
* Causes _ddt() calls to display debugging messages.
|
||||
*/
|
||||
|
||||
function _ddtOn()
|
||||
{
|
||||
|
||||
global $_DDT;
|
||||
|
||||
$_DDT = "yes";
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* set error message destination.
|
||||
*
|
||||
* sets the destination for error messages.
|
||||
*
|
||||
* @param string $file full path to errorlog.
|
||||
*/
|
||||
|
||||
function _setErrorLog( $errorLog )
|
||||
{
|
||||
|
||||
global $_DDT_ERROR_LOG;
|
||||
|
||||
$_DDT_ERROR_LOG = $errorLog;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* set output file for debugging messages.
|
||||
*
|
||||
* sets the destination file for debugging messages.
|
||||
*
|
||||
* @param string $file full path to debuglog.
|
||||
*/
|
||||
|
||||
function _setDebugLog( $debugLog )
|
||||
{
|
||||
|
||||
global $fvDEBUG;
|
||||
|
||||
$fvDEBUG[ "logfile" ] = $debugLog;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* set debugging output style to command line.
|
||||
*
|
||||
* tells ddt to format debugging messages for a
|
||||
* command line program.
|
||||
*/
|
||||
|
||||
function _ddtSetCmdLine()
|
||||
{
|
||||
|
||||
global $_DDT_CMDLINE;
|
||||
|
||||
$_DDT_CMDLINE = "yes";
|
||||
|
||||
}
|
||||
|
||||
// END
|
||||
|
||||
?>
|
||||
|
After Width: | Height: | Size: 27 KiB |
|
After Width: | Height: | Size: 12 KiB |
|
After Width: | Height: | Size: 8.3 KiB |
@@ -0,0 +1,149 @@
|
||||
<?php
|
||||
/**
|
||||
* The PHP Image Editor user interface.
|
||||
* @author $Author:ray $
|
||||
* @version $Id:editor.php 987 2008-04-12 12:39:04Z ray $
|
||||
* @package ImageManager
|
||||
*/
|
||||
|
||||
require_once('config.inc.php');
|
||||
require_once('Classes/ImageManager.php');
|
||||
require_once('Classes/ImageEditor.php');
|
||||
|
||||
$manager = new ImageManager($IMConfig);
|
||||
$editor = new ImageEditor($manager);
|
||||
|
||||
?>
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||
|
||||
<html>
|
||||
<head>
|
||||
<title></title>
|
||||
<script type="text/javascript">
|
||||
_backend_url = "<?php print $IMConfig['backend_url']; ?>";
|
||||
</script>
|
||||
<link href="<?php print $IMConfig['base_url'];?>assets/editor.css" rel="stylesheet" type="text/css" />
|
||||
<script type="text/javascript" src="<?php print $IMConfig['base_url'];?>assets/slider.js"></script>
|
||||
<script type="text/javascript" src="../../popups/popup.js"></script>
|
||||
<script type="text/javascript" src="<?php print $IMConfig['base_url'];?>assets/popup.js"></script>
|
||||
<script type="text/javascript">
|
||||
/*<![CDATA[*/
|
||||
window.resizeTo(673, 531);
|
||||
|
||||
if(window.opener)
|
||||
HTMLArea = window.opener.HTMLArea;
|
||||
/*]]>*/
|
||||
</script>
|
||||
<script type="text/javascript" src="<?php print $IMConfig['base_url'];?>assets/editor.js"></script>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<div id="indicator">
|
||||
<img src="<?php print $IMConfig['base_url'];?>img/spacer.gif" id="indicator_image" height="20" width="20" alt="" />
|
||||
</div>
|
||||
<div id="tools">
|
||||
<div id="tools_crop" style="display:none;">
|
||||
<div id="tool_inputs">
|
||||
<label for="cx">Start X:</label><input type="text" id="cx" class="textInput" onchange="updateMarker('crop')"/>
|
||||
<label for="cy">Start Y:</label><input type="text" id="cy" class="textInput" onchange="updateMarker('crop')"/>
|
||||
<label for="cw">Width:</label><input type="text" id="cw" class="textInput" onchange="updateMarker('crop')"/>
|
||||
<label for="ch">Height:</label><input type="text" id="ch" class="textInput" onchange="updateMarker('crop')"/>
|
||||
<img src="<?php print $IMConfig['base_url'];?>img/div.gif" height="30" width="2" class="div" alt="|" />
|
||||
</div>
|
||||
<a href="javascript: editor.doSubmit('crop');" class="buttons" title="OK"><img src="<?php print $IMConfig['base_url'];?>img/btn_ok.gif" height="30" width="30" alt="OK" /></a>
|
||||
<a href="javascript: editor.reset();" class="buttons" title="Cancel"><img src="<?php print $IMConfig['base_url'];?>img/btn_cancel.gif" height="30" width="30" alt="Cancel" /></a>
|
||||
</div>
|
||||
<div id="tools_scale" style="display:none;">
|
||||
<div id="tool_inputs">
|
||||
<label for="sw">Width:</label><input type="text" id="sw" class="textInput" onchange="checkConstrains('width')"/>
|
||||
<a href="javascript:toggleConstraints();" title="Lock"><img src="<?php print $IMConfig['base_url'];?>img/islocked2.gif" id="scaleConstImg" height="14" width="8" alt="Lock" class="div" /></a><label for="sh">Height:</label>
|
||||
<input type="text" id="sh" class="textInput" onchange="checkConstrains('height')"/>
|
||||
<input type="checkbox" id="constProp" value="1" checked="checked" onclick="toggleConstraints()"/>
|
||||
<label for="constProp">Constrain Proportions</label>
|
||||
<img src="<?php print $IMConfig['base_url'];?>img/div.gif" height="30" width="2" class="div" alt="|" />
|
||||
</div>
|
||||
<a href="javascript: editor.doSubmit('scale');" class="buttons" title="OK"><img src="<?php print $IMConfig['base_url'];?>img/btn_ok.gif" height="30" width="30" alt="OK" /></a>
|
||||
<a href="javascript: editor.reset();" class="buttons" title="Cancel"><img src="<?php print $IMConfig['base_url'];?>img/btn_cancel.gif" height="30" width="30" alt="Cancel" /></a>
|
||||
</div>
|
||||
<div id="tools_rotate" style="display:none;">
|
||||
<div id="tool_inputs">
|
||||
<select id="flip" name="flip" style="margin-left: 10px; vertical-align: middle;">
|
||||
<option selected="selected">Flip Image</option>
|
||||
<option>-----------------</option>
|
||||
<option value="hoz">Flip Horizontal</option>
|
||||
<option value="ver">Flip Vertical</option>
|
||||
</select>
|
||||
<select name="rotate" onchange="rotatePreset(this)" style="margin-left: 20px; vertical-align: middle;">
|
||||
<option selected="selected">Rotate Image</option>
|
||||
<option>-----------------</option>
|
||||
|
||||
<option value="180">Rotate 180 °</option>
|
||||
<option value="90">Rotate 90 ° CW</option>
|
||||
<option value="-90">Rotate 90 ° CCW</option>
|
||||
</select>
|
||||
<label for="ra">Angle:</label><input type="text" id="ra" class="textInput" />
|
||||
<img src="<?php print $IMConfig['base_url'];?>img/div.gif" height="30" width="2" class="div" alt="|" />
|
||||
</div>
|
||||
<a href="javascript: editor.doSubmit('rotate');" class="buttons" title="OK"><img src="<?php print $IMConfig['base_url'];?>img/btn_ok.gif" height="30" width="30" alt="OK" /></a>
|
||||
<a href="javascript: editor.reset();" class="buttons" title="Cancel"><img src="<?php print $IMConfig['base_url'];?>img/btn_cancel.gif" height="30" width="30" alt="Cancel" /></a>
|
||||
</div>
|
||||
<div id="tools_measure" style="display:none;">
|
||||
<div id="tool_inputs">
|
||||
<label>X:</label><input type="text" class="measureStats" id="sx" />
|
||||
<label>Y:</label><input type="text" class="measureStats" id="sy" />
|
||||
<img src="<?php print $IMConfig['base_url'];?>img/div.gif" height="30" width="2" class="div" alt="|" />
|
||||
<label>W:</label><input type="text" class="measureStats" id="mw" />
|
||||
<label>H:</label><input type="text" class="measureStats" id="mh" />
|
||||
<img src="<?php print $IMConfig['base_url'];?>img/div.gif" height="30" width="2" class="div" alt="|" />
|
||||
<label>A:</label><input type="text" class="measureStats" id="ma" />
|
||||
<label>D:</label><input type="text" class="measureStats" id="md" />
|
||||
<img src="<?php print $IMConfig['base_url'];?>img/div.gif" height="30" width="2" class="div" alt="|" />
|
||||
<button type="button" onclick="editor.reset();" >Clear</button>
|
||||
</div>
|
||||
</div>
|
||||
<div id="tools_save" style="display:none;">
|
||||
<div id="tool_inputs">
|
||||
<label for="save_filename">Filename:</label><input type="text" id="save_filename" value="<?php echo $editor->getDefaultSaveFile();?>"/>
|
||||
<select name="format" id="save_format" style="margin-left: 10px; vertical-align: middle;" onchange="updateFormat(this)">
|
||||
<option value="" selected="selected">Image Format</option>
|
||||
<option value="">---------------------</option>
|
||||
<option value="jpeg,85">JPEG High</option>
|
||||
<option value="jpeg,60">JPEG Medium</option>
|
||||
<option value="jpeg,35">JPEG Low</option>
|
||||
<option value="png">PNG</option>
|
||||
<?php if($editor->isGDGIFAble() != -1) { ?>
|
||||
<option value="gif">GIF</option>
|
||||
<?php } ?>
|
||||
</select>
|
||||
<label>Quality:</label>
|
||||
<table style="display: inline; vertical-align: middle;" cellpadding="0" cellspacing="0">
|
||||
<tr>
|
||||
<td>
|
||||
<div id="slidercasing">
|
||||
<div id="slidertrack" style="width:100px"><img src="<?php print $IMConfig['base_url'];?>img/spacer.gif" width="1" height="1" border="0" alt="track" /></div>
|
||||
<div id="sliderbar" style="left:85px" onmousedown="captureStart();"><img src="<?php print $IMConfig['base_url'];?>img/spacer.gif" width="1" height="1" border="0" alt="track" /></div>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
<input type="text" id="quality" onchange="updateSlider(this.value)" style="width: 2em;" value="85"/>
|
||||
<img src="<?php print $IMConfig['base_url'];?>img/div.gif" height="30" width="2" class="div" alt="|" />
|
||||
</div>
|
||||
<a href="javascript: editor.doSubmit('save');" class="buttons" title="OK"><img src="<?php print $IMConfig['base_url'];?>img/btn_ok.gif" height="30" width="30" alt="OK" /></a>
|
||||
<a href="javascript: editor.reset();" class="buttons" title="Cancel"><img src="<?php print $IMConfig['base_url'];?>img/btn_cancel.gif" height="30" width="30" alt="Cancel" /></a>
|
||||
</div>
|
||||
</div>
|
||||
<div id="toolbar">
|
||||
<a href="javascript:toggle('crop')" id="icon_crop" title="Crop"><img src="<?php print $IMConfig['base_url'];?>img/crop.gif" height="20" width="20" alt="Crop" /><span>Crop</span></a>
|
||||
<a href="javascript:toggle('scale')" id="icon_scale" title="Resize"><img src="<?php print $IMConfig['base_url'];?>img/scale.gif" height="20" width="20" alt="Resize" /><span>Resize</span></a>
|
||||
<a href="javascript:toggle('rotate')" id="icon_rotate" title="Rotate"><img src="<?php print $IMConfig['base_url'];?>img/rotate.gif" height="20" width="20" alt="Rotate" /><span>Rotate</span></a>
|
||||
<a href="javascript:toggle('measure')" id="icon_measure" title="Measure"><img src="<?php print $IMConfig['base_url'];?>img/measure.gif" height="20" width="20" alt="Measure" /><span>Measure</span></a>
|
||||
<a href="javascript: toggleMarker();" title="Marker"><img id="markerImg" src="<?php print $IMConfig['base_url'];?>img/t_black.gif" height="20" width="20" alt="Marker" /><span>Marker</span></a>
|
||||
<a href="javascript:toggle('save')" id="icon_save" title="Save"><img src="<?php print $IMConfig['base_url'];?>img/save.gif" height="20" width="20" alt="Save" /><span>Save</span></a>
|
||||
</div>
|
||||
<div id="contents">
|
||||
<iframe src="<?php print $IMConfig['backend_url']; ?>__function=editorFrame&img=<?php if(isset($_GET['img'])) echo rawurlencode($_GET['img']); ?>" name="editor" id="editor" scrolling="auto" title="Image Editor" frameborder="0"></iframe>
|
||||
</div>
|
||||
<div id="bottom"></div>
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,79 @@
|
||||
<?php
|
||||
/**
|
||||
* The frame that contains the image to be edited.
|
||||
* @author $Author:ray $
|
||||
* @version $Id:editorFrame.php 677 2007-01-19 22:24:36Z ray $
|
||||
* @package ImageManager
|
||||
*/
|
||||
|
||||
require_once('config.inc.php');
|
||||
require_once('Classes/ImageManager.php');
|
||||
require_once('Classes/ImageEditor.php');
|
||||
|
||||
$manager = new ImageManager($IMConfig);
|
||||
$editor = new ImageEditor($manager);
|
||||
$imageInfo = $editor->processImage();
|
||||
|
||||
?>
|
||||
|
||||
<html>
|
||||
<head>
|
||||
<title></title>
|
||||
<script type="text/javascript">
|
||||
_backend_url = "<?php print $IMConfig['backend_url']; ?>";
|
||||
</script>
|
||||
|
||||
<link href="<?php print $IMConfig['base_url'];?>assets/editorFrame.css" rel="stylesheet" type="text/css" />
|
||||
<script type="text/javascript" src="<?php print $IMConfig['base_url'];?>assets/wz_jsgraphics.js"></script>
|
||||
<script type="text/javascript" src="<?php print $IMConfig['base_url'];?>assets/EditorContent.js"></script>
|
||||
<script type="text/javascript">
|
||||
|
||||
if(window.top)
|
||||
HTMLArea = window.top.HTMLArea;
|
||||
|
||||
function i18n(str) {
|
||||
return HTMLArea._lc(str, 'ImageManager');
|
||||
}
|
||||
|
||||
var mode = "<?php echo $editor->getAction(); ?>" //crop, scale, measure
|
||||
|
||||
var currentImageFile = "<?php if(count($imageInfo)>0) echo rawurlencode($imageInfo['file']); ?>";
|
||||
|
||||
<?php if ($editor->isFileSaved() == 1) { ?>
|
||||
alert(i18n('File saved.'));
|
||||
window.parent.opener.selectImage
|
||||
(
|
||||
'<?php echo $imageInfo['savedFile'] ?>',
|
||||
'<?php echo $imageInfo['savedFile'] ?>'.replace(/^.*\/?([^\/]*)$/, '$1'),
|
||||
<?php echo $imageInfo['width'] ?>,
|
||||
<?php echo $imageInfo['height'] ?>
|
||||
);
|
||||
window.parent.opener.parent.refresh();
|
||||
window.parent.close();
|
||||
<?php } else if ($editor->isFileSaved() == -1) { ?>
|
||||
alert(i18n('File was not saved.'));
|
||||
<?php } ?>
|
||||
|
||||
</script>
|
||||
<script type="text/javascript" src="<?php print $IMConfig['base_url'];?>assets/editorFrame.js"></script>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<div id="status"></div>
|
||||
<div id="ant" class="selection" style="visibility:hidden"><img src="<?php print $IMConfig['base_url'];?>img/spacer.gif" width="0" height="0" border="0" alt="" id="cropContent"></div>
|
||||
<?php if ($editor->isGDEditable() == -1) { ?>
|
||||
<div style="text-align:center; padding:10px;"><span class="error">GIF format is not supported, image editing not supported.</span></div>
|
||||
<?php } ?>
|
||||
<table height="100%" width="100%">
|
||||
<tr>
|
||||
<td>
|
||||
<?php if(count($imageInfo) > 0 && is_file($imageInfo['fullpath'])) { ?>
|
||||
<span id="imgCanvas" class="crop"><img src="<?php echo $imageInfo['src']; ?>" <?php echo $imageInfo['dimensions']; ?> alt="" id="theImage" name="theImage"></span>
|
||||
<?php } else { ?>
|
||||
<span class="error">No Image Available</span>
|
||||
<?php } ?>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,149 @@
|
||||
/* This compressed file is part of Xinha. For uncompressed sources, forum, and bug reports, go to xinha.org */
|
||||
/* This file is part of version 0.95 released Mon, 12 May 2008 17:33:15 +0200 */
|
||||
/* The URL of the most recent version of this file is http://svn.xinha.webfactional.com/trunk/plugins/ImageManager/image-manager.js */
|
||||
function ImageManager(_1){
|
||||
}
|
||||
ImageManager._pluginInfo={name:"ImageManager",version:"1.0",developer:"Xiang Wei Zhuo",developer_url:"http://www.zhuo.org/htmlarea/",license:"htmlArea"};
|
||||
Xinha.Config.prototype.ImageManager={"backend":Xinha.getPluginDir("ImageManager")+"/backend.php?__plugin=ImageManager&","backend_data":null,"backend_config":null,"backend_config_hash":null,"backend_config_secret_key_location":"Xinha:ImageManager"};
|
||||
Xinha.prototype._insertImage=function(_2){
|
||||
var _3=this;
|
||||
var _4=null;
|
||||
if(typeof _2=="undefined"){
|
||||
_2=this.getParentElement();
|
||||
if(_2&&!/^img$/i.test(_2.tagName)){
|
||||
_2=null;
|
||||
}
|
||||
}
|
||||
if(_2){
|
||||
_4={f_url:Xinha.is_ie?_2.src:_2.src,f_alt:_2.alt,f_border:_2.style.borderWidth?_2.style.borderWidth:_2.border,f_align:_2.align,f_padding:_2.style.padding,f_margin:_2.style.margin,f_width:_2.width,f_height:_2.height,f_backgroundColor:_2.style.backgroundColor,f_borderColor:_2.style.borderColor};
|
||||
function shortSize(_5){
|
||||
if(/ /.test(_5)){
|
||||
var _6=_5.split(" ");
|
||||
var _7=true;
|
||||
for(var i=1;i<_6.length;i++){
|
||||
if(_6[0]!=_6[i]){
|
||||
_7=false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if(_7){
|
||||
_5=_6[0];
|
||||
}
|
||||
}
|
||||
return _5;
|
||||
}
|
||||
_4.f_border=shortSize(_4.f_border);
|
||||
_4.f_padding=shortSize(_4.f_padding);
|
||||
_4.f_margin=shortSize(_4.f_margin);
|
||||
function convertToHex(_9){
|
||||
if(typeof _9=="string"&&/, /.test.color){
|
||||
_9=_9.replace(/, /,",");
|
||||
}
|
||||
if(typeof _9=="string"&&/ /.test.color){
|
||||
var _a=_9.split(" ");
|
||||
var _b="";
|
||||
for(var i=0;i<_a.length;i++){
|
||||
_b+=Xinha._colorToRgb(_a[i]);
|
||||
if(i+1<_a.length){
|
||||
_b+=" ";
|
||||
}
|
||||
}
|
||||
return _b;
|
||||
}
|
||||
return Xinha._colorToRgb(_9);
|
||||
}
|
||||
_4.f_backgroundColor=convertToHex(_4.f_backgroundColor);
|
||||
_4.f_borderColor=convertToHex(_4.f_borderColor);
|
||||
}
|
||||
var _d=_3.config.ImageManager.backend+"__function=manager";
|
||||
if(_3.config.ImageManager.backend_config!=null){
|
||||
_d+="&backend_config="+encodeURIComponent(_3.config.ImageManager.backend_config);
|
||||
_d+="&backend_config_hash="+encodeURIComponent(_3.config.ImageManager.backend_config_hash);
|
||||
_d+="&backend_config_secret_key_location="+encodeURIComponent(_3.config.ImageManager.backend_config_secret_key_location);
|
||||
}
|
||||
if(_3.config.ImageManager.backend_data!=null){
|
||||
for(var i in _3.config.ImageManager.backend_data){
|
||||
_d+="&"+i+"="+encodeURIComponent(_3.config.ImageManager.backend_data[i]);
|
||||
}
|
||||
}
|
||||
Dialog(_d,function(_f){
|
||||
if(!_f){
|
||||
return false;
|
||||
}
|
||||
var img=_2;
|
||||
if(!img){
|
||||
if(Xinha.is_ie){
|
||||
var sel=_3._getSelection();
|
||||
var _12=_3._createRange(sel);
|
||||
_3._doc.execCommand("insertimage",false,_f.f_url);
|
||||
img=_12.parentElement();
|
||||
if(img.tagName.toLowerCase()!="img"){
|
||||
img=img.previousSibling;
|
||||
}
|
||||
}else{
|
||||
img=document.createElement("img");
|
||||
img.src=_f.f_url;
|
||||
_3.insertNodeAtSelection(img);
|
||||
}
|
||||
}else{
|
||||
img.src=_f.f_url;
|
||||
}
|
||||
for(field in _f){
|
||||
var _13=_f[field];
|
||||
switch(field){
|
||||
case "f_alt":
|
||||
img.alt=_13;
|
||||
break;
|
||||
case "f_border":
|
||||
if(_13.length){
|
||||
img.style.borderWidth=/[^0-9]/.test(_13)?_13:(parseInt(_13)+"px");
|
||||
if(img.style.borderWidth&&!img.style.borderStyle){
|
||||
img.style.borderStyle="solid";
|
||||
}
|
||||
}else{
|
||||
img.style.borderWidth="";
|
||||
img.style.borderStyle="";
|
||||
}
|
||||
break;
|
||||
case "f_borderColor":
|
||||
img.style.borderColor=_13;
|
||||
break;
|
||||
case "f_backgroundColor":
|
||||
img.style.backgroundColor=_13;
|
||||
break;
|
||||
case "f_padding":
|
||||
if(_13.length){
|
||||
img.style.padding=/[^0-9]/.test(_13)?_13:(parseInt(_13)+"px");
|
||||
}else{
|
||||
img.style.padding="";
|
||||
}
|
||||
break;
|
||||
case "f_margin":
|
||||
if(_13.length){
|
||||
img.style.margin=/[^0-9]/.test(_13)?_13:(parseInt(_13)+"px");
|
||||
}else{
|
||||
img.style.margin="";
|
||||
}
|
||||
break;
|
||||
case "f_align":
|
||||
img.align=_13;
|
||||
break;
|
||||
case "f_width":
|
||||
if(!isNaN(parseInt(_13))){
|
||||
img.width=parseInt(_13);
|
||||
}else{
|
||||
img.width="";
|
||||
}
|
||||
break;
|
||||
case "f_height":
|
||||
if(!isNaN(parseInt(_13))){
|
||||
img.height=parseInt(_13);
|
||||
}else{
|
||||
img.height="";
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
},_4);
|
||||
};
|
||||
|
||||
@@ -0,0 +1,66 @@
|
||||
/* This compressed file is part of Xinha. For uncompressed sources, forum, and bug reports, go to xinha.org */
|
||||
/* This file is part of version 0.95 released Mon, 12 May 2008 17:33:15 +0200 */
|
||||
/* The URL of the most recent version of this file is http://svn.xinha.webfactional.com/trunk/plugins/ImageManager/image-picker.js */
|
||||
function ImagePicker(_1){
|
||||
this.field=_1;
|
||||
var _2=this;
|
||||
var _3=document.createElement("input");
|
||||
_3.type="button";
|
||||
_3.value="Browse";
|
||||
_3.onclick=function(){
|
||||
_2.popup_picker();
|
||||
};
|
||||
_1.parentNode.insertBefore(_3,_1.nextSibling);
|
||||
_1.size="20";
|
||||
_1.style.textAlign="right";
|
||||
}
|
||||
ImagePicker.prototype.backend=_editor_url+"plugins/ImageManager/backend.php?__plugin=ImageManager&";
|
||||
ImagePicker.prototype.backend_data=null;
|
||||
ImagePicker.prototype.popup_picker=function(){
|
||||
var _4=this;
|
||||
var _5=null;
|
||||
if(_4.field.value){
|
||||
_5={f_url:_4.field.value,f_width:null,f_height:null,f_alt:_4.field.value,f_border:null,f_align:null,f_padding:null,f_margin:null,f_backgroundColor:null,f_borderColor:null,f_border:null,f_padding:null,f_margin:null};
|
||||
}
|
||||
var _6=this.backend+"__function=manager";
|
||||
if(this.backend_config!=null){
|
||||
_6+="&backend_config="+encodeURIComponent(this.backend_config);
|
||||
_6+="&backend_config_hash="+encodeURIComponent(this.backend_config_hash);
|
||||
_6+="&backend_config_secret_key_location="+encodeURIComponent(this.backend_config_secret_key_location);
|
||||
}
|
||||
if(this.backend_data!=null){
|
||||
for(var i in this.backend_data){
|
||||
_6+="&"+i+"="+encodeURIComponent(this.backend_data[i]);
|
||||
}
|
||||
}
|
||||
Dialog(_6,function(_8){
|
||||
if(!_8){
|
||||
return false;
|
||||
}
|
||||
_4.field.value=_8.f_url;
|
||||
},_5);
|
||||
};
|
||||
if(typeof Dialog=="undefined"){
|
||||
function Dialog(_9,_a,_b){
|
||||
if(typeof _b=="undefined"){
|
||||
_b=window;
|
||||
}
|
||||
var _c=window.open(_9,"hadialog","toolbar=no,menubar=no,personalbar=no,width=10,height=10,"+"scrollbars=yes,resizable=yes,modal=yes,dependable=yes");
|
||||
Dialog._modal=_c;
|
||||
Dialog._arguments=_b;
|
||||
Dialog._return=function(_d){
|
||||
if(_d&&_a){
|
||||
_a(_d);
|
||||
}
|
||||
Dialog._modal=null;
|
||||
};
|
||||
Dialog._modal.focus();
|
||||
}
|
||||
Dialog._return=null;
|
||||
Dialog._modal=null;
|
||||
Dialog._arguments=null;
|
||||
}
|
||||
ImagePicker.prototype.backend_config=null;
|
||||
ImagePicker.prototype.backend_config_hash=null;
|
||||
ImagePicker.prototype.backend_config_secret_key_location="Xinha:ImageManager";
|
||||
|
||||
@@ -0,0 +1,290 @@
|
||||
<?php
|
||||
/**
|
||||
* Show a list of images in a long horizontal table.
|
||||
* @author $Author:ray $
|
||||
* @version $Id:images.php 987 2008-04-12 12:39:04Z ray $
|
||||
* @package ImageManager
|
||||
*/
|
||||
|
||||
require_once('config.inc.php');
|
||||
require_once('ddt.php');
|
||||
require_once('Classes/ImageManager.php');
|
||||
|
||||
// uncomment for debugging
|
||||
|
||||
// _ddtOn();
|
||||
|
||||
//default path is /
|
||||
$relative = '/';
|
||||
$manager = new ImageManager($IMConfig);
|
||||
|
||||
//process any file uploads
|
||||
$manager->processUploads();
|
||||
|
||||
$manager->deleteFiles();
|
||||
|
||||
$refreshDir = false;
|
||||
//process any directory functions
|
||||
if($manager->deleteDirs() || $manager->processNewDir())
|
||||
$refreshDir = true;
|
||||
|
||||
//check for any sub-directory request
|
||||
//check that the requested sub-directory exists
|
||||
//and valid
|
||||
if(isset($_REQUEST['dir']))
|
||||
{
|
||||
$path = rawurldecode($_REQUEST['dir']);
|
||||
if($manager->validRelativePath($path))
|
||||
$relative = $path;
|
||||
}
|
||||
|
||||
|
||||
$manager = new ImageManager($IMConfig);
|
||||
|
||||
|
||||
//get the list of files and directories
|
||||
$list = $manager->getFiles($relative);
|
||||
|
||||
|
||||
/* ================= OUTPUT/DRAW FUNCTIONS ======================= */
|
||||
|
||||
/**
|
||||
* Draw the files in an table.
|
||||
*/
|
||||
function drawFiles($list, &$manager)
|
||||
{
|
||||
global $relative;
|
||||
global $IMConfig;
|
||||
|
||||
switch($IMConfig['ViewMode'])
|
||||
{
|
||||
case 'details':
|
||||
{
|
||||
?>
|
||||
<script language="Javascript">
|
||||
<!--
|
||||
function showPreview(f_url)
|
||||
{
|
||||
|
||||
window.parent.document.getElementById('f_preview').src =
|
||||
window.parent._backend_url + '__function=thumbs&img=' + f_url;
|
||||
}
|
||||
//-->
|
||||
</script>
|
||||
<table class="listview">
|
||||
<thead>
|
||||
<tr><th>Name</th><th>Filesize</th><th>Dimensions</th></tr></thead>
|
||||
<tbody>
|
||||
<?php
|
||||
foreach($list as $entry => $file)
|
||||
{
|
||||
?>
|
||||
<tr>
|
||||
<th><a href="#" class="thumb" style="cursor: pointer;" onclick="selectImage('<?php echo $file['relative'];?>', '<?php echo $entry; ?>', <?php echo $file['image'][0];?>, <?php echo $file['image'][1]; ?>);return false;" title="<?php echo $entry; ?> - <?php echo Files::formatSize($file['stat']['size']); ?>" onmouseover="showPreview('<?php echo $file['relative'];?>')" onmouseout="showPreview(window.parent.document.getElementById('f_url').value)" ><?php echo $entry ?></a></th>
|
||||
<td><?php echo Files::formatSize($file['stat']['size']); ?></td>
|
||||
<td><?php if($file['image']){ echo $file['image'][0].'x'.$file['image'][1]; } ?></td>
|
||||
<td class="actions">
|
||||
<a href="<?php print $IMConfig['backend_url']; ?>__function=images&dir=<?php echo $relative; ?>&delf=<?php echo rawurlencode($file['relative']);?>" title="Trash" onclick="return confirmDeleteFile('<?php echo $entry; ?>');"><img src="<?php print $IMConfig['base_url'];?>img/edit_trash.gif" height="15" width="15" alt="Trash" border="0" /></a>
|
||||
|
||||
<a href="javascript:;" title="Edit" onclick="editImage('<?php echo rawurlencode($file['relative']);?>');"><img src="<?php print $IMConfig['base_url'];?>img/edit_pencil.gif" height="15" width="15" alt="Edit" border="0" /></a>
|
||||
</td>
|
||||
</tr>
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
</tbody>
|
||||
</table>
|
||||
<?php
|
||||
}
|
||||
break;
|
||||
|
||||
case 'thumbs':
|
||||
default :
|
||||
{
|
||||
foreach($list as $entry => $file)
|
||||
{
|
||||
?>
|
||||
<div class="thumb_holder" id="holder_<?php echo asc2hex($entry) ?>">
|
||||
<a href="#" class="thumb" style="cursor: pointer;" onclick="selectImage('<?php echo $file['relative'];?>', '<?php echo $entry; ?>', <?php echo $file['image'][0];?>, <?php echo $file['image'][1]; ?>);return false;" title="<?php echo $entry; ?> - <?php echo Files::formatSize($file['stat']['size']); ?>">
|
||||
<img src="<?php print $manager->getThumbnail($file['relative']); ?>" alt="<?php echo $entry; ?> - <?php echo Files::formatSize($file['stat']['size']); ?>"/>
|
||||
</a>
|
||||
<div class="edit">
|
||||
<a href="<?php print $IMConfig['backend_url']; ?>__function=images&dir=<?php echo $relative; ?>&delf=<?php echo rawurlencode($file['relative']);?>" title="Trash" onclick="return confirmDeleteFile('<?php echo $entry; ?>');"><img src="<?php print $IMConfig['base_url'];?>img/edit_trash.gif" height="15" width="15" alt="Trash" /></a>
|
||||
|
||||
<a href="javascript:;" title="Edit" onclick="editImage('<?php echo rawurlencode($file['relative']);?>');"><img src="<?php print $IMConfig['base_url'];?>img/edit_pencil.gif" height="15" width="15" alt="Edit" /></a>
|
||||
|
||||
<?php if($file['image']){ echo $file['image'][0].'x'.$file['image'][1]; } else echo $entry;?>
|
||||
</div>
|
||||
</div>
|
||||
<?php
|
||||
}
|
||||
}
|
||||
}
|
||||
}//function drawFiles
|
||||
|
||||
|
||||
/**
|
||||
* Draw the directory.
|
||||
*/
|
||||
function drawDirs($list, &$manager)
|
||||
{
|
||||
global $relative;
|
||||
global $IMConfig;
|
||||
|
||||
switch($IMConfig['ViewMode'])
|
||||
{
|
||||
case 'details':
|
||||
{
|
||||
|
||||
}
|
||||
break;
|
||||
|
||||
case 'thumbs':
|
||||
default :
|
||||
{
|
||||
foreach($list as $path => $dir)
|
||||
{ ?>
|
||||
<div class="dir_holder">
|
||||
<a class="dir" href="<?php print $IMConfig['backend_url'];?>__function=images&dir=<?php echo rawurlencode($path); ?>" onclick="updateDir('<?php echo $path; ?>')" title="<?php echo $dir['entry']; ?>"><img src="<?php print $IMConfig['base_url'];?>img/folder.gif" height="80" width="80" alt="<?php echo $dir['entry']; ?>" /></a>
|
||||
|
||||
<div class="edit">
|
||||
<a href="<?php print $IMConfig['backend_url'];?>__function=images&dir=<?php echo $relative; ?>&deld=<?php echo rawurlencode($path); ?>" title="Trash" onclick="return confirmDeleteDir('<?php echo $dir['entry']; ?>', <?php echo $dir['count']; ?>);"><img src="<?php print $IMConfig['base_url'];?>img/edit_trash.gif" height="15" width="15" alt="Trash"/></a>
|
||||
<?php echo $dir['entry']; ?>
|
||||
</div>
|
||||
</div>
|
||||
<?php
|
||||
} //foreach
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}//function drawDirs
|
||||
|
||||
|
||||
/**
|
||||
* No directories and no files.
|
||||
*/
|
||||
function drawNoResults()
|
||||
{
|
||||
?>
|
||||
<div class="noResult">No Images Found</div>
|
||||
<?php
|
||||
}
|
||||
|
||||
/**
|
||||
* No directories and no files.
|
||||
*/
|
||||
function drawErrorBase(&$manager)
|
||||
{
|
||||
?>
|
||||
<div class="error"><span>Invalid base directory:</span> <?php echo $manager->config['images_dir']; ?></div>
|
||||
<?php
|
||||
}
|
||||
|
||||
/**
|
||||
* Utility to convert ascii string to hex
|
||||
*/
|
||||
function asc2hex ($temp)
|
||||
{
|
||||
$len = strlen($temp);
|
||||
$data = "";
|
||||
for ($i=0; $i<$len; $i++) $data.=sprintf("%02x",ord(substr($temp,$i,1)));
|
||||
return $data;
|
||||
}
|
||||
|
||||
?>
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||
|
||||
<html>
|
||||
<head>
|
||||
<title>Image List</title>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
||||
<link href="<?php print $IMConfig['base_url'];?>assets/imagelist.css" rel="stylesheet" type="text/css" />
|
||||
<script type="text/javascript">
|
||||
_backend_url = "<?php print $IMConfig['backend_url']; ?>";
|
||||
</script>
|
||||
|
||||
<script type="text/javascript" src="<?php print $IMConfig['base_url'];?>assets/dialog.js"></script>
|
||||
<script type="text/javascript">
|
||||
/*<![CDATA[*/
|
||||
|
||||
if(window.top)
|
||||
HTMLArea = Xinha = window.top.Xinha;
|
||||
|
||||
function hideMessage()
|
||||
{
|
||||
var topDoc = window.top.document;
|
||||
var messages = topDoc.getElementById('messages');
|
||||
if(messages)
|
||||
messages.style.display = "none";
|
||||
}
|
||||
|
||||
init = function()
|
||||
{
|
||||
__dlg_translate('ImageManager');
|
||||
hideMessage();
|
||||
var topDoc = window.top.document;
|
||||
|
||||
<?php
|
||||
//we need to refesh the drop directory list
|
||||
//save the current dir, delete all select options
|
||||
//add the new list, re-select the saved dir.
|
||||
if($refreshDir)
|
||||
{
|
||||
$dirs = $manager->getDirs();
|
||||
?>
|
||||
var selection = topDoc.getElementById('dirPath');
|
||||
var currentDir = selection.options[selection.selectedIndex].text;
|
||||
|
||||
while(selection.length > 0)
|
||||
{ selection.remove(0); }
|
||||
|
||||
selection.options[selection.length] = new Option("/","<?php echo rawurlencode('/'); ?>");
|
||||
<?php foreach($dirs as $relative=>$fullpath) { ?>
|
||||
selection.options[selection.length] = new Option("<?php echo $relative; ?>","<?php echo rawurlencode($relative); ?>");
|
||||
<?php } ?>
|
||||
|
||||
for(var i = 0; i < selection.length; i++)
|
||||
{
|
||||
var thisDir = selection.options[i].text;
|
||||
if(thisDir == currentDir)
|
||||
{
|
||||
selection.selectedIndex = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
<?php } ?>
|
||||
update_selected();
|
||||
}
|
||||
|
||||
function editImage(image)
|
||||
{
|
||||
var url = "<?php print $IMConfig['backend_url']; ?>__function=editor&img="+image;
|
||||
Dialog(url, function(param)
|
||||
{
|
||||
if (!param) // user must have pressed Cancel
|
||||
return false;
|
||||
else
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}, null);
|
||||
}
|
||||
|
||||
/*]]>*/
|
||||
</script>
|
||||
<script type="text/javascript" src="<?php print $IMConfig['base_url'];?>assets/images.js"></script>
|
||||
<script type="text/javascript" src="../../popups/popup.js"></script>
|
||||
<script type="text/javascript" src="assets/popup.js"></script>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<?php if ($manager->isValidBase() == false) { drawErrorBase($manager); }
|
||||
elseif(count($list[0]) > 0 || count($list[1]) > 0) { ?>
|
||||
|
||||
<?php drawDirs($list[0], $manager); ?>
|
||||
<?php drawFiles($list[1], $manager); ?>
|
||||
|
||||
<?php } else { drawNoResults(); } ?>
|
||||
</body>
|
||||
</html>
|
||||
|
After Width: | Height: | Size: 286 B |
|
After Width: | Height: | Size: 286 B |
|
After Width: | Height: | Size: 590 B |
|
After Width: | Height: | Size: 596 B |
|
After Width: | Height: | Size: 672 B |
|
After Width: | Height: | Size: 326 B |
|
After Width: | Height: | Size: 180 B |
|
After Width: | Height: | Size: 226 B |
|
After Width: | Height: | Size: 42 B |
|
After Width: | Height: | Size: 167 B |
|
After Width: | Height: | Size: 151 B |
|
After Width: | Height: | Size: 132 B |
|
After Width: | Height: | Size: 132 B |
|
After Width: | Height: | Size: 1.2 KiB |
|
After Width: | Height: | Size: 103 B |
|
After Width: | Height: | Size: 321 B |
|
After Width: | Height: | Size: 398 B |
|
After Width: | Height: | Size: 93 B |
|
After Width: | Height: | Size: 772 B |
|
After Width: | Height: | Size: 85 B |
|
After Width: | Height: | Size: 95 B |
|
After Width: | Height: | Size: 106 B |
|
After Width: | Height: | Size: 43 B |
|
After Width: | Height: | Size: 85 B |
|
After Width: | Height: | Size: 85 B |
|
After Width: | Height: | Size: 73 B |
|
After Width: | Height: | Size: 191 B |
@@ -0,0 +1,65 @@
|
||||
// I18N constants
|
||||
// LANG: "de", ENCODING: UTF-8
|
||||
// translated: Udo Schmal (gocher), http://www.schaffrath-neuemedien.de/, udo.schmal@t-online.de
|
||||
{
|
||||
"Image Manager": "Bildmanager",
|
||||
"Insert Image": "Bild einfügen",
|
||||
"Directory": "Ordner",
|
||||
"Directory Up": "übergeordneter Ordner",
|
||||
"New Folder": "Neuer Ordner",
|
||||
"Trash": "Müll",
|
||||
"Edit": "bearbeiten",
|
||||
"Image File": "Bilddatei",
|
||||
"Upload": "Hochladen",
|
||||
"Width": "Breite",
|
||||
"Height": "Höhe",
|
||||
"Constrain Proportions": "Proportional",
|
||||
"Border": "Rand",
|
||||
"V Space": "vertikaler Freiraum",
|
||||
"H Space": "horizontaler Freiraum",
|
||||
"Refresh": "Aktualisieren",
|
||||
"Uploading...": "Hochladen...",
|
||||
"Crop": "Beschneiden",
|
||||
"Resize": "Größe ändern",
|
||||
"Rotate": "Drehen",
|
||||
"Measure": "Abmessungen",
|
||||
"Marker": "Marker",
|
||||
"Save": "Speichern",
|
||||
"Filename:": "Dateiname:",
|
||||
"Image Format": "Bildformat:",
|
||||
"Quality:": "Qualität",
|
||||
"JPEG High": "JPEG hoch",
|
||||
"JPEG Medium": "JPEG mittel",
|
||||
"JPEG Low": "JPEG niedrig",
|
||||
"File saved.": "Datei gespeichert.",
|
||||
"File was not saved.": "Datei wurde nicht gespeichert.",
|
||||
"Start X:": "Start X",
|
||||
"Start Y:": "Start Y",
|
||||
"Lock": "Sperren",
|
||||
"Flip Image": "Bild spiegeln",
|
||||
"Flip Horizontal": "horizontal spiegeln",
|
||||
"Flip Vertical": "vertikal spiegeln",
|
||||
"Rotate Image": "Bild drehen",
|
||||
"Rotate 180 °": "180° drehen",
|
||||
"Rotate 90 ° CW": "90° drehen im UZS",
|
||||
"Rotate 90 ° CCW": "90° drehen gegen UZS",
|
||||
"Angle:": "Winkel:",
|
||||
"W:": "B:",
|
||||
"Clear": "Entfernen",
|
||||
"Loading": "Laden",
|
||||
"Invalid base directory:": "Ungültiges Startverzeichnis:",
|
||||
"Delete file?": "Datei löschen?",
|
||||
"Please delete all files/folders inside the folder you wish to delete first.": "Bitte löschen Sie zuerst alle Dateien im Ordner den Sie löschen möchten.",
|
||||
"Delete folder?": "Ordner löschen?",
|
||||
"Folder Name:": "Ordnername:",
|
||||
"No Images Found": "Kein Bild gefunden",
|
||||
"Invalid folder name, please choose another folder name.": "Ungültiger Ordnername, bitte wählen sie einen anderen Namen.",
|
||||
"GIF format is not supported, image editing not supported.": "GIF Format wird nicht unterstützt, Bildbearbeitung wird nicht unterstützt.",
|
||||
"No Image Available": "Kein Bild verfügbar",
|
||||
"No Image selected.": "Kein Bild ausgewählt.",
|
||||
"Description:": "Beschreibung:",
|
||||
"Align:": "Ausrichtung:",
|
||||
"Margin:": "Außenabstand:",
|
||||
"Padding:": "Innenabstand:",
|
||||
"Color:": "Farbe:"
|
||||
};
|
||||
@@ -0,0 +1,70 @@
|
||||
// I18N constants
|
||||
// LANG: "es", ENCODING: UTF-8
|
||||
// translated: michael Hauptmnn (mhauptma73) , http://www.azahost.com/, miguel@azalorea.com
|
||||
{
|
||||
"Image Manager": "Editor de imágenes",
|
||||
"Insert Image": "insertar imagen",
|
||||
"Directory": "Directorio",
|
||||
"Directory Up": "Directorio superior",
|
||||
"New Folder": "Crear directorio",
|
||||
"Trash": "Basura",
|
||||
"Edit": "editar",
|
||||
"Image File": "Fichero",
|
||||
"Upload": "Subir",
|
||||
"Width": "Ancho",
|
||||
"Height": "Alto",
|
||||
"Width:": "Ancho:",
|
||||
"Height:": "Alto:",
|
||||
"Constrain Proportions": "Proporcional",
|
||||
"Border": "Borde",
|
||||
"V Space": "espacio vertical",
|
||||
"H Space": "espacio horizontal",
|
||||
"Refresh": "Actualizar",
|
||||
"Uploading...": "Subir...",
|
||||
"Crop": "Recortar",
|
||||
"Resize": "Cambiar tamaño",
|
||||
"Rotate": "Girar",
|
||||
"Measure": "Dimensiones",
|
||||
"Marker": "Marcador",
|
||||
"Save": "Guardar",
|
||||
"Filename:": "Nombre del fichero:",
|
||||
"Image Format": "Formato:",
|
||||
"Quality:": "Calidad",
|
||||
"JPEG High": "JPEG alto",
|
||||
"JPEG Medium": "JPEG medio",
|
||||
"JPEG Low": "JPEG bajo",
|
||||
"File saved.": "Fichero guardado.",
|
||||
"File was not saved.": "el fichero no ha sido guardado.",
|
||||
"Start X:": "Inicio X",
|
||||
"Start Y:": "Inicio Y",
|
||||
"Lock": "Bloquear",
|
||||
"Flip Image": "invertir imagen",
|
||||
"Flip Horizontal": "invertir horizontalmente",
|
||||
"Flip Vertical": "invertir verticalmente",
|
||||
"Rotate Image": "Girar imagen",
|
||||
"Rotate 180 °": "Girar 180º",
|
||||
"Rotate 90 ° CW": "Girar 90º sentido reloj",
|
||||
"Rotate 90 ° CCW": "Girar 90º sentido contrareloj",
|
||||
"Angle:": "Ángulo:",
|
||||
"W:": "B:",
|
||||
"Clear": "Eliminar",
|
||||
"Loading": "Cargar",
|
||||
"Invalid base directory:": "Directorio de inicio inválido:",
|
||||
"Delete file?": "¿Borrar fichero?",
|
||||
"Please delete all files/folders inside the folder you wish to delete first.": "Primero tiene que borrar todoas los ficheros de este directorio.",
|
||||
"Delete folder?": "¿Borrar directorio?",
|
||||
"Folder Name:": "Nombre del directorio:",
|
||||
"No Images Found": "No se ha encontrado imagen",
|
||||
"Invalid folder name, please choose another folder name.": "Nombre de directorio inválido... por favor elija otro nombre.",
|
||||
"GIF format is not supported, image editing not supported.": "No hay soporte para imágenes en formato GIF.",
|
||||
"No Image Available": "No hay imagen",
|
||||
"No Image selected.": "No ha seleccionado imagen.",
|
||||
"Description:": "Descripción:",
|
||||
"Align:": "Alineado:",
|
||||
"Description:": "Descripción:",
|
||||
"Margin:": "Margen exterior:",
|
||||
"Padding:": "Margen interior:",
|
||||
"Border:": "Borde:",
|
||||
"Color:": "Color:",
|
||||
"Upload:": "Subir:"
|
||||
};
|
||||
@@ -0,0 +1,66 @@
|
||||
// I18N constants
|
||||
// LANG: "fr", ENCODING: UTF-8
|
||||
{
|
||||
"Image Manager": "Bibliothèque d'images",
|
||||
"Insert Image": "Insérer une image",
|
||||
"Directory": "Répertoire",
|
||||
"Directory Up": "Remonter",
|
||||
"New Folder": "Nouveau répertoire",
|
||||
"Trash": "Détruire",
|
||||
"Edit": "Editer",
|
||||
"Image File": "Fichier",
|
||||
"Upload": "Télécharger",
|
||||
"Width": "Largeur",
|
||||
"Height": "Hauteur",
|
||||
"Width:": "Largeur",
|
||||
"Height:": "Hauteur",
|
||||
"Constrain Proportions": "Conserver les proportions",
|
||||
"Border": "Bordure",
|
||||
"V Space": "Espace V",
|
||||
"H Space": "Espace H",
|
||||
"Refresh": "Rafraîchir",
|
||||
"Uploading...": "Chargement...",
|
||||
"Crop": "Recadrer",
|
||||
"Resize": "Retailler",
|
||||
"Rotate": "Pivoter",
|
||||
"Measure": "Mesure",
|
||||
"Marker": "Marqueur",
|
||||
"Save": "Sauver",
|
||||
"Filename:": "Nom",
|
||||
"Image Format": "Format d'image",
|
||||
"Quality:": "Qualité",
|
||||
"JPEG High": "JPEG haut",
|
||||
"JPEG Medium": "JPEG moyen",
|
||||
"JPEG Low": "JPEG bas",
|
||||
"File saved.": "Fichier sauvegardé.",
|
||||
"File was not saved.": "Fichier non sauvegardé.",
|
||||
"Start X:": "Début X",
|
||||
"Start Y:": "Début Y",
|
||||
"Lock": "Cadenas",
|
||||
"Flip Image": "Symétrie",
|
||||
"Flip Horizontal": "Symétrie horizontale",
|
||||
"Flip Vertical": "Symétrie verticale",
|
||||
"Rotate Image": "Rotation",
|
||||
"Rotate 180 °": "Rotation 180°",
|
||||
"Rotate 90 ° CW": "Rotation 90° horaire",
|
||||
"Rotate 90 ° CCW": "Rotation 90° antihoraire",
|
||||
"Angle:": "Angle",
|
||||
"W:": "L:",
|
||||
"Clear": "Effacer",
|
||||
"Loading": "Chargement en cours",
|
||||
"Invalid base directory:": "Répertoire de base invalide:",
|
||||
"Delete file?": "Suppression du fichier ?",
|
||||
"Please delete all files/folders inside the folder you wish to delete first.": "Veuillez tout d'abord supprimer tous les fichiers et répertoires contenus",
|
||||
"Delete folder?": "Suppression du répertoire ?",
|
||||
"Folder Name:": "Nom du répertoire",
|
||||
"No Images Found": "Aucune image trouvée",
|
||||
"Invalid folder name, please choose another folder name.": "Nom de répertoire invalide, veuillez choisir un autre nom",
|
||||
"GIF format is not supported, image editing not supported.": "Format GIF non supporté, édition d'image non supportée",
|
||||
"No Image Available": "Aucune image disponible",
|
||||
"No Image selected.": "Aucune image sélectionnée.",
|
||||
"Color:": "Couleur",
|
||||
"Align:": "Alignement",
|
||||
"Margin:": "Marge",
|
||||
"Padding:": "Espacement",
|
||||
"Border:": "Bordure"
|
||||
};
|
||||
@@ -0,0 +1,70 @@
|
||||
// I18N constants
|
||||
// LANG: "ja", ENCODING: UTF-8
|
||||
{
|
||||
"Image Manager": "画像マネージャ",
|
||||
"Insert Image": "画像の挿入",
|
||||
"Directory": "ディレクトリ",
|
||||
"Directory Up": "親ディレクトリへ",
|
||||
"New Folder": "新規フォルダ",
|
||||
"Trash": "削除",
|
||||
"Edit": "編集",
|
||||
"Image File": "画像ファイル",
|
||||
"Upload": "アップロード",
|
||||
"Width": "幅",
|
||||
"Height": "高さ",
|
||||
"Width:": "幅:",
|
||||
"Height:": "高さ:",
|
||||
"Constrain Proportions": "縦横比を固定",
|
||||
"Border": "ボーダー",
|
||||
"V Space": "垂直余白",
|
||||
"H Space": "水平余白",
|
||||
"Refresh": "更新",
|
||||
"Uploading...": "アップロード中...",
|
||||
"Crop": "切り抜き",
|
||||
"Resize": "サイズ変更",
|
||||
"Rotate": "回転",
|
||||
"Measure": "計測",
|
||||
"Marker": "マーカー",
|
||||
"Save": "保存",
|
||||
"Filename:": "ファイル名:",
|
||||
"Image Format": "画像形式",
|
||||
"Quality:": "画質:",
|
||||
"JPEG High": "JPEG 高画質",
|
||||
"JPEG Medium": "JPEG 標準",
|
||||
"JPEG Low": "JPEG 低画質",
|
||||
"File saved.": "ファイルを保存しました。",
|
||||
"File was not saved.": "ファイルを保存できませんでした。",
|
||||
"Start X:": "開始 X",
|
||||
"Start Y:": "開始 Y",
|
||||
"Lock": "ロック",
|
||||
"Flip Image": "画像を反転",
|
||||
"Flip Horizontal": "左右反転",
|
||||
"Flip Vertical": "上下反転",
|
||||
"Rotate Image": "画像を回転",
|
||||
"Rotate 180 °": "180°",
|
||||
"Rotate 90 ° CW": "90° 時計回り",
|
||||
"Rotate 90 ° CCW": "90° 反時計回り",
|
||||
"Angle:": "角度:",
|
||||
"W:": "W:",
|
||||
"Clear": "クリア",
|
||||
"Loading": "ロード中",
|
||||
"Invalid base directory:": "無効なディレクトリ:",
|
||||
'Delete file "$file"?': 'ファイル "$file" を削除しますか?',
|
||||
"Please delete all files/folders inside the folder you wish to delete first.": "削除したいフォルダ内のファイルとフォルダを全て削除しておいてください。",
|
||||
'Delete folder "$dir"?': 'フォルダ "$dir" を削除しますか?',
|
||||
"Folder Name:": "フォルダ名:",
|
||||
"No Files Found": "ファイルがありません",
|
||||
"Invalid folder name, please choose another folder name.": "無効なフォルダ名です。別のフォルダ名を選んでください。",
|
||||
"GIF format is not supported, image editing not supported.": "GIF形式はサポートされていないため、画像編集できません。",
|
||||
"No Image Available": "画像がありません",
|
||||
"No Image selected.": "画像が選択されていません。",
|
||||
"Color:": "色:",
|
||||
"Align:": "行揃え",
|
||||
"Margin:": "間隔:",
|
||||
"Padding:": "余白:",
|
||||
"Border:": "境界線:",
|
||||
|
||||
"Upload": "アップロード",
|
||||
"Upload:": "アップロード:",
|
||||
"Description:": "説明:"
|
||||
};
|
||||
@@ -0,0 +1,65 @@
|
||||
// I18N constants
|
||||
// LANG: "nb", ENCODING: UTF-8
|
||||
// translated: Kim Steinhaug, http://www.steinhaug.com/, kim@steinhaug.com
|
||||
{
|
||||
"Image Manager": "Bildebehandler",
|
||||
"Insert Image": "Sett inn bilde",
|
||||
"Directory": "Mappe",
|
||||
"Directory Up": "Opp en mappe",
|
||||
"New Folder": "Ny mappe",
|
||||
"Trash": "Søppelkurv",
|
||||
"Edit": "Rediger",
|
||||
"Image File": "Bildefil",
|
||||
"Upload": "Last opp",
|
||||
"Width": "Bredde",
|
||||
"Height": "Høyde",
|
||||
"Constrain Proportions": "Behold proposjoner",
|
||||
"Border": "Ramme",
|
||||
"V Space": "vertikal marg",
|
||||
"H Space": "horisontal marg",
|
||||
"Refresh": "Oppfrisk",
|
||||
"Uploading...": "Laster opp...",
|
||||
"Crop": "Beskjær",
|
||||
"Resize": "Endre størrelse",
|
||||
"Rotate": "Roter",
|
||||
"Measure": "Mål",
|
||||
"Marker": "Marker",
|
||||
"Save": "Lagre",
|
||||
"Filename:": "Filnavn:",
|
||||
"Image Format": "Bildeformat:",
|
||||
"Quality:": "Kvalitet",
|
||||
"JPEG High": "JPEG høy",
|
||||
"JPEG Medium": "JPEG middelse",
|
||||
"JPEG Low": "JPEG lav",
|
||||
"File saved.": "Fil lagret.",
|
||||
"File was not saved.": "Fil ble ikke lagret.",
|
||||
"Start X:": "Start X",
|
||||
"Start Y:": "Start Y",
|
||||
"Lock": "Sperre",
|
||||
"Flip Image": "Vend bilde",
|
||||
"Flip Horizontal": "Vend horisontal",
|
||||
"Flip Vertical": "Vend vertikal",
|
||||
"Rotate Image": "Roter bilde",
|
||||
"Rotate 180 °": "Roter 180°",
|
||||
"Rotate 90 ° CW": "Roter 90° med klokka",
|
||||
"Rotate 90 ° CCW": "Roter 90° mot klokka",
|
||||
"Angle:": "Vinkel:",
|
||||
"W:": "B:",
|
||||
"Clear": "Fjern",
|
||||
"Loading": "Laster",
|
||||
"Invalid base directory:": "Feil rot-mappe:",
|
||||
"Delete file?": "Slette fil?",
|
||||
"Please delete all files/folders inside the folder you wish to delete first.": "Vennligst slett alle filer og mapper i mappen du ønsker å slette og prøv igjen.",
|
||||
"Delete folder?": "Slett mappe?",
|
||||
"Folder Name:": "Mappenavn:",
|
||||
"No Images Found": "Ingen bilder funnet",
|
||||
"Invalid folder name, please choose another folder name.": "Ugyldig mappenavn, vennligst velg et annet navn på mappen.",
|
||||
"GIF format is not supported, image editing not supported.": "Bildeformatet GIF er ikke støttet.",
|
||||
"No Image Available": "Inget bilde er tilgjengelig",
|
||||
"No Image selected.": "Inget bilde er valgt.",
|
||||
"Description:": "Beskrivelse:",
|
||||
"Align:": "Justering:",
|
||||
"Margin:": "Marg:",
|
||||
"Padding:": "Innsidemarg:",
|
||||
"Color:": "Farge:"
|
||||
};
|
||||
@@ -0,0 +1,7 @@
|
||||
// I18N constants
|
||||
// LANG: "nl", ENCODING: UTF-8
|
||||
// Author: Maarten Molenschot, maarten@nrgmm.nl
|
||||
{
|
||||
"Image Manager": "Afbeeldingen Beheer",
|
||||
"Crop": "Passend maken"
|
||||
};
|
||||
@@ -0,0 +1,70 @@
|
||||
// I18N constants
|
||||
// LANG: "fr", ENCODING: UTF-8
|
||||
// translated: Krzysztof Kotowicz, http://www.eskot.krakow.pl/portfolio/, koto@webworkers.pl
|
||||
{
|
||||
"Image Manager": "Menedżer obrazków",
|
||||
"Insert Image": "Wstaw obrazek",
|
||||
"Directory": "Katalog",
|
||||
"Directory Up": "Katalog wyżej",
|
||||
"New Folder": "Nowy katalog",
|
||||
"Trash": "Usuń",
|
||||
"Edit": "Edytuj",
|
||||
"Image File": "Plik obrazka",
|
||||
"Upload": "Wgraj",
|
||||
"Width": "Szerokość",
|
||||
"Height": "Wysokość",
|
||||
"Width:": "Szerokość:",
|
||||
"Height:": "Wysokość:",
|
||||
"Constrain Proportions": "Zachowaj proporcje",
|
||||
"Border": "Ramka",
|
||||
"V Space": "Odległość V",
|
||||
"H Space": "Odległość H",
|
||||
"Refresh": "Odśwież",
|
||||
"Uploading...": "Wgrywanie...",
|
||||
"Crop": "Przytnij",
|
||||
"Resize": "Przeskaluj",
|
||||
"Rotate": "Obróć",
|
||||
"Measure": "Zmierz",
|
||||
"Marker": "Zaznacz",
|
||||
"Save": "Zapisz",
|
||||
"Filename:": "Nazwa pliku:",
|
||||
"Image Format": "Format pliku:",
|
||||
"Quality:": "Jakość",
|
||||
"JPEG High": "JPEG wysoka",
|
||||
"JPEG Medium": "JPEG średnia",
|
||||
"JPEG Low": "JPEG niska",
|
||||
"File saved.": "Zapisano plik.",
|
||||
"File was not saved.": "Nie zapisano pliku.",
|
||||
"Start X:": "Początek X",
|
||||
"Start Y:": "Początek Y",
|
||||
"Lock": "Zablokuj",
|
||||
"Flip Image": "Odwróć",
|
||||
"Flip Horizontal": "Odwróć poziomo",
|
||||
"Flip Vertical": "Odwróć pionowo",
|
||||
"Rotate Image": "Obróć",
|
||||
"Rotate 180 °": "Obróć 180°",
|
||||
"Rotate 90 ° CW": "Obróć 90° w prawo",
|
||||
"Rotate 90 ° CCW": "Obróć 90° w lewo",
|
||||
"Angle:": "Kąt:",
|
||||
"W:": "L:",
|
||||
"Clear": "Wyczyść",
|
||||
"Loading": "Ładowanie",
|
||||
"Invalid base directory:": "Nieprawidłowy katalog bazowy:",
|
||||
"Delete file?": "Usunąć plik?",
|
||||
"Please delete all files/folders inside the folder you wish to delete first.": "Najpierw usuń wszystkie pliki i podkatalogi katalogu.",
|
||||
"Delete folder?": "Usunąć katalog ?",
|
||||
"Folder Name:": "Nazwa katalogu",
|
||||
"No Images Found": "Nie znaleziono obrazków",
|
||||
"Invalid folder name, please choose another folder name.": "Nieprawidłowa nazwa katalogu, wybierz inną.",
|
||||
"GIF format is not supported, image editing not supported.": "Brak obsługi plików GIF, edycja jest niemożliwa.",
|
||||
"No Image Available": "Obrazek niedostępny",
|
||||
"No Image selected.": "Nie zaznaczono obrazka.",
|
||||
"Description:": "Opis:",
|
||||
"Align:": "Wyrównanie:",
|
||||
"Description:": "Opis:",
|
||||
"Margin:": "Margines:",
|
||||
"Padding:": "Wcięcie:",
|
||||
"Border:": "Ramka:",
|
||||
"Color:": "Kolor:",
|
||||
"Upload:": "Wgraj:"
|
||||
};
|
||||
@@ -0,0 +1,108 @@
|
||||
// I18N constants
|
||||
//
|
||||
// LANG: "pt_br", ENCODING: UTF-8
|
||||
// Portuguese Brazilian Translation
|
||||
//
|
||||
// Author: Marcio Barbosa, <marcio@mpg.com.br>
|
||||
// MSN: tomarshall@msn.com - ICQ: 69419933
|
||||
// Site: http://www.mpg.com.br
|
||||
//
|
||||
// Last revision: 06 september 2007
|
||||
// Please don´t remove this information
|
||||
// If you modify any source, please insert a comment with your name and e-mail
|
||||
//
|
||||
// Distributed under the same terms as HTMLArea itself.
|
||||
// This notice MUST stay intact for use (see license.txt).
|
||||
{
|
||||
"A:": "A:",
|
||||
"Absbottom": "Inferior absoluto",
|
||||
"Absmiddle": "Meio absoluto",
|
||||
"Angle:": "Ângulo:",
|
||||
"Baseline": "Linha de base",
|
||||
"Bottom": "Base",
|
||||
"Cancel": "Cancelar",
|
||||
"Clear": "Limpar",
|
||||
"Constrain Proportions": "Manter proporções",
|
||||
"Crop": "Recortar",
|
||||
"D:": "G:",
|
||||
"Directory": "Diretório",
|
||||
"Directory Up": "Diretório Acima",
|
||||
"Edit": "Editar",
|
||||
"Filename:": "Nome do arquivo:",
|
||||
"Flip Horizontal": "Espelhar Horizontalmente",
|
||||
"Flip Image": "Espelhar Imagem",
|
||||
"Flip Vertical": "Espelhar Verticalmente",
|
||||
"Folder Name:": "Nome da Pasta:",
|
||||
"GIF": "GIF",
|
||||
"GIF format is not supported, image editing not supported.": "Formato GIF não é suportado, edição de imagem não é suportada.",
|
||||
"H:": "A:",
|
||||
"Height:": "Altura:",
|
||||
"Image Editor": "Editor de Imagem",
|
||||
"Image Format": "Formato da Imagem",
|
||||
"Image List": "Lista de Imagens",
|
||||
"Image Manager": "Gerenciador de Imagens",
|
||||
"Image Selection": "Seleção de Imagem",
|
||||
"Insert Image": "Inserir Imagem",
|
||||
"Invalid base directory:": "Diretório base inválido:",
|
||||
"JPEG High": "JPEG Alto",
|
||||
"JPEG Low": "JPEG Baixo",
|
||||
"JPEG Medium": "JPEG Médio",
|
||||
"Left": "Esquerda",
|
||||
"Lock": "Travar",
|
||||
"Marker": "Marcar",
|
||||
"Measure": "Medida",
|
||||
"Middle": "Meio",
|
||||
"New Folder": "Nova Pasta",
|
||||
"No Image Available": "Sem Imagem Disponível",
|
||||
"No Images Found": "Nenhuma Imagem Encontrada",
|
||||
"Not set": "Não definido",
|
||||
"OK": "OK",
|
||||
"PNG": "PNG",
|
||||
"Positioning of this image": "Posicionamento desta imagem",
|
||||
"Quality:": "Qualidade:",
|
||||
"Refresh": "Atualização",
|
||||
"Resize": "Redimencionar",
|
||||
"Right": "Direita",
|
||||
"Rotate": "Rotacionar",
|
||||
"Rotate 180 °": "Rotacionar 180 °",
|
||||
"Rotate 90 ° CCW": "Rotacionar 90 ° anti-horário",
|
||||
"Rotate 90 ° CW": "Rotacionar 90 ° horário",
|
||||
"Rotate Image": "Rotacionar Imagem",
|
||||
"Save": "Gravar",
|
||||
"Start X:": "Início X:",
|
||||
"Start Y:": "Início Y:",
|
||||
"Texttop": "Texto no topo",
|
||||
"Top": "Topo",
|
||||
"Trash": "Lixo",
|
||||
"W:": "C:",
|
||||
"Width:": "Largura:",
|
||||
"X:": "X:",
|
||||
"Y:": "Y:",
|
||||
|
||||
// not find with lc_parse_strings.php
|
||||
"Image File": "Arquivo Imagem",
|
||||
"Upload": "Enviar",
|
||||
"Upload:": "Enviar imagem:",
|
||||
"Width": "Largura",
|
||||
"Height": "Altura",
|
||||
"Border": "Borda",
|
||||
"V Space": "Espaço vert.",
|
||||
"H Space": "Espaço horiz.",
|
||||
"Uploading...": "Enviando...",
|
||||
"File saved.": "Arquivo gravado.",
|
||||
"File was not saved.": "Arquivo não foi salvo.",
|
||||
"Loading": "Lendo",
|
||||
"Delete file?": "Apagar arquivo?",
|
||||
"Please delete all files/folders inside the folder you wish to delete first.": "Por favor, primeiro apague todos os arquivos/pastas dentro da pasta que deseja apagar.",
|
||||
"Delete folder?": "Apagar pasta?",
|
||||
"Folder Name:": "Nome da Pasta:",
|
||||
"No Files Found": "Nenhum arquivo encontrado",
|
||||
"Invalid folder name, please choose another folder name.": "Nome inválido para pasta, escolha outro nome.",
|
||||
"No Image selected.": "Nenhuma imagem selecionada.",
|
||||
"Description:": "Descrição:",
|
||||
"Align:": "Alinhamento:",
|
||||
"Margin:": "Margem:",
|
||||
"Padding:": "Espaçamento:",
|
||||
"Border:": "Borda:",
|
||||
"Color:": "Côr:"
|
||||
}
|
||||
@@ -0,0 +1,67 @@
|
||||
// I18N constants
|
||||
// LANG: "ru", ENCODING: UTF-8
|
||||
// Author: Andrei Blagorazumov, a@fnr.ru
|
||||
{
|
||||
"Image Manager": "Менеджер картинок",
|
||||
"Insert Image": "Вставка картинки",
|
||||
"Directory": "Папка",
|
||||
"Directory Up": "Папка наверх",
|
||||
"New Folder": "Новая папка",
|
||||
"Trash": "Корзина",
|
||||
"Edit": "Правка",
|
||||
"Image File": "Файл картинки",
|
||||
"Upload": "Загрузить",
|
||||
"Width": "Ширина",
|
||||
"Height": "Высота",
|
||||
"Width:": "Ширина",
|
||||
"Height:": "Высота",
|
||||
"Constrain Proportions": "Сохранить пропорции",
|
||||
"Border": "Рамка",
|
||||
"V Space": "Поле V",
|
||||
"H Space": "Поле H",
|
||||
"Refresh": "Обновить",
|
||||
"Uploading...": "Загрузка...",
|
||||
"Crop": "Обрезать",
|
||||
"Resize": "Масшабировать",
|
||||
"Rotate": "Повернуть",
|
||||
"Measure": "Измерение",
|
||||
"Marker": "Маркер",
|
||||
"Save": "Сохранить",
|
||||
"Filename:": "Имя файла",
|
||||
"Image Format": "Формат картинки",
|
||||
"Quality:": "Качество",
|
||||
"JPEG High": "JPEG высок.",
|
||||
"JPEG Medium": "JPEG средн.",
|
||||
"JPEG Low": "JPEG низк.",
|
||||
"File saved.": "Файл сохранен.",
|
||||
"File was not saved.": "Файл не сохранен.",
|
||||
"Start X:": "Начало X",
|
||||
"Start Y:": "Начало Y",
|
||||
"Lock": "Блокировка",
|
||||
"Flip Image": "Развернуть картинку",
|
||||
"Flip Horizontal": "Развернуть по горизонтали",
|
||||
"Flip Vertical": "Развернуть по вертикали",
|
||||
"Rotate Image": "Повернуть картинку",
|
||||
"Rotate 180 В°": "Повернуть на 180°",
|
||||
"Rotate 90 В° CW": "Повернуть на 90° по часовой",
|
||||
"Rotate 90 В° CCW": "Повернуть на 90° против часовой",
|
||||
"Angle:": "Угол",
|
||||
"W:": "Ш:",
|
||||
"Clear": "Очистить",
|
||||
"Loading": "Загрузка",
|
||||
"Invalid base directory:": "Неверная базовая папка:",
|
||||
"Delete file?": "Удалить файл?",
|
||||
"Please delete all files/folders inside the folder you wish to delete first.": "Пожалуйста удалите все файлы/папки в папке, которую вы хотите удалить.",
|
||||
"Delete folder?": "Удалить папку?",
|
||||
"Folder Name:": "Название папки:",
|
||||
"No Images Found": "Картинок не найдено",
|
||||
"Invalid folder name, please choose another folder name.": "Неправильное имя папки, пожалуйста выберите другое.",
|
||||
"GIF format is not supported, image editing not supported.": "Формат GIF не поддерживается, редактирование картинки не поддерживается.",
|
||||
"No Image Available": "Нет доступных картинок",
|
||||
"No Image selected.": "Картинки не выбраны.",
|
||||
"Color:": "Цвет",
|
||||
"Align:": "Выравнивание",
|
||||
"Margin:": "Отступ",
|
||||
"Padding:": "Поля",
|
||||
"Border:": "Рамка"
|
||||
};
|
||||
@@ -0,0 +1,7 @@
|
||||
// I18N constants
|
||||
// LANG: "sv" (Swedish), ENCODING: UTF-8
|
||||
// translated: Erik Dalén, <dalen@jpl.se>
|
||||
{
|
||||
"Image Manager": "Bildbehandlare",
|
||||
"Crop": "Beskjär"
|
||||
};
|
||||
@@ -0,0 +1,204 @@
|
||||
<?php
|
||||
/**
|
||||
* The main GUI for the ImageManager.
|
||||
* @author $Author:ray $
|
||||
* @version $Id:manager.php 987 2008-04-12 12:39:04Z ray $
|
||||
* @package ImageManager
|
||||
*/
|
||||
|
||||
require_once('config.inc.php');
|
||||
require_once('ddt.php');
|
||||
require_once('Classes/ImageManager.php');
|
||||
|
||||
$manager = new ImageManager($IMConfig);
|
||||
$dirs = $manager->getDirs();
|
||||
|
||||
?>
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||
|
||||
<html>
|
||||
<head>
|
||||
<title>Insert Image</title>
|
||||
<script type="text/javascript">
|
||||
// temporary. An ImageManager rewrite will take care of this kludge.
|
||||
_backend_url = "<?php print $IMConfig['backend_url']; ?>";
|
||||
_resized_prefix = "<?php echo $IMConfig['resized_prefix']; ?>";
|
||||
_resized_dir = "<?php echo $IMConfig['resized_dir']; ?>";
|
||||
</script>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
||||
<link href="<?php print $IMConfig['base_url'];?>assets/manager.css" rel="stylesheet" type="text/css" />
|
||||
<script type="text/javascript" src="../../popups/popup.js"></script>
|
||||
<script type="text/javascript" src="assets/popup.js"></script>
|
||||
<script type="text/javascript" src="../../modules/ColorPicker/ColorPicker.js"></script>
|
||||
<script type="text/javascript" src="<?php print $IMConfig['base_url'];?>assets/dialog.js"></script>
|
||||
<script type="text/javascript">
|
||||
/*<![CDATA[*/
|
||||
if(window.opener)
|
||||
Xinha = HTMLArea = window.opener.Xinha;
|
||||
|
||||
var thumbdir = "<?php echo $IMConfig['thumbnail_dir']; ?>";
|
||||
var base_url = "<?php echo $manager->getImagesURL(); ?>";
|
||||
/*]]>*/
|
||||
</script>
|
||||
<script type="text/javascript" src="<?php print $IMConfig['base_url'];?>assets/manager.js"></script>
|
||||
<?php
|
||||
if(!$IMConfig['show_full_options'])
|
||||
{
|
||||
?>
|
||||
<style type="text/css">
|
||||
.fullOptions { visibility:hidden; }
|
||||
</style>
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<form action="<?php print $IMConfig['backend_url'] ?>" id="uploadForm" method="post" enctype="multipart/form-data">
|
||||
|
||||
<input type="hidden" name="__plugin" value="ImageManager" />
|
||||
<input type="hidden" name="__function" value="images" />
|
||||
|
||||
<fieldset>
|
||||
<legend>Image Manager</legend>
|
||||
<table width="100%">
|
||||
<tr>
|
||||
<th><label for="dirPath">Directory</label></th>
|
||||
<td>
|
||||
<select name="dir" class="dirWidth" id="dirPath" onchange="updateDir(this)">
|
||||
<option value="/">/</option>
|
||||
<?php
|
||||
foreach($dirs as $relative=>$fullpath)
|
||||
{
|
||||
?>
|
||||
<option value="<?php echo rawurlencode($relative); ?>"><?php echo $relative; ?></option>
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
</select>
|
||||
</td>
|
||||
<td>
|
||||
<a href="#" onclick="javascript: goUpDir();" title="Directory Up"><img src="<?php print $IMConfig['base_url']; ?>img/btnFolderUp.gif" height="15" width="15" alt="Directory Up" /></a>
|
||||
|
||||
<?php
|
||||
if($IMConfig['safe_mode'] == false && $IMConfig['allow_new_dir'])
|
||||
{
|
||||
?>
|
||||
<a href="#" onclick="newFolder();" title="New Folder"><img src="<?php print $IMConfig['base_url']; ?>img/btnFolderNew.gif" height="15" width="15" alt="New Folder" /></a>
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
</td>
|
||||
</tr>
|
||||
<?php
|
||||
if($IMConfig['allow_upload'] == TRUE)
|
||||
{
|
||||
?>
|
||||
<tr>
|
||||
<th style="text-align: left;">Upload:</th>
|
||||
<td colspan="2">
|
||||
<input type="file" name="upload" id="upload" />
|
||||
<input name="Upload" type="submit" id="Upload" value="Upload" onclick="doUpload();" />
|
||||
</td>
|
||||
</tr>
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
|
||||
</table>
|
||||
|
||||
<div id="messages" style="display: none;"><span id="message"></span><img src="<?php print $IMConfig['base_url']; ?>img/dots.gif" width="22" height="12" alt="..." /></div>
|
||||
|
||||
<iframe src="<?php print $IMConfig['backend_url']; ?>__function=images" name="imgManager" id="imgManager" class="imageFrame" scrolling="auto" title="Image Selection" frameborder="0"></iframe>
|
||||
|
||||
</fieldset>
|
||||
|
||||
<!-- image properties -->
|
||||
|
||||
<table border="0" cellspacing="0" cellpadding="0" width="100%">
|
||||
<tr>
|
||||
<th style="text-align: left;">Description:</th>
|
||||
<td colspan="6">
|
||||
<input type="text" id="f_alt" style="width:95%"/>
|
||||
</td>
|
||||
<td rowspan="4" width="100" height="100" style="vertical-align: middle;" style="padding:4px;background-color:#CCC;border:1px inset;">
|
||||
<img src="" id="f_preview" />
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<th style="text-align: left;">Width:</th>
|
||||
<td >
|
||||
<input id="f_width" type="text" name="f_width" size="4" onchange="javascript:checkConstrains('width');" />
|
||||
</td>
|
||||
<td rowspan="2">
|
||||
<div style="position:relative">
|
||||
<img src="<?php print $IMConfig['base_url']; ?>img/locked.gif" id="imgLock" width="25" height="32" alt="Constrained Proportions" style="vertical-align: middle;" /><input type="checkbox" id="constrain_prop" checked="checked" onclick="javascript:toggleConstrains(this);" style="position:absolute;top:8px;left:0px;" />
|
||||
</div>
|
||||
</td>
|
||||
<th style="text-align: left;" class="fullOptions">Margin:</th>
|
||||
<td colspan="3" class="fullOptions">
|
||||
<input name="f_margin" type="text" id="f_margin" size="3" />
|
||||
px </td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<th style="text-align: left;">Height:</th>
|
||||
<td>
|
||||
<input name="f_height" type="text" id="f_height" size="4" />
|
||||
</td>
|
||||
<th style="text-align: left;" class="fullOptions">Padding:</th>
|
||||
<td class="fullOptions">
|
||||
<input name="f_padding" type="text" id="f_padding" size="3" />
|
||||
px </td>
|
||||
<th style="text-align: left;" class="fullOptions">Color:</th>
|
||||
<td class="fullOptions">
|
||||
<input name="f_backgroundColor" type="text" id="f_backgroundColor" size="7" />
|
||||
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
|
||||
<tr class="fullOptions">
|
||||
<th style="text-align: left;">Alignment:</th>
|
||||
<td colspan="2">
|
||||
<select size="1" id="f_align" title="Positioning of this image">
|
||||
<option value="" >Not set</option>
|
||||
<option value="left" >Left</option>
|
||||
<option value="right" >Right</option>
|
||||
<option value="texttop" >Texttop</option>
|
||||
<option value="absmiddle" >Absmiddle</option>
|
||||
<option value="baseline" selected="selected" >Baseline</option>
|
||||
<option value="absbottom" >Absbottom</option>
|
||||
<option value="bottom" >Bottom</option>
|
||||
<option value="middle" >Middle</option>
|
||||
<option value="top" >Top</option>
|
||||
</select>
|
||||
</td>
|
||||
<th style="text-align: left;">Border:</th>
|
||||
<td>
|
||||
<input name="f_border" type="text" id="f_border" size="3" />
|
||||
px </td>
|
||||
<th style="text-align: left;">Color:</th>
|
||||
<td>
|
||||
<input name="f_borderColor" type="text" id="f_borderColor" size="7" />
|
||||
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
</table>
|
||||
|
||||
<div style="text-align: right;">
|
||||
<hr />
|
||||
<button type="button" class="buttons" onclick="return refresh();">Refresh</button>
|
||||
<button type="button" class="buttons" onclick="return onOK();">OK</button>
|
||||
<button type="button" class="buttons" onclick="return onCancel();">Cancel</button>
|
||||
</div>
|
||||
|
||||
<!--// image properties -->
|
||||
<input type="hidden" id="orginal_width" />
|
||||
<input type="hidden" id="orginal_height" />
|
||||
<input type="hidden" id="f_url" class="largelWidth" value="" />
|
||||
</form>
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,79 @@
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||
<html>
|
||||
<head>
|
||||
<title>New Folder</title>
|
||||
<script type="text/javascript" src="../../popups/popup.js"></script>
|
||||
<style type="text/css">
|
||||
/*<![CDATA[*/
|
||||
html, body { background-color: ButtonFace; color: ButtonText; font: 11px Tahoma,Verdana,sans-serif; margin: 0; padding: 0;}
|
||||
body { padding: 5px; }
|
||||
.title { background-color: #ddf; color: #000; font-weight: bold; font-size: 120%; padding: 3px 10px; margin-bottom: 10px; border-bottom: 1px solid black; letter-spacing: 2px;}
|
||||
select, input, button { font: 11px Tahoma,Verdana,sans-serif; }
|
||||
.buttons { width: 70px; text-align: center; }
|
||||
form { padding: 0px; margin: 0;}
|
||||
form .elements{
|
||||
padding: 10px; text-align: center;
|
||||
}
|
||||
/*]]>*/
|
||||
</style>
|
||||
<script type="text/javascript" src="assets/popup.js"></script>
|
||||
<script type="text/javascript">
|
||||
/*<![CDATA[*/
|
||||
window.resizeTo(300, 160);
|
||||
|
||||
if(window.opener)
|
||||
HTMLArea = window.opener.HTMLArea;
|
||||
|
||||
init = function ()
|
||||
{
|
||||
__dlg_init();
|
||||
__dlg_translate('ImageManager');
|
||||
document.getElementById("f_foldername").focus();
|
||||
};
|
||||
|
||||
function onCancel()
|
||||
{
|
||||
__dlg_close(null);
|
||||
return false;
|
||||
}
|
||||
|
||||
function onOK()
|
||||
{
|
||||
// pass data back to the calling window
|
||||
var fields = ["f_foldername"];
|
||||
var param = new Object();
|
||||
for (var i in fields) {
|
||||
var id = fields[i];
|
||||
var el = document.getElementById(id);
|
||||
param[id] = el.value;
|
||||
}
|
||||
__dlg_close(param);
|
||||
return false;
|
||||
}
|
||||
|
||||
function addEvent(obj, evType, fn)
|
||||
{
|
||||
if (obj.addEventListener) { obj.addEventListener(evType, fn, true); return true; }
|
||||
else if (obj.attachEvent) { var r = obj.attachEvent("on"+evType, fn); return r; }
|
||||
else { return false; }
|
||||
}
|
||||
|
||||
addEvent(window, 'load', init);
|
||||
//-->
|
||||
</script>
|
||||
</head>
|
||||
<body >
|
||||
<div class="title">New Folder</div>
|
||||
<form action="">
|
||||
<div class="elements">
|
||||
<label for="f_foldername">Folder Name:</label>
|
||||
<input type="text" id="f_foldername" />
|
||||
</div>
|
||||
<div style="text-align: right;">
|
||||
<hr />
|
||||
<button type="button" class="buttons" onclick="return onOK();">OK</button>
|
||||
<button type="button" class="buttons" onclick="return onCancel();">Cancel</button>
|
||||
</div>
|
||||
</form>
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,83 @@
|
||||
<?php
|
||||
header('Content-Type: text/javascript; charset=UTF-8');
|
||||
|
||||
/**
|
||||
* Resize images to a given size, and saving in a new file.
|
||||
* resize.php?img=/relative/path/to/image.jpg&width=<pixels>&height=<pixels>[&to=/relative/path/to/newimage.jpg]
|
||||
* relative to the base_dir given in config.inc.php
|
||||
* This is pretty much just thumbs.php with some mods, I'm too lazy to do it properly
|
||||
* @author $Author:ray $
|
||||
* @version $Id:resizer.php 922 2007-12-30 14:35:46Z ray $
|
||||
* @package ImageManager
|
||||
*/
|
||||
|
||||
require_once('config.inc.php');
|
||||
require_once('Classes/ImageManager.php');
|
||||
require_once('Classes/Thumbnail.php');
|
||||
|
||||
function js_fail($message) { echo 'alert(\'' . $message . '\'); false'; exit; }
|
||||
function js_success($resultFile) { echo '\'' . $resultFile . '\''; exit; }
|
||||
|
||||
//check for img parameter in the url
|
||||
if(!isset($_GET['img']) || !isset($_GET['width']) || !isset($_GET['height']))
|
||||
{
|
||||
js_fail('Missing parameter.');
|
||||
}
|
||||
|
||||
$manager = new ImageManager($IMConfig);
|
||||
|
||||
//get the image and the full path to the image
|
||||
$image = $_GET['img'];
|
||||
$fullpath = Files::makeFile($manager->getImagesDir(),$image);
|
||||
|
||||
//not a file, so exit
|
||||
if(!is_file($fullpath))
|
||||
{
|
||||
js_fail("File {$fullpath} does not exist.");
|
||||
}
|
||||
|
||||
$imgInfo = @getImageSize($fullpath);
|
||||
|
||||
//Not an image, bail out.
|
||||
if(!is_array($imgInfo))
|
||||
{
|
||||
js_fail("File {$fullpath} is not an image.");
|
||||
}
|
||||
|
||||
if(!isset($_GET['to']))
|
||||
{
|
||||
$resized = $manager->getResizedName($fullpath,$_GET['width'],$_GET['height']);
|
||||
$_GET['to'] = $manager->getResizedName($image,$_GET['width'],$_GET['height'], FALSE);
|
||||
}
|
||||
else
|
||||
{
|
||||
$resized = Files::makeFile($manager->getImagesDir(),$_GET['to']);
|
||||
}
|
||||
|
||||
// Check to see if it already exists
|
||||
if(is_file($resized))
|
||||
{
|
||||
// And is newer
|
||||
if(filemtime($resized) >= filemtime($fullpath))
|
||||
{
|
||||
js_success($_GET['to']);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
// resize (thumbnailer will do this for us just fine)
|
||||
$thumbnailer = new Thumbnail($_GET['width'],$_GET['height']);
|
||||
$thumbnailer->proportional = FALSE;
|
||||
$thumbnailer->createThumbnail($fullpath, $resized);
|
||||
|
||||
// did it work?
|
||||
if(is_file($resized))
|
||||
{
|
||||
js_success($_GET['to']);
|
||||
}
|
||||
else
|
||||
{
|
||||
js_fail("Resize Failed.");
|
||||
}
|
||||
?>
|
||||
@@ -0,0 +1,90 @@
|
||||
<?php
|
||||
/**
|
||||
* On the fly Thumbnail generation.
|
||||
* Creates thumbnails given by thumbs.php?img=/relative/path/to/image.jpg
|
||||
* relative to the base_dir given in config.inc.php
|
||||
* @author $Author:ray $
|
||||
* @version $Id:thumbs.php 677 2007-01-19 22:24:36Z ray $
|
||||
* @package ImageManager
|
||||
*/
|
||||
|
||||
require_once('config.inc.php');
|
||||
require_once('Classes/ImageManager.php');
|
||||
require_once('Classes/Thumbnail.php');
|
||||
|
||||
//check for img parameter in the url
|
||||
if(!isset($_GET['img']))
|
||||
{
|
||||
exit();
|
||||
}
|
||||
|
||||
|
||||
$manager = new ImageManager($IMConfig);
|
||||
|
||||
//get the image and the full path to the image
|
||||
$image = rawurldecode($_GET['img']);
|
||||
$fullpath = Files::makeFile($manager->getImagesDir(),$image);
|
||||
|
||||
//not a file, so exit
|
||||
if(!is_file($fullpath))
|
||||
{
|
||||
exit();
|
||||
}
|
||||
|
||||
$imgInfo = @getImageSize($fullpath);
|
||||
|
||||
//Not an image, send default thumbnail
|
||||
if(!is_array($imgInfo))
|
||||
{
|
||||
//show the default image, otherwise we quit!
|
||||
$default = $manager->getDefaultThumb();
|
||||
if($default)
|
||||
{
|
||||
header('Location: '.$default);
|
||||
exit();
|
||||
}
|
||||
}
|
||||
//if the image is less than the thumbnail dimensions
|
||||
//send the original image as thumbnail
|
||||
|
||||
if ($imgInfo[0] <= $IMConfig['thumbnail_width']
|
||||
&& $imgInfo[1] <= $IMConfig['thumbnail_height'])
|
||||
{
|
||||
|
||||
header('Location: '. $manager->getFileURL($image));
|
||||
exit();
|
||||
}
|
||||
|
||||
//Check for thumbnails
|
||||
$thumbnail = $manager->getThumbName($fullpath);
|
||||
|
||||
if(is_file($thumbnail))
|
||||
{
|
||||
//if the thumbnail is newer, send it
|
||||
if(filemtime($thumbnail) >= filemtime($fullpath))
|
||||
{
|
||||
header('Location: '.$manager->getThumbURL($image));
|
||||
exit();
|
||||
}
|
||||
}
|
||||
|
||||
//creating thumbnails
|
||||
$thumbnailer = new Thumbnail($IMConfig['thumbnail_width'],$IMConfig['thumbnail_height']);
|
||||
$thumbnailer->createThumbnail($fullpath, $thumbnail);
|
||||
|
||||
//Check for NEW thumbnails
|
||||
if(is_file($thumbnail))
|
||||
{
|
||||
//send the new thumbnail
|
||||
header('Location: '.$manager->getThumbURL($image));
|
||||
exit();
|
||||
}
|
||||
else
|
||||
{
|
||||
//show the default image, otherwise we quit!
|
||||
$default = $manager->getDefaultThumb();
|
||||
|
||||
if($default)
|
||||
header('Location: '.$default);
|
||||
}
|
||||
?>
|
||||