PDA

View Full Version : Resize by height



Petrache Nicolae
August 18, 2012, 05:02 PM
Hello. In script 4.1 you solved the crop issue but just for big images. The thumbnails are still cropped, starting from the image upload till the final ad. How can be stop using function _resize($numWidth, $numHeight)
and use instead function resizeToHeight($numHeight) - i suppose that this function will allow resize based on height. thanks

Vladimir
August 21, 2012, 04:46 AM
Hello,

You can try fix it the following way:

- open the file libs/upload/upload.php
- go to method create_scaled_image()
- find this code (line ~ 129):



$rlResize -> resize( $config['img_crop_module'] || $version == 'thumbnail' ? $new_file_path : $file_path, $new_file_path, 'C', array($options['max_width'], $options['max_height']), $version == 'thumbnail' ? true : false, $options['watermark'] );


and change it to:



$rlResize -> resize( $config['img_crop_module'] || $version == 'thumbnail' ? $new_file_path : $file_path, $new_file_path, 'H', array($options['max_width'], $options['max_height']), $version == 'thumbnail' ? true : false, $options['watermark'] );


Pay your attention to the third parameter in the method resize.

Petrache Nicolae
August 21, 2012, 05:18 AM
Hello,

You can try fix it the following way:

- open the file libs/upload/upload.php
- go to method create_scaled_image()
- find this code (line ~ 129):



$rlResize -> resize( $config['img_crop_module'] || $version == 'thumbnail' ? $new_file_path : $file_path, $new_file_path, 'C', array($options['max_width'], $options['max_height']), $version == 'thumbnail' ? true : false, $options['watermark'] );


and change it to:



$rlResize -> resize( $config['img_crop_module'] || $version == 'thumbnail' ? $new_file_path : $file_path, $new_file_path, 'H', array($options['max_width'], $options['max_height']), $version == 'thumbnail' ? true : false, $options['watermark'] );


Pay your attention to the third parameter in the method resize.

Have replaced the code but is not working. added 2 image, first after upload disapears and the second start to upload than at 100% stucks and the empty box (add images) starts to show a counter
i was talking about what you see in image135.
so, starting from the moment we add a portrait image (tall image), having it not croped, as the end result wich will show it not croped. thanks

Petrache Nicolae
September 3, 2012, 01:33 PM
have tried again this in the upgraded script and no luck. see in the image how bad it looks with laptop sean incomplete (i had to modify them in photoshop to have them uncut)
142

Petrache Nicolae
October 9, 2012, 04:45 AM
what else can i try to fix this? thanks

Ionut Barabasa
December 4, 2012, 08:37 PM
I also think this must be fixed. If in detailed description photos appear not cropped, in short description images are cropped. Why not the same function here too? Some images will look very bad. I presume is just a small change

Mike
December 7, 2012, 06:18 AM
Thumbnails should have the same height to looks good in short view places (boxes, grids) but big images can be different.

Maybe i don't understood something from the topic, if so please clarify.

As i understand what you want is to disable crop function for the thumbnails.

To do it open upload.php (as in Vladimir's post above)

find function and make changes



function create_scaled_image($file_name, $new_file_name, $options, $version) {
global $rlResize, $rlCrop, $config, $rlHook;

$file_path = $this -> options['upload_dir'] . $file_name;
$new_file_path = $this -> options['upload_dir'] . $new_file_name;

$rlHook -> load('phpUploadScaledImage');

/* if ( $config['img_crop_module'] || $version == 'thumbnail' )
{
$rlCrop -> loadImage($file_path);
$rlCrop -> cropBySize($options['max_width'], $options['max_height'], ccCENTER);
$rlCrop -> saveImage($new_file_path, $config['img_quality']);
$rlCrop -> flushImages();
}*/

$rlResize -> resize( /*$config['img_crop_module'] || $version == 'thumbnail' ? $new_file_path :*/ $file_path, $new_file_path, 'C', array($options['max_width'], $options['max_height']), $version == 'thumbnail' ? true : false, $options['watermark'] );

return true;
}

Petrache Nicolae
December 7, 2012, 06:40 AM
it is not working. i add 2 images. a portrait and a landscape. thei look ok now (portrait is sean in full). click on upload and the portrait image starts uploading than it disapears and i receive the ok message and the landscape starts to upload and is stuked like that

Ionut Barabasa
December 8, 2012, 10:21 PM
Indeed is not working. When i click upload i just get the number of enabled photos increasing ( i waiting till 2300 then i stopped) See the image in atachement

249

Yes. We want to disable crop function for thumbnails in short forms. If user will upload photos in portrait mode they will look strange if cropped I attach a snapshot from gumtree. You will see that first and last photos are portrait type and are not cropped. Inside that square looks nice

250

Ionut Barabasa
February 26, 2013, 06:42 PM
Will this problem be fixed in version 4.2?

Petrache Nicolae
December 17, 2013, 08:59 PM
nope, is not fixed in 4.2

Mike
December 18, 2013, 07:58 AM
You can disable crop for thumbnails with one simple change:

libs/upload/upload.php

find code



'thumbnail' => array(
'image_versions' => array(
'large' => array(
'prefix' => '_large',
'max_width' => $GLOBALS['config']['pg_upload_large_width'] ? $GLOBALS['config']['pg_upload_large_width'] : 640,
'max_height' => $GLOBALS['config']['pg_upload_large_height'] ? $GLOBALS['config']['pg_upload_large_height'] : 480,
'watermark' => true
),
'thumbnail' => array(
'prefix' => '',
'max_width' => $GLOBALS['config']['pg_upload_thumbnail_width'] ? $GLOBALS['config']['pg_upload_thumbnail_width'] : 120,
'max_height' => $GLOBALS['config']['pg_upload_thumbnail_height'] ? $GLOBALS['config']['pg_upload_thumbnail_height'] : 90,
'force_crop' => true,
'watermark' => false
)
)


and change



'force_crop' => true,


to



'force_crop' => false,

Petrache Nicolae
December 18, 2013, 03:46 PM
You can disable crop for thumbnails with one simple change:

libs/upload/upload.php

find code



'thumbnail' => array(
'image_versions' => array(
'large' => array(
'prefix' => '_large',
'max_width' => $GLOBALS['config']['pg_upload_large_width'] ? $GLOBALS['config']['pg_upload_large_width'] : 640,
'max_height' => $GLOBALS['config']['pg_upload_large_height'] ? $GLOBALS['config']['pg_upload_large_height'] : 480,
'watermark' => true
),
'thumbnail' => array(
'prefix' => '',
'max_width' => $GLOBALS['config']['pg_upload_thumbnail_width'] ? $GLOBALS['config']['pg_upload_thumbnail_width'] : 120,
'max_height' => $GLOBALS['config']['pg_upload_thumbnail_height'] ? $GLOBALS['config']['pg_upload_thumbnail_height'] : 90,
'force_crop' => true,
'watermark' => false
)
)


and change



'force_crop' => true,


to



'force_crop' => false,


we are spinning around the tail...we had the same issue with solution presented back to 4.0 and no complete solution
this is the original image 759
and
this is the resulted image 760

Now, look at 2 websites from my country for instance
http://www.tocmai.ro/anunturi/valcea.html or
http://mercador.ro/oferte/

do you see any white stripes added by the script when it has a portrait mode image (tall image)? YOU DON'T....

So, why does this script doesn't know how to display tall images without adding white stripes? It ads a tall image into a wide container...This looks even great on colored background

Mike
December 19, 2013, 11:11 AM
Ok ) Please try already suggested changes to remove white color filling.

rlResize.class.php find code and remove or comment



/* create white background */
// $white = imagecolorallocate($this->resResizedImage, 255, 255, 255);
// imagefill($this->resResizedImage, 0, 0, $white);

//update the image size details
// $this -> updateNewDetails();



White color made to make images to have same width and height, that is very necessary for photos gallery and thumbnails. If you don't need it its easy to remove with above changes.

Petrache Nicolae
December 19, 2013, 01:54 PM
Ok ) Please try already suggested changes to remove white color filling.

rlResize.class.php find code and remove or comment



/* create white background */
// $white = imagecolorallocate($this->resResizedImage, 255, 255, 255);
// imagefill($this->resResizedImage, 0, 0, $white);

//update the image size details
// $this -> updateNewDetails();



White color made to make images to have same width and height, that is very necessary for photos gallery and thumbnails. If you don't need it its easy to remove with above changes.

not working. instead of white stripes we have black ones....

the script, as you have sean in the 2 website i've sent, should work with 2 formats: LANSCAPE and PORTRAIT
your script knows just LANDSCAPE wich means that any portrait image is shown into a LANSCAPE container. Totaly wrong.

Mike
December 24, 2013, 11:40 AM
Did you try changes as described here ?

http://www.flynax.com/forum/showthread.php?1694-Large-photo-problem&p=7813#post7813

Petrache Nicolae
December 24, 2013, 01:51 PM
Did you try changes as described here ?

http://www.flynax.com/forum/showthread.php?1694-Large-photo-problem&p=7813#post7813

nope. will give it a try and hopefully will work fine. thanks

Petrache Nicolae
December 24, 2013, 02:07 PM
Did you try changes as described here ?

http://www.flynax.com/forum/showthread.php?1694-Large-photo-problem&p=7813#post7813

not worked for me....Fatal error occurred, please look into the error logs or contact Flynax Support.

Mike
December 25, 2013, 04:31 AM
I think you make mistake somewhere or maybe it just not compatible with your site for some reason, please check again you making the right changes.

Also you can pm me place where i can check/try it (as i know you have several installations)