问题
I've been using ckeditor4 for ages in my custom CMS and I've just integrated ckfinder3 so I can use drag & drop image uploading via ckeditor4. Everything is working properly and I have it resizing images upon upload (set in ckfinder/config.php) - all good.
My issue is I want it to create a thumbnail of the image too, as it did in the past (I've been using an earlier version of ckfinder). They used to be uploaded to userfiles/_thumbs/images/ but now it doesn't seem to do it.
I have a few custom bits set up for my editor such as a custom config file and custom contents.css but they shouldn't have any effect on this. My editor code from within my CMS is below, all pretty straightforward stuff and it all works except for the fact that uploading images using drag & drop doesn't create a thumbnail too.
A point to note that if clicking on the 'image' button on the ckeditor toolbar, then uploading the usual way - browse server/upload etc, the system does create a thumbnail and places it in the folder here: userfiles/.ckfinder/cache/thumbs/images/theUploadedImage/theUploadedImage.jpg
Any pointers would be gratefully received. I hope this makes sense! Thanks
<textarea name="blog_text"></textarea>
<script>
CKEDITOR.replace( 'blog_text', {
customConfig: 'mycustomfolder/myconfig.js',
contentsCss: CKEDITOR.getUrl( 'mycustomfolder/mycontents.css' ),
filebrowserBrowseUrl: 'ckfinder3.4.5/ckfinder.html',
filebrowserImageBrowseUrl: 'ckfinder3.4.5/ckfinder.html?type=Images',
filebrowserUploadUrl: 'ckfinder3.4.5/core/connector/php/connector.php?command=QuickUpload&type=Files',
filebrowserImageUploadUrl: 'ckfinder3.4.5/core/connector/php/connector.php?command=QuickUpload&type=Images'
} );
</script>
回答1:
The paths and the methods of creating them were chnaged in CKFinder 3. Assuming that you are using default configuration, all thumbnails are being created inside /userfiles/.ckfinder/cache/thumbs/
folder and are on CKFinder private use only. They actually were for private use in CKF 2.x as well but users liked to abuse that.
Thumbnails get also created if you use, available in Popup and CKEditor integrations, "Choose Scaled" option. In that case scaled image gets created inside /MainFilesFolder/resourceTypeFolder/__thumbs/NameOfImage.extension/NameOfImage__widthxheight.extension
e.g. /userfiles/images/__thumbs/Students.jpg/Students__480x320.jpg
.
You can somewhat change the location of private directory through https://ckeditor.com/docs/ckfinder/ckfinder3-php/configuration.html#configuration_options_privateDir but please note that end of path resourceTypeName/theUploadedImage/theUploadedImage.jpg
will not change.
There is also a simple plugin available online which allows generating thumbs on file upload. Perhaps this is something that might suit you or something that can be used as a jump start to create your own custom plugin: https://gist.github.com/zaak/7bb61025bfd9d3a6633029b0b4b087f9.
来源:https://stackoverflow.com/questions/54987848/ckfinder-3-4-5-does-it-still-create-thumbnails-upon-upload