We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
i follow this link (i use laravel) and i use last version el-finder #1331 but not work !!
please see this config file for laravel elfinder https://github.com/barryvdh/laravel-elfinder/blob/master/config/elfinder.php
it have 'options' i use it for bind
'options' => array( 'bind' => array( 'upload.presave' => array('Plugin.AutoResize.onUpLoadPreSave'), 'upload resize' => array(new App\genResize, 'smallImage'), ), 'plugin' => array( 'AutoResize' => array( 'enable' => true, 'maxWidth' => 800, 'quality' => 95 ) ), ),
and this my class
<?php namespace App; class genResize { function smallImage($cmd, $result, $args, $elfinder, $volume) { // make image maxsize $maxWidth = 300; $maxHeight = 300; $jpgQuality = 70; $smallsDir = public_path('files/.smallSize') ; if ($volume && $result && isset($result['added'])) { foreach($result['added'] as $item) { if ($file = $volume->file($item['hash'])) { $path = $volume->getPath($item['hash']); if (strpos($file['mime'], 'image/') === 0 && ($srcImgInfo = @getimagesize($path))) { $zoom = min(($maxWidth/$srcImgInfo[0]),($maxHeight/$srcImgInfo[1])); $width = round($srcImgInfo[0] * $zoom); $height = round($srcImgInfo[1] * $zoom); $tfp = tmpfile(); $info = stream_get_meta_data($tfp); $temp = $info['uri']; if ($src = fopen($path, 'rb')) { stream_copy_to_stream($src, $tfp); fclose($src); if ($volume->imageUtil('resize', $temp, compact('width', 'height', 'jpgQuality'))) { @copy($temp, $smallsDir . '/' . $file['name']); } } } } } } } }
but $volume is null and cant run continue ..
if ($volume->imageUtil('resize', $temp, compact('width', 'height', 'jpgQuality'))) { @copy($temp, $smallsDir . '/' . $file['name']); }
The text was updated successfully, but these errors were encountered:
@vahidalvandi I tested with the standalone elFinder. $volume can be obtained correctly. You can also check out the standalone elFinder.
$volume
Sorry, something went wrong.
i tested it in laravel
how i can copy resize in another folder with same folder structure ?? my code copy it in root .small folder !
please show full document create and resize in another path also change and remove from src image
@vahidalvandi The code is copied with PHP's copy function so copy it wherever you want.
No branches or pull requests
i follow this link (i use laravel) and i use last version el-finder
#1331
but not work !!
please see this config file for laravel elfinder
https://github.com/barryvdh/laravel-elfinder/blob/master/config/elfinder.php
it have 'options' i use it for bind
and this my class
but $volume is null and cant run continue ..
The text was updated successfully, but these errors were encountered: