Welcome to the Question2Answer Q&A. There's also a demo if you just want to try it out.

Update Plugin: Image Resize (V1.1)

+3 votes
asked Mar 8, 2013 in Plugins by sama55
edited Feb 21, 2015 by sama55

This plugin resize image uploaded by CKEditor compulsorily. Refer to readme in download-file for detailed usage.



Why this plugin is needs:

Although Q2A can restrict uploads by capacity, it is troublesome to resize high resolution photograph, such as digital camera. Also, It is effective in arranging with same size picture from which size is different. Q2A saves upload-file to DB(blob). Compression of picture prevents hypertrophy of DB. 

Caution / Restriction

Hack of WYSIWYG Editor plugin is required for this plug-in. 

Best regards.

Q2A version: 1.6, 1.7
commented Apr 29, 2013 by noname
on the local machine works well on a dedicated server is not running. in what could be the problem?
commented Apr 29, 2013 by sama55
Is error message displayed on the file path of upload dialog?
commented Apr 29, 2013 by noname
no errors on the site. uploaded picture is not visible. Table qa_blobs image BLOB - 0 Bytes. most likely need to set permissions on files
commented Apr 29, 2013 by sama55

Replace copy() line of qa-wysiwyg-upload.php to below.
$copied = copy($oldfile, $newfile);
if (!$copied) {
    echo 'Copy error occurred!';

3 Answers

0 votes
answered Jan 3, 2014 by Donna111

Hi there

Thanks for your nice sharing.I am looking for a powerful image processing tool which supports to resize image directly.

I have installed another image tool before.It can only zoom image.I want to know that if there is a free trial for new users.

thanks a lot.

+2 votes
answered Feb 21, 2015 by delstone
I've searched qa-wysiwyg-upload.php for the line to be modified but it does not appear in there - any thoughts?

                    $blobid=qa_db_blob_create(file_get_contents($file['tmp_name']), $extension, @$file['name'], $userid, $cookieid, qa_remote_ip_address());

This is the entire file:

class qa_wysiwyg_upload
    public function match_request($request)
        return ($request == 'wysiwyg-editor-upload');

    public function process_request($request)
        $message = '';
        $url = '';

        if (is_array($_FILES) && count($_FILES)) {
            if (!qa_opt('wysiwyg_editor_upload_images'))
                $message = qa_lang('users/no_permission');

            require_once QA_INCLUDE_DIR.'app/upload.php';

            $upload = qa_upload_file_one(
                qa_get('qa_only_image') || !qa_opt('wysiwyg_editor_upload_all'),
                qa_get('qa_only_image') ? 600 : null, // max width if it's an image upload
                null // no max height

            $message = @$upload['error'];
            $url = @$upload['bloburl'];

        echo "<script>window.parent.CKEDITOR.tools.callFunction(".qa_js(qa_get('CKEditorFuncNum')).
            ", ".qa_js($url).", ".qa_js($message).");</script>";

        return null;
commented Feb 21, 2015 by sama55
edited Feb 21, 2015 by sama55
This plugin (hack) is very old. Upload logic of editor was changed largely in Q2A V1.6. Logic of Q2A also seems to have become a little intelligent. Anyway, there is a need to remake plugin.

Does this plugin is still necessary for you (Q2A)?
It is because width is hard-coded to 600 pixels?
commented Feb 21, 2015 by sama55
I updated plugin. Re-download and refer to hack.txt.
0 votes
answered Oct 22, 2015 by Victor Ballesteros M
I can not download the plugin, broken link