Reputation: 430
In ckeditor ( with ckfinder )
I can upload image normally, but it won't create thumbnail before I click the "Browser Server" button, which means I have to use the browse server function to make it create thumbnail manually.
Is there any way ( PHP ) to define creating thumbnail automatically after I upload image?
Upvotes: 3
Views: 2928
Reputation: 430
Finally i have figured it out and tested the code works fine.
Find the file in ckfinder ckfinder/core/connector/php/php5/CommandHandler/FileUpload.php
look for the code and change
if($_imagesConfig->getMaxWidth()>0&&$_imagesConfig->getMaxHeight()>0&&$_imagesConfig->getQuality()>0){
CKFinder_Connector_CommandHandler_Thumbnail::createThumb($sFilePath, $sFilePath, $_imagesConfig->getMaxWidth(), $_imagesConfig->getMaxHeight(), $_imagesConfig->getQuality(), true);
}
to
if($_imagesConfig->getMaxWidth()>0&&$_imagesConfig->getMaxHeight()>0&&$_imagesConfig->getQuality()>0){
CKFinder_Connector_CommandHandler_Thumbnail::createThumb($sFilePath, $sFilePath, $_imagesConfig->getMaxWidth(), $_imagesConfig->getMaxHeight(), $_imagesConfig->getQuality(), true);
$_thumbnails=$_config->getThumbnailsConfig();
$thumbFilePath=$sServerDir.'_thumbs/Images/'.$sFileName;
CKFinder_Connector_CommandHandler_Thumbnail::createThumb($sFilePath, $thumbFilePath, $_thumbnails->getMaxWidth(), $_thumbnails->getMaxHeight(), $_thumbnails->getQuality(), true, $_thumbnails->getBmpSupported());
}
and then it will create thumb file everytime you finish uploading image.
Upvotes: 1