mirror of
https://github.com/Studio-42/elFinder
synced 2026-06-08 12:37:09 +00:00
[api] add optional query (int)'substitute' to command dim
The connector can return the URL of the substitute image whose size will fit in that pixel as the value of the key 'url' of the result data when the 'substitute' parameter gives with `dim` command from the client. Add the following two options on the client side config `commandsOptions.resize` to fixes #2251. ```javascript // File size (bytes) threshold when using the `dim` command for obtain the image size necessary to start editing getDimThreshold : 204800, // File size (bytes) to request to get substitute image (400px) with the `dim` command dimSubImgSize : 307200 ```
This commit is contained in:
@@ -1381,7 +1381,11 @@ class elFinderVolumeBox extends elFinderVolumeDriver
|
||||
if ($size = @getimagesize($work)) {
|
||||
$cache['width'] = $size[0];
|
||||
$cache['height'] = $size[1];
|
||||
$ret = $size[0].'x'.$size[1];
|
||||
$ret = array('dim' => $size[0].'x'.$size[1]);
|
||||
$srcfp = fopen($work, 'rb');
|
||||
if ($subImgLink = $this->getSubstituteImgLink(elFinder::$currentArgs['target'], $size, $srcfp)) {
|
||||
$ret['url'] = $subImgLink;
|
||||
}
|
||||
}
|
||||
}
|
||||
is_file($work) && @unlink($work);
|
||||
|
||||
Reference in New Issue
Block a user