Ckeditor property for resizing an image

Is there any property in ckeditor that will resize the image after loading into the specified dimension. for example: if the user uploads an image of 1000*1000 px and does not change its size, this could be a mass kill. Since I save and display on the same page without updating using ajax. All I want is to automatically resize the image when loading from ckeditor. Also, is there a way that I can find using jquery, is there any image in the text saved by the user, since the user may or cannot load the image, I use inplace ckeditor.

0
source share
1 answer

CKFinder is an excellent companion for CKEditor and allows you to set the maximum size of the loaded image in the configuration .

If you do not want to use this, you yourself will resize the image to PHP using the following:

 <?php $maxWidth = 250; $maxHeight = 500; $size = getimagesize($url); if ($size) { $imageWidth = $size[0]; $imageHeight = $size[1]; $wRatio = $imageWidth / $maxWidth; $hRatio = $imageHeight / $maxHeight; $maxRatio = max($wRatio, $hRatio); if ($maxRatio > 1) { $outputWidth = $imageWidth / $maxRatio; $outputHeight = $imageHeight / $maxRatio; } else { $outputWidth = $imageWidth; $outputHeight = $imageHeight; } } ?> 

From: Arbitrary image resizing in PHP

+1
source

Source: https://habr.com/ru/post/1440459/


All Articles