• 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 Resize But Not Enlarge

SPoRTeXHauST

Chevereto Member
Hello,

I need,
If picture's width bigger than >755px, resize to 755px. But i dont want to enlarge pics. If width smaller than <755px, do not touch this...... I hope explain 🙂
 
Here is the solution :

Open includes/classes/class.upload.php

FIND : (near line 108)

PHP:
					$this->image_info = array(
						'img_name'		=>	$image_name,
						'img_path'		=>	$image_relative_path,
						'img_url'		=>	$image_url,
						'img_viewer'	=>	__CHV_BASE_URL__.'?v='.$image_name,
						'img_width'		=>	$width,
						'img_height'	=>	$height,
						'img_attr'		=>	'width="'.$width.'" height="'.$height.'"',
						'img_size'		=>	bytes_to_kb($statinfo['size']),
						'img_bytes'		=>	$statinfo['size'],
						'thumb_url'		=>	absolute_to_url($thumb_filename),
						'thumb_width'	=>	$this->thumb_width,
						'thumb_height'	=>	$this->thumb_height
					);

Add AFTER

PHP:
// Resize when bigger than
if ($width > 755)
{
	$this->resize($image_uploaded_path, $image_uploaded_path, 755);
}
// End resize when bigger than
 
Is this still working in the latest release?

Because i also want this feature, so i added :

// Resize when bigger than
if ($width > 600)
{
$this->resize($image_uploaded_path, $image_uploaded_path, 600);
}
// End resize when bigger than

After

if($uploaded) {
$info = get_info($image_filename);
$file_path = absolute_to_relative($image_filename);
$thumb_path = absolute_to_relative($thumb_filename);
$image_url = absolute_to_url($image_filename);
$name = str_replace('.'.$this->extension, '', str_replace($this->img_upload_path, '', $image_filename));
$this->image_info = array(
'image_name' => $name,
'image_filename' => $name.".".$this->extension,
'image_type' => $this->extension,
'image_path' => $file_path,
'image_url' => $image_url,
'image_width' => $info['width'],
'image_height' => $info['height'],
'image_attr' => 'width="'.$info['width'].'" height="'.$info['height'].'"',
'image_bytes' => $info['bytes'],
'image_size' => $info['size'],
'image_thumb_url' => absolute_to_url($thumb_filename),
'image_thumb_path' => $thumb_path,
'image_thumb_width' => $this->thumb_width,
'image_thumb_height' => $this->thumb_height
);

From line 238 to 259 in Open includes/classes/class.upload.php
 
Back
Top