Edit File by line

Deprecated: str_replace(): Passing null to parameter #2 ($replace) of type array|string is deprecated in /home/sportsfever/public_html/filemanger/function.php on line 93

Warning: Undefined array key "page_file_edit_line" in /home/sportsfever/public_html/filemanger/edit_text_line.php on line 32
/home/sportsfe.../httpdocs/wp-conte.../plugins/wp-file-.../lib/php
File: elFinderVolumeDriver.class.php
[6000] Fix | Delete
$ani = ($img->getNumberImages() > 1);
[6001] Fix | Delete
if ($ani && is_null($destformat)) {
[6002] Fix | Delete
$img = $img->coalesceImages();
[6003] Fix | Delete
do {
[6004] Fix | Delete
$img->setImagePage($s[0], $s[1], 0, 0);
[6005] Fix | Delete
$img->cropImage($width, $height, $x, $y);
[6006] Fix | Delete
$img->setImagePage($width, $height, 0, 0);
[6007] Fix | Delete
} while ($img->nextImage());
[6008] Fix | Delete
$img->optimizeImageLayers();
[6009] Fix | Delete
$result = $img->writeImages($path, true);
[6010] Fix | Delete
} else {
[6011] Fix | Delete
if ($ani) {
[6012] Fix | Delete
$img->setFirstIterator();
[6013] Fix | Delete
}
[6014] Fix | Delete
$img->setImagePage($s[0], $s[1], 0, 0);
[6015] Fix | Delete
$img->cropImage($width, $height, $x, $y);
[6016] Fix | Delete
$img->setImagePage($width, $height, 0, 0);
[6017] Fix | Delete
$result = $this->imagickImage($img, $path, $destformat, $jpgQuality);
[6018] Fix | Delete
}
[6019] Fix | Delete
[6020] Fix | Delete
$img->clear();
[6021] Fix | Delete
[6022] Fix | Delete
return $result ? $path : false;
[6023] Fix | Delete
[6024] Fix | Delete
break;
[6025] Fix | Delete
[6026] Fix | Delete
case 'convert':
[6027] Fix | Delete
extract($this->imageMagickConvertPrepare($path, $destformat, $jpgQuality, $s));
[6028] Fix | Delete
/**
[6029] Fix | Delete
* @var string $ani
[6030] Fix | Delete
* @var string $index
[6031] Fix | Delete
* @var string $coalesce
[6032] Fix | Delete
* @var string $deconstruct
[6033] Fix | Delete
* @var string $jpgQuality
[6034] Fix | Delete
* @var string $quotedPath
[6035] Fix | Delete
* @var string $quotedDstPath
[6036] Fix | Delete
* @var string $interlace
[6037] Fix | Delete
*/
[6038] Fix | Delete
$cmd = sprintf('%s %s%s%s%s -crop %dx%d+%d+%d%s %s', ELFINDER_CONVERT_PATH, $quotedPath, $coalesce, $jpgQuality, $interlace, $width, $height, $x, $y, $deconstruct, $quotedDstPath);
[6039] Fix | Delete
[6040] Fix | Delete
$result = false;
[6041] Fix | Delete
if ($this->procExec($cmd) === 0) {
[6042] Fix | Delete
$result = true;
[6043] Fix | Delete
}
[6044] Fix | Delete
return $result ? $path : false;
[6045] Fix | Delete
[6046] Fix | Delete
break;
[6047] Fix | Delete
[6048] Fix | Delete
case 'gd':
[6049] Fix | Delete
elFinder::expandMemoryForGD(array($s, array($width, $height)));
[6050] Fix | Delete
$img = $this->gdImageCreate($path, $s['mime']);
[6051] Fix | Delete
[6052] Fix | Delete
if ($img && false != ($tmp = imagecreatetruecolor($width, $height))) {
[6053] Fix | Delete
[6054] Fix | Delete
$bgNum = false;
[6055] Fix | Delete
if ($s[2] === IMAGETYPE_GIF && (!$destformat || $destformat === 'gif')) {
[6056] Fix | Delete
$bgIdx = imagecolortransparent($img);
[6057] Fix | Delete
if ($bgIdx !== -1) {
[6058] Fix | Delete
$c = imagecolorsforindex($img, $bgIdx);
[6059] Fix | Delete
$bgNum = imagecolorallocate($tmp, $c['red'], $c['green'], $c['blue']);
[6060] Fix | Delete
imagefill($tmp, 0, 0, $bgNum);
[6061] Fix | Delete
imagecolortransparent($tmp, $bgNum);
[6062] Fix | Delete
}
[6063] Fix | Delete
}
[6064] Fix | Delete
if ($bgNum === false) {
[6065] Fix | Delete
$this->gdImageBackground($tmp, 'transparent');
[6066] Fix | Delete
}
[6067] Fix | Delete
[6068] Fix | Delete
$size_w = $width;
[6069] Fix | Delete
$size_h = $height;
[6070] Fix | Delete
[6071] Fix | Delete
if ($s[0] < $width || $s[1] < $height) {
[6072] Fix | Delete
$size_w = $s[0];
[6073] Fix | Delete
$size_h = $s[1];
[6074] Fix | Delete
}
[6075] Fix | Delete
[6076] Fix | Delete
if (!imagecopy($tmp, $img, 0, 0, $x, $y, $size_w, $size_h)) {
[6077] Fix | Delete
return false;
[6078] Fix | Delete
}
[6079] Fix | Delete
[6080] Fix | Delete
$result = $this->gdImage($tmp, $path, $destformat, $s['mime'], $jpgQuality);
[6081] Fix | Delete
[6082] Fix | Delete
imagedestroy($img);
[6083] Fix | Delete
imagedestroy($tmp);
[6084] Fix | Delete
[6085] Fix | Delete
return $result ? $path : false;
[6086] Fix | Delete
[6087] Fix | Delete
}
[6088] Fix | Delete
break;
[6089] Fix | Delete
}
[6090] Fix | Delete
[6091] Fix | Delete
return false;
[6092] Fix | Delete
}
[6093] Fix | Delete
[6094] Fix | Delete
/**
[6095] Fix | Delete
* Put image to square
[6096] Fix | Delete
*
[6097] Fix | Delete
* @param string $path image file
[6098] Fix | Delete
* @param int $width square width
[6099] Fix | Delete
* @param int $height square height
[6100] Fix | Delete
* @param int|string $align reserved
[6101] Fix | Delete
* @param int|string $valign reserved
[6102] Fix | Delete
* @param string $bgcolor square background color in #rrggbb format
[6103] Fix | Delete
* @param string $destformat image destination format
[6104] Fix | Delete
* @param int $jpgQuality JEPG quality (1-100)
[6105] Fix | Delete
*
[6106] Fix | Delete
* @return false|string
[6107] Fix | Delete
* @throws ImagickException
[6108] Fix | Delete
* @throws elFinderAbortException
[6109] Fix | Delete
* @author Dmitry (dio) Levashov
[6110] Fix | Delete
* @author Alexey Sukhotin
[6111] Fix | Delete
*/
[6112] Fix | Delete
protected function imgSquareFit($path, $width, $height, $align = 'center', $valign = 'middle', $bgcolor = '#0000ff', $destformat = null, $jpgQuality = null)
[6113] Fix | Delete
{
[6114] Fix | Delete
if (($s = getimagesize($path)) == false) {
[6115] Fix | Delete
return false;
[6116] Fix | Delete
}
[6117] Fix | Delete
[6118] Fix | Delete
$result = false;
[6119] Fix | Delete
[6120] Fix | Delete
/* Coordinates for image over square aligning */
[6121] Fix | Delete
$y = ceil(abs($height - $s[1]) / 2);
[6122] Fix | Delete
$x = ceil(abs($width - $s[0]) / 2);
[6123] Fix | Delete
[6124] Fix | Delete
if (!$jpgQuality) {
[6125] Fix | Delete
$jpgQuality = $this->options['jpgQuality'];
[6126] Fix | Delete
}
[6127] Fix | Delete
[6128] Fix | Delete
elFinder::extendTimeLimit(300);
[6129] Fix | Delete
switch ($this->imgLib) {
[6130] Fix | Delete
case 'imagick':
[6131] Fix | Delete
try {
[6132] Fix | Delete
$img = new imagick($path);
[6133] Fix | Delete
} catch (Exception $e) {
[6134] Fix | Delete
return false;
[6135] Fix | Delete
}
[6136] Fix | Delete
[6137] Fix | Delete
if ($bgcolor === 'transparent') {
[6138] Fix | Delete
$bgcolor = 'rgba(255, 255, 255, 0.0)';
[6139] Fix | Delete
}
[6140] Fix | Delete
$ani = ($img->getNumberImages() > 1);
[6141] Fix | Delete
if ($ani && is_null($destformat)) {
[6142] Fix | Delete
$img1 = new Imagick();
[6143] Fix | Delete
$img1->setFormat('gif');
[6144] Fix | Delete
$img = $img->coalesceImages();
[6145] Fix | Delete
do {
[6146] Fix | Delete
$gif = new Imagick();
[6147] Fix | Delete
$gif->newImage($width, $height, new ImagickPixel($bgcolor));
[6148] Fix | Delete
$gif->setImageColorspace($img->getImageColorspace());
[6149] Fix | Delete
$gif->setImageFormat('gif');
[6150] Fix | Delete
$gif->compositeImage($img, imagick::COMPOSITE_OVER, $x, $y);
[6151] Fix | Delete
$gif->setImageDelay($img->getImageDelay());
[6152] Fix | Delete
$gif->setImageIterations($img->getImageIterations());
[6153] Fix | Delete
$img1->addImage($gif);
[6154] Fix | Delete
$gif->clear();
[6155] Fix | Delete
} while ($img->nextImage());
[6156] Fix | Delete
$img1->optimizeImageLayers();
[6157] Fix | Delete
$result = $img1->writeImages($path, true);
[6158] Fix | Delete
} else {
[6159] Fix | Delete
if ($ani) {
[6160] Fix | Delete
$img->setFirstIterator();
[6161] Fix | Delete
}
[6162] Fix | Delete
$img1 = new Imagick();
[6163] Fix | Delete
$img1->newImage($width, $height, new ImagickPixel($bgcolor));
[6164] Fix | Delete
$img1->setImageColorspace($img->getImageColorspace());
[6165] Fix | Delete
$img1->compositeImage($img, imagick::COMPOSITE_OVER, $x, $y);
[6166] Fix | Delete
$result = $this->imagickImage($img1, $path, $destformat, $jpgQuality);
[6167] Fix | Delete
}
[6168] Fix | Delete
[6169] Fix | Delete
$img1->clear();
[6170] Fix | Delete
$img->clear();
[6171] Fix | Delete
return $result ? $path : false;
[6172] Fix | Delete
[6173] Fix | Delete
break;
[6174] Fix | Delete
[6175] Fix | Delete
case 'convert':
[6176] Fix | Delete
extract($this->imageMagickConvertPrepare($path, $destformat, $jpgQuality, $s));
[6177] Fix | Delete
/**
[6178] Fix | Delete
* @var string $ani
[6179] Fix | Delete
* @var string $index
[6180] Fix | Delete
* @var string $coalesce
[6181] Fix | Delete
* @var string $deconstruct
[6182] Fix | Delete
* @var string $jpgQuality
[6183] Fix | Delete
* @var string $quotedPath
[6184] Fix | Delete
* @var string $quotedDstPath
[6185] Fix | Delete
* @var string $interlace
[6186] Fix | Delete
*/
[6187] Fix | Delete
if ($bgcolor === 'transparent') {
[6188] Fix | Delete
$bgcolor = 'rgba(255, 255, 255, 0.0)';
[6189] Fix | Delete
}
[6190] Fix | Delete
$cmd = sprintf('%s -size %dx%d "xc:%s" png:- | convert%s%s%s png:- %s -geometry +%d+%d -compose over -composite%s %s', ELFINDER_CONVERT_PATH, $width, $height, $bgcolor, $coalesce, $jpgQuality, $interlace, $quotedPath, $x, $y, $deconstruct, $quotedDstPath);
[6191] Fix | Delete
[6192] Fix | Delete
$result = false;
[6193] Fix | Delete
if ($this->procExec($cmd) === 0) {
[6194] Fix | Delete
$result = true;
[6195] Fix | Delete
}
[6196] Fix | Delete
return $result ? $path : false;
[6197] Fix | Delete
[6198] Fix | Delete
break;
[6199] Fix | Delete
[6200] Fix | Delete
case 'gd':
[6201] Fix | Delete
elFinder::expandMemoryForGD(array($s, array($width, $height)));
[6202] Fix | Delete
$img = $this->gdImageCreate($path, $s['mime']);
[6203] Fix | Delete
[6204] Fix | Delete
if ($img && false != ($tmp = imagecreatetruecolor($width, $height))) {
[6205] Fix | Delete
[6206] Fix | Delete
$this->gdImageBackground($tmp, $bgcolor);
[6207] Fix | Delete
if ($bgcolor === 'transparent' && ($destformat === 'png' || $s[2] === IMAGETYPE_PNG)) {
[6208] Fix | Delete
$bgNum = imagecolorallocatealpha($tmp, 255, 255, 255, 127);
[6209] Fix | Delete
imagefill($tmp, 0, 0, $bgNum);
[6210] Fix | Delete
}
[6211] Fix | Delete
[6212] Fix | Delete
if (!imagecopy($tmp, $img, $x, $y, 0, 0, $s[0], $s[1])) {
[6213] Fix | Delete
return false;
[6214] Fix | Delete
}
[6215] Fix | Delete
[6216] Fix | Delete
$result = $this->gdImage($tmp, $path, $destformat, $s['mime'], $jpgQuality);
[6217] Fix | Delete
[6218] Fix | Delete
imagedestroy($img);
[6219] Fix | Delete
imagedestroy($tmp);
[6220] Fix | Delete
[6221] Fix | Delete
return $result ? $path : false;
[6222] Fix | Delete
}
[6223] Fix | Delete
break;
[6224] Fix | Delete
}
[6225] Fix | Delete
[6226] Fix | Delete
return false;
[6227] Fix | Delete
}
[6228] Fix | Delete
[6229] Fix | Delete
/**
[6230] Fix | Delete
* Rotate image
[6231] Fix | Delete
*
[6232] Fix | Delete
* @param string $path image file
[6233] Fix | Delete
* @param int $degree rotete degrees
[6234] Fix | Delete
* @param string $bgcolor square background color in #rrggbb format
[6235] Fix | Delete
* @param string $destformat image destination format
[6236] Fix | Delete
* @param int $jpgQuality JEPG quality (1-100)
[6237] Fix | Delete
*
[6238] Fix | Delete
* @return string|false
[6239] Fix | Delete
* @throws elFinderAbortException
[6240] Fix | Delete
* @author nao-pon
[6241] Fix | Delete
* @author Troex Nevelin
[6242] Fix | Delete
*/
[6243] Fix | Delete
protected function imgRotate($path, $degree, $bgcolor = '#ffffff', $destformat = null, $jpgQuality = null)
[6244] Fix | Delete
{
[6245] Fix | Delete
if (($s = getimagesize($path)) == false || $degree % 360 === 0) {
[6246] Fix | Delete
return false;
[6247] Fix | Delete
}
[6248] Fix | Delete
[6249] Fix | Delete
$result = false;
[6250] Fix | Delete
[6251] Fix | Delete
// try lossless rotate
[6252] Fix | Delete
if ($degree % 90 === 0 && in_array($s[2], array(IMAGETYPE_JPEG, IMAGETYPE_JPEG2000))) {
[6253] Fix | Delete
$count = ($degree / 90) % 4;
[6254] Fix | Delete
$exiftran = array(
[6255] Fix | Delete
1 => '-9',
[6256] Fix | Delete
2 => '-1',
[6257] Fix | Delete
3 => '-2'
[6258] Fix | Delete
);
[6259] Fix | Delete
$jpegtran = array(
[6260] Fix | Delete
1 => '90',
[6261] Fix | Delete
2 => '180',
[6262] Fix | Delete
3 => '270'
[6263] Fix | Delete
);
[6264] Fix | Delete
$quotedPath = escapeshellarg($path);
[6265] Fix | Delete
$cmds = array();
[6266] Fix | Delete
if ($this->procExec(ELFINDER_EXIFTRAN_PATH . ' -h') === 0) {
[6267] Fix | Delete
$cmds[] = ELFINDER_EXIFTRAN_PATH . ' -i ' . $exiftran[$count] . ' -- ' . $quotedPath;
[6268] Fix | Delete
}
[6269] Fix | Delete
if ($this->procExec(ELFINDER_JPEGTRAN_PATH . ' -version') === 0) {
[6270] Fix | Delete
$cmds[] = ELFINDER_JPEGTRAN_PATH . ' -rotate ' . $jpegtran[$count] . ' -copy all -outfile ' . $quotedPath . ' -- ' . $quotedPath;
[6271] Fix | Delete
}
[6272] Fix | Delete
foreach ($cmds as $cmd) {
[6273] Fix | Delete
if ($this->procExec($cmd) === 0) {
[6274] Fix | Delete
$result = true;
[6275] Fix | Delete
break;
[6276] Fix | Delete
}
[6277] Fix | Delete
}
[6278] Fix | Delete
if ($result) {
[6279] Fix | Delete
return $path;
[6280] Fix | Delete
}
[6281] Fix | Delete
}
[6282] Fix | Delete
[6283] Fix | Delete
if (!$jpgQuality) {
[6284] Fix | Delete
$jpgQuality = $this->options['jpgQuality'];
[6285] Fix | Delete
}
[6286] Fix | Delete
[6287] Fix | Delete
elFinder::extendTimeLimit(300);
[6288] Fix | Delete
switch ($this->imgLib) {
[6289] Fix | Delete
case 'imagick':
[6290] Fix | Delete
try {
[6291] Fix | Delete
$img = new imagick($path);
[6292] Fix | Delete
} catch (Exception $e) {
[6293] Fix | Delete
return false;
[6294] Fix | Delete
}
[6295] Fix | Delete
[6296] Fix | Delete
if ($s[2] === IMAGETYPE_GIF || $s[2] === IMAGETYPE_PNG) {
[6297] Fix | Delete
$bgcolor = 'rgba(255, 255, 255, 0.0)';
[6298] Fix | Delete
}
[6299] Fix | Delete
if ($img->getNumberImages() > 1) {
[6300] Fix | Delete
$img = $img->coalesceImages();
[6301] Fix | Delete
do {
[6302] Fix | Delete
$img->rotateImage(new ImagickPixel($bgcolor), $degree);
[6303] Fix | Delete
} while ($img->nextImage());
[6304] Fix | Delete
$img->optimizeImageLayers();
[6305] Fix | Delete
$result = $img->writeImages($path, true);
[6306] Fix | Delete
} else {
[6307] Fix | Delete
$img->rotateImage(new ImagickPixel($bgcolor), $degree);
[6308] Fix | Delete
$result = $this->imagickImage($img, $path, $destformat, $jpgQuality);
[6309] Fix | Delete
}
[6310] Fix | Delete
$img->clear();
[6311] Fix | Delete
return $result ? $path : false;
[6312] Fix | Delete
[6313] Fix | Delete
break;
[6314] Fix | Delete
[6315] Fix | Delete
case 'convert':
[6316] Fix | Delete
extract($this->imageMagickConvertPrepare($path, $destformat, $jpgQuality, $s));
[6317] Fix | Delete
/**
[6318] Fix | Delete
* @var string $ani
[6319] Fix | Delete
* @var string $index
[6320] Fix | Delete
* @var string $coalesce
[6321] Fix | Delete
* @var string $deconstruct
[6322] Fix | Delete
* @var string $jpgQuality
[6323] Fix | Delete
* @var string $quotedPath
[6324] Fix | Delete
* @var string $quotedDstPath
[6325] Fix | Delete
* @var string $interlace
[6326] Fix | Delete
*/
[6327] Fix | Delete
if ($s[2] === IMAGETYPE_GIF || $s[2] === IMAGETYPE_PNG) {
[6328] Fix | Delete
$bgcolor = 'rgba(255, 255, 255, 0.0)';
[6329] Fix | Delete
}
[6330] Fix | Delete
$cmd = sprintf('%s%s%s%s -background "%s" -rotate %d%s -- %s %s', ELFINDER_CONVERT_PATH, $coalesce, $jpgQuality, $interlace, $bgcolor, $degree, $deconstruct, $quotedPath, $quotedDstPath);
[6331] Fix | Delete
[6332] Fix | Delete
$result = false;
[6333] Fix | Delete
if ($this->procExec($cmd) === 0) {
[6334] Fix | Delete
$result = true;
[6335] Fix | Delete
}
[6336] Fix | Delete
return $result ? $path : false;
[6337] Fix | Delete
[6338] Fix | Delete
break;
[6339] Fix | Delete
[6340] Fix | Delete
case 'gd':
[6341] Fix | Delete
elFinder::expandMemoryForGD(array($s, $s));
[6342] Fix | Delete
$img = $this->gdImageCreate($path, $s['mime']);
[6343] Fix | Delete
[6344] Fix | Delete
$degree = 360 - $degree;
[6345] Fix | Delete
[6346] Fix | Delete
$bgNum = -1;
[6347] Fix | Delete
$bgIdx = false;
[6348] Fix | Delete
if ($s[2] === IMAGETYPE_GIF) {
[6349] Fix | Delete
$bgIdx = imagecolortransparent($img);
[6350] Fix | Delete
if ($bgIdx !== -1) {
[6351] Fix | Delete
$c = imagecolorsforindex($img, $bgIdx);
[6352] Fix | Delete
$w = imagesx($img);
[6353] Fix | Delete
$h = imagesy($img);
[6354] Fix | Delete
$newImg = imagecreatetruecolor($w, $h);
[6355] Fix | Delete
imagepalettecopy($newImg, $img);
[6356] Fix | Delete
$bgNum = imagecolorallocate($newImg, $c['red'], $c['green'], $c['blue']);
[6357] Fix | Delete
imagefill($newImg, 0, 0, $bgNum);
[6358] Fix | Delete
imagecolortransparent($newImg, $bgNum);
[6359] Fix | Delete
imagecopy($newImg, $img, 0, 0, 0, 0, $w, $h);
[6360] Fix | Delete
imagedestroy($img);
[6361] Fix | Delete
$img = $newImg;
[6362] Fix | Delete
$newImg = null;
[6363] Fix | Delete
}
[6364] Fix | Delete
} else if ($s[2] === IMAGETYPE_PNG) {
[6365] Fix | Delete
$bgNum = imagecolorallocatealpha($img, 255, 255, 255, 127);
[6366] Fix | Delete
}
[6367] Fix | Delete
if ($bgNum === -1) {
[6368] Fix | Delete
list($r, $g, $b) = sscanf($bgcolor, "#%02x%02x%02x");
[6369] Fix | Delete
$bgNum = imagecolorallocate($img, $r, $g, $b);
[6370] Fix | Delete
}
[6371] Fix | Delete
[6372] Fix | Delete
$tmp = imageRotate($img, $degree, $bgNum);
[6373] Fix | Delete
if ($bgIdx !== -1) {
[6374] Fix | Delete
imagecolortransparent($tmp, $bgNum);
[6375] Fix | Delete
}
[6376] Fix | Delete
[6377] Fix | Delete
$result = $this->gdImage($tmp, $path, $destformat, $s['mime'], $jpgQuality);
[6378] Fix | Delete
[6379] Fix | Delete
imageDestroy($img);
[6380] Fix | Delete
imageDestroy($tmp);
[6381] Fix | Delete
[6382] Fix | Delete
return $result ? $path : false;
[6383] Fix | Delete
[6384] Fix | Delete
break;
[6385] Fix | Delete
}
[6386] Fix | Delete
[6387] Fix | Delete
return false;
[6388] Fix | Delete
}
[6389] Fix | Delete
[6390] Fix | Delete
/**
[6391] Fix | Delete
* Execute shell command
[6392] Fix | Delete
*
[6393] Fix | Delete
* @param string $command command line
[6394] Fix | Delete
* @param string $output stdout strings
[6395] Fix | Delete
* @param int $return_var process exit code
[6396] Fix | Delete
* @param string $error_output stderr strings
[6397] Fix | Delete
*
[6398] Fix | Delete
* @return int exit code
[6399] Fix | Delete
* @throws elFinderAbortException
[6400] Fix | Delete
* @author Alexey Sukhotin
[6401] Fix | Delete
*/
[6402] Fix | Delete
protected function procExec($command, &$output = '', &$return_var = -1, &$error_output = '', $cwd = null)
[6403] Fix | Delete
{
[6404] Fix | Delete
return elFinder::procExec($command, $output, $return_var, $error_output);
[6405] Fix | Delete
}
[6406] Fix | Delete
[6407] Fix | Delete
/**
[6408] Fix | Delete
* Remove thumbnail, also remove recursively if stat is directory
[6409] Fix | Delete
*
[6410] Fix | Delete
* @param array $stat file stat
[6411] Fix | Delete
*
[6412] Fix | Delete
* @return void
[6413] Fix | Delete
* @throws elFinderAbortException
[6414] Fix | Delete
* @author Dmitry (dio) Levashov
[6415] Fix | Delete
* @author Naoki Sawada
[6416] Fix | Delete
* @author Troex Nevelin
[6417] Fix | Delete
*/
[6418] Fix | Delete
protected function rmTmb($stat)
[6419] Fix | Delete
{
[6420] Fix | Delete
if ($this->tmbPathWritable) {
[6421] Fix | Delete
if ($stat['mime'] === 'directory') {
[6422] Fix | Delete
foreach ($this->scandirCE($this->decode($stat['hash'])) as $p) {
[6423] Fix | Delete
elFinder::extendTimeLimit(30);
[6424] Fix | Delete
$name = $this->basenameCE($p);
[6425] Fix | Delete
$name != '.' && $name != '..' && $this->rmTmb($this->stat($p));
[6426] Fix | Delete
}
[6427] Fix | Delete
} else if (!empty($stat['tmb']) && $stat['tmb'] != "1") {
[6428] Fix | Delete
$tmb = $this->tmbPath . DIRECTORY_SEPARATOR . rawurldecode($stat['tmb']);
[6429] Fix | Delete
file_exists($tmb) && unlink($tmb);
[6430] Fix | Delete
clearstatcache();
[6431] Fix | Delete
}
[6432] Fix | Delete
}
[6433] Fix | Delete
}
[6434] Fix | Delete
[6435] Fix | Delete
/**
[6436] Fix | Delete
* Create an gd image according to the specified mime type
[6437] Fix | Delete
*
[6438] Fix | Delete
* @param string $path image file
[6439] Fix | Delete
* @param string $mime
[6440] Fix | Delete
*
[6441] Fix | Delete
* @return resource|false GD image resource identifier
[6442] Fix | Delete
*/
[6443] Fix | Delete
protected function gdImageCreate($path, $mime)
[6444] Fix | Delete
{
[6445] Fix | Delete
switch ($mime) {
[6446] Fix | Delete
case 'image/jpeg':
[6447] Fix | Delete
return imagecreatefromjpeg($path);
[6448] Fix | Delete
[6449] Fix | Delete
case 'image/png':
[6450] Fix | Delete
return imagecreatefrompng($path);
[6451] Fix | Delete
[6452] Fix | Delete
case 'image/gif':
[6453] Fix | Delete
return imagecreatefromgif($path);
[6454] Fix | Delete
[6455] Fix | Delete
case 'image/x-ms-bmp':
[6456] Fix | Delete
if (!function_exists('imagecreatefrombmp')) {
[6457] Fix | Delete
include_once dirname(__FILE__) . '/libs/GdBmp.php';
[6458] Fix | Delete
}
[6459] Fix | Delete
return imagecreatefrombmp($path);
[6460] Fix | Delete
[6461] Fix | Delete
case 'image/xbm':
[6462] Fix | Delete
return imagecreatefromxbm($path);
[6463] Fix | Delete
[6464] Fix | Delete
case 'image/xpm':
[6465] Fix | Delete
return imagecreatefromxpm($path);
[6466] Fix | Delete
[6467] Fix | Delete
case 'image/webp':
[6468] Fix | Delete
return imagecreatefromwebp($path);
[6469] Fix | Delete
}
[6470] Fix | Delete
return false;
[6471] Fix | Delete
}
[6472] Fix | Delete
[6473] Fix | Delete
/**
[6474] Fix | Delete
* Output gd image to file
[6475] Fix | Delete
*
[6476] Fix | Delete
* @param resource $image gd image resource
[6477] Fix | Delete
* @param string $filename The path to save the file to.
[6478] Fix | Delete
* @param string $destformat The Image type to use for $filename
[6479] Fix | Delete
* @param string $mime The original image mime type
[6480] Fix | Delete
* @param int $jpgQuality JEPG quality (1-100)
[6481] Fix | Delete
*
[6482] Fix | Delete
* @return bool
[6483] Fix | Delete
*/
[6484] Fix | Delete
protected function gdImage($image, $filename, $destformat, $mime, $jpgQuality = null)
[6485] Fix | Delete
{
[6486] Fix | Delete
[6487] Fix | Delete
if (!$jpgQuality) {
[6488] Fix | Delete
$jpgQuality = $this->options['jpgQuality'];
[6489] Fix | Delete
}
[6490] Fix | Delete
if ($destformat) {
[6491] Fix | Delete
switch ($destformat) {
[6492] Fix | Delete
case 'jpg':
[6493] Fix | Delete
$mime = 'image/jpeg';
[6494] Fix | Delete
break;
[6495] Fix | Delete
case 'gif':
[6496] Fix | Delete
$mime = 'image/gif';
[6497] Fix | Delete
break;
[6498] Fix | Delete
case 'png':
[6499] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function