• Welcome to the Chevereto user community!

    Here users from all over the world gather around to learn the latest about Chevereto and contribute with ideas to improve the software.

    Please keep in mind:

    • 😌 This community is user driven. Be polite with other users.
    • 👉 Is required to purchase a Chevereto license to participate in this community (doesn't apply to Pre-sales).
    • 💸 Purchase a Pro Subscription to get access to active software support and faster ticket response times.

Auto Image Width

xipr

Chevereto Noob
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