• 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

Autoresize

aladdin

Chevereto Member
Is it possible to automatically resize image if they are more than necessary? For example a maximum of 1000 pixels, bat uploaded 1200 pixels. I have a picture so that the automaton was resize to 1000, and it was not thumbs. 🙄
 
Maybe in config file but i can not find this value.

I do not need a resized thumbnail. I need the original 1200 pixel image to be auto-resized to 1000 pixels upon uploading to my forum.

Please help me.
 
Do a getimagesize and get the image width. Do a conditional for the target max size abd then inject the resize value.
 
a php conditional then when you call the upload class set the resize width.
 
PHP:
if($size>1200) $to_resize = 1000;

before

PHP:
$api_upload->resize_width = $to_resize;
 
i dont understand

my code
Code:
if (isset($_POST['submit_url']))
{

list($width, $height, $type, $attr) = getimagesize($_POST['upload2']);

if($width>1200) $to_resize = 1000;
$api_upload->resize_width = $to_resize;


    //set POST variables
    $url = 'http://img.rebill.me/api';
    $fields = array(
                        'key' => urlencode('reb_api'),
                        'upload' => $_POST['upload2'],
                        'format' => urlencode('txt')
                    );

    //open connection
    $ch = curl_init();



    //set the url, number of POST vars, POST data
    curl_setopt($ch, CURLOPT_URL, $url);
    curl_setopt($ch, CURLOPT_POST, sizeof($fields));
    curl_setopt($ch, CURLOPT_HEADER, false);
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
    curl_setopt($ch, CURLOPT_TIMEOUT, 240);
    curl_setopt($ch, CURLOPT_POSTFIELDS, $fields);
    curl_setopt($ch, CURLOPT_HTTPHEADER, array('Expect: '));

    //execute post
    
    $result = curl_exec($ch);

Where error? :|

Image uploaded from url
 
but when i call alert($width), i see width of uploading image. getimagesize work in my example. Not working resize. error in place of code

Code:
if($width>1200) $to_resize = 1000;
$api_upload->resize_width = $to_resize;

I see this cose, bat do not understand on 100%
http://pastebin.com/isTLmXGc
 
i write
Code:
list($width, $height, $type, $attr) = getimagesize($_POST['upload2']);
?>
<script>
alert(<?=$width;?>);
</script>
<?

for test the getimagesize, and and received width of image.
So getimagesize works :/

Not work
Code:
if($width>1200) $to_resize = 1000;
$api_upload->resize_width = $to_resize;

Maybe I'll show you all of the code?
 
Its all my code

Code:
<form NAME="stockForm" action="upload.php" method="post" enctype="multipart/form-data">
<input type="text" class="bginput" size="30" name="upload2" />
<input type="submit" class="button" name="submit_url" value="Send" style="width:70px" />
</form>

<?
if (isset($_POST['submit_url']))
{

list($width, $height, $type, $attr) = getimagesize($_POST['upload2']);

?>
<script>
alert(<?=$width;?>);
</script>
<?

if($width>1200) $to_resize = 1000;
$api_upload->resize_width = $to_resize;



        //set POST variables
              $url = 'http://img.rebill.me/api';
              $fields = array(
                                                'key' => urlencode('reb_api'),
                        'upload' => $_POST['upload2'],
                        'format' => urlencode('txt')
                    );

    //open connection
    $ch = curl_init();

    //set the url, number of POST vars, POST data
    curl_setopt($ch, CURLOPT_URL, $url);
    curl_setopt($ch, CURLOPT_POST, sizeof($fields));
    curl_setopt($ch, CURLOPT_HEADER, false);
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
    curl_setopt($ch, CURLOPT_TIMEOUT, 240);
    curl_setopt($ch, CURLOPT_POSTFIELDS, $fields);
    curl_setopt($ch, CURLOPT_HTTPHEADER, array('Expect: '));

    //execute post
    
    $result = curl_exec($ch);
        
        print"$result";

    //close connection
    curl_close($ch);

}
?>

Can you help me with calling the class?
 
Ahm it's not needed because your are doing a curl connection..
Just do this after the fields array:

Code:
if($width>1200) $fields['resize_width'] = 1000;
 
Back
Top