Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Try Vanilla Forums Cloud product
Vanilla 2.6.1 is here with critical security patches. One of them has been publicly disclosed.

resize image before upload ?

hi,

the editor support this function ?

or is possible resize image after upload ...

not sur the function work :

$Configuration['Garden']['Thumbnail']['Size'] = '40';
$Configuration['Garden']['UploadImage']['Quality'] = '50';

exemple :
http://fandacia.wit-creations.biz/fofo/index.php?p=/discussion/54/quelques-ameliorations-de-finition-de-ma-stepway#latest

i think is possible whit editor because on the files JS , have size and quality, but i don't know how to this work.

can you help me please ?

thank you

Comments

  • vrijvlindervrijvlinder Papillon-Sauvage MVP

    Just limit the megabytes that people are allowed to upload. If what they are trying to upload surpasses the limit they will get a warning and will no longer be able to upload a file of that size.

  • vrijvlindervrijvlinder Papillon-Sauvage MVP

    If weight of the file is of no concequence, then I suggest you use CSS on your theme to control the dimensions of images in posts. Size is diferent than dimensions . Size applies to weight in megabytes . Dimensions applies to width and length .

  • hi, thank for reply.

    is not possible for me, limite upload size, many user is beginner

    on the jquerry_file_upload.js , i find this function :

        {
            action: 'resizeImage',
            // Use "image" as prefix for the "@" options:
            prefix: 'image',
            maxWidth: '@',
            maxHeight: '@',
            minWidth: '@',
            minHeight: '@',
            crop: '@',
            orientation: '@',
            forceResize: '@',
            disabled: '@disableImageResize'
        },
        {
            action: 'saveImage',
            quality: '@imageQuality',
            type: '@imageType',
            disabled: '@disableImageResize'
        },
    

    is not possible ?

  • vrijvlindervrijvlinder Papillon-Sauvage MVP

    You don’t understand . Width and height are dimensions . You can add CSS to control their dimensions. Weight in megabytes you can control by limiting how heavy the file is by using a configuration to limit heavy files automatically . If you think your users are too stupid to not understand they can’t upload big files, you must teach them or get better hosting instead of free ...

  • phreakphreak VanillaAPP - White label iOS and Android App MVP
    edited January 29

    I don‘t see a reason to be so aggressive towards this question. Uses are not stupid just because the want to enjoy the comfort of a fast loading forum. Vanilla has a weakness in the spot of file uploads. The option to programmatically resize uploads makes sense in all cases I know of. On the client side through HTML canvas on upload and for smaller file sizes on downloads (reading forums) and on the server side regarding less space, less use, etc.

    @oneil4: Don‘t wonder that you get these kinds of comments. Your question is totally legimitate and many other tools provide an out of the box solution to this. Vanilla does not, yet.

    vrijvlinderrbrahmson
  • rbrahmsonrbrahmson "You may say I'm a dreamer / But I'm not the only one" NY ✭✭✭

    I second @phreak - a server side size reducing functionality make sense. I think it is unlikely to be developed by the Vanilla team, so it has to be a plug in (haven't researched it).

  • sorry, my english is bad :/

    is possible or not possible ? whit the editor plugin ?

  • vrijvlindervrijvlinder Papillon-Sauvage MVP

    @oneil4 said:
    sorry, my english is bad :/

    is possible or not possible ? whit the editor plugin ?

    Not possible.

  • aside from the advantages of resizing discussed.

    the cons of image resizing - much of the resizing functions actually produce a larger file because they are not optimized, so you do not solve your problem. the second problem is performance and the third problem is you may exhaust memory during the process.

    Pragmatism is all I have to offer. Avoiding the sidelines and providing centerline pro-tips.

  • rbrahmsonrbrahmson "You may say I'm a dreamer / But I'm not the only one" NY ✭✭✭

    I presume that if an image resizing (let's call it compression for that is what it really is) is implemented, the developer will pick an algorytm that does not increase the size... As for performance, there will certainly be some impact, but I think that it won't be that large -- at any given moment only a small portion of a forum perform an image (and of course the compression could be done during the actual discussion/comment save rather than at upload time).

    The above is just musing -- I am not going to implement this.

  • one problem for me, for exemple ( sorry for my english ^^ )

    the user upload picture portrait ( not landscape )
    the size on computer is 3mo, and after upload, the size on the server is 6 MO.... WTF

    dont understande why , i think the upload module is capable resize or modify quality, but is bad configured ..

    don't know why

    Germont
  • RiverRiver MVP
    edited February 1

    @oneil4 said:
    one problem for me, for exemple ( sorry for my english ^^ )

    the user upload picture portrait ( not landscape )
    the size on computer is 3mo, and after upload, the size on the server is 6 MO.... WTF

    dont understande why , i think the upload module is capable resize or modify quality, but is bad configured ..

    don't know why

    it's often hard to convince people that the general php functions often create larger files with a resize and a quality change, or an orientation change. It is just not up to the task of compression coupled with scaling. Just because you scale does not guarantee reduced file size and each image dimensions may be smaller or bigger in file size depending on scale reduction, quality etc.

    original photos from camera are optimized file size for the scale. changing the scale via general php functions (and most likely js) often results in LARGER file size.

    you may do better with an optimizer that has suitable compression. unfortunately sometimes your host server provider may not support certain software. Your server specs may not have the memory needed, etc. Generally if you are worried about file size it is because your host has limitations (whether it be memory, physical storage size or processing). One size will never fit all and people with hosts with minimal specs encounter problems when resizing and also the host does not support some of the image compression software and libraries, beyond GD.

    without some optimization library - image resizing via php (and probably js)
    often results in larger files.

    you could try this
    https://cloudinary.com/blog/image_optimization_in_php

    or as was suggested above - post a message and details for users on the proper way to resize and optimize images on various websites and then limit the files size on image uploads, or you may be banging your head on this for a long time, and your head will hurt.

    https://www.google.com/search?q=image+compression+online

    https://www.sitepoint.com/image-compression-tools/

    https://www.smashingmagazine.com/2015/06/efficient-image-resizing-with-imagemagick/

    Pragmatism is all I have to offer. Avoiding the sidelines and providing centerline pro-tips.

Sign In or Register to comment.