• Welcome to the Chevereto User Community!

    Here, users from all over the world come together to learn, share, and collaborate on everything related to Chevereto. It's a place to exchange ideas, ask questions, and help improve the software.

    Please keep in mind:

    • This community is user-driven. Always be polite and respectful to others.
    • Support development by purchasing a Chevereto license, which also gives you priority support.
    • Go further by joining the Community Subscription for even faster response times and to help sustain this space

Auto Image Width

xipr

Chevereto Member
I want to make all image uploads automatically a set width, without having to type in desired width in the image resizing option.

For example width 300. The height can be auto. So when someone uploads an image that is 1024 width, it will be changed immediately to 300 width.
 
Is not too hard to accomplish this, you need to remove from the design all the resize thing and force the new width on upload.php

I will give you instructions when I arrive home 😉
 
Removed all resize options from design. Just need the code to force the new width on upload.php
 
Ok, open upload.php and change this:
PHP:
$to_resize = $_POST['resize'];

To this:
PHP:
$to_resize = 300;
Where 300 is the desired forced width.

Now, open content/themes/Peafowl/index.php and remove this:
HTML:
                <div id="resizing">
                    <div id="resizing-switch"><div><a><span><?php show_lang_txt('txt_resizing'); ?></span></a> <?php show_lang_txt('txt_resizing_explained'); ?></div></div>
                    <div id="resizing-box">
                        <div id="resizing-it">
                            <div id="resize-width"><?php show_lang_txt('txt_resizing_width'); ?> <span><?php show_lang_txt('txt_resizing_pixels'); ?></span></div>
                            <input type="text" id="resize" name="resize"/><div id="resize-keep">*<?php show_lang_txt('txt_resizing_keep'); ?></div>
                        </div>
                    </div>
                </div>
 
What will happen if an image smaller than 300 width is uploaded? Is it possible to leave it the same size if it is less than 300 width?
 
This also works and leaves the design intact as is:

Whenever you need to undo it's also alot easier to change i.m.o.

Open content/themes/Peafowl/index.php and add:
value="300"

HTML:
<div id="resizing">
<div id="resizing-switch"><div><a><span><?php show_lang_txt('txt_resizing'); ?></span></a> <?php show_lang_txt('txt_resizing_explained'); ?></div></div>
<div id="resizing-box">
<div id="resizing-it">
<div id="resize-width"><?php show_lang_txt('txt_resizing_width'); ?> <span><?php show_lang_txt('txt_resizing_pixels'); ?></span></div>
<input type="text" id="resize" name="resize" value="300"/><div id="resize-keep">*<?php show_lang_txt('txt_resizing_keep'); ?></div>
</div>
</div>
</div>
 
Back
Top