Auto Image Width

xipr

Founder license
License owner
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.
 

xipr

Founder license
License owner
Yes, disable the resize option and make all images the same width. Height can be auto.
 

Rodolfo

Chevereto Developer
Chevereto Staff
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 ;)
 

xipr

Founder license
License owner
Removed all resize options from design. Just need the code to force the new width on upload.php
 

Rodolfo

Chevereto Developer
Chevereto Staff
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>
 

xipr

Founder license
License owner
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?
 

sinistra

Founder license
License owner
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>
 
Top