PDA

View Full Version : Large photo problem



Maurizio Nicoli
November 12, 2013, 03:53 PM
I have a problem with version 4.1 that did not exist in version 3.2.

When I insert pictures the system works well, automatically the thumbnail size but large photos have all the size of a rectangle where space is not occupied by the size of the file (in this case a vertical picture) is colored white (in my case black) when you go to open big in the lightbox gallery.
You can have the photo so large as the original one but the size set in the admin panel and above all without the rectangle?

I tried the file rlResize.class.php but I can not find the function that creates this rectangle ...

Attaching photos to make me understand better ...

Thanks
Maurizio

Mike
November 13, 2013, 10:04 AM
Did you try to do somethign with this code in rlResize ?



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

Maurizio Nicoli
November 13, 2013, 12:51 PM
Hi Mike,

I have not explained well, I apologize ...
Basically I want to get the photos to the proportions they have and not with a colored background.
Example: if a picture is large 800 x 600 px must remain with these proportions even if in admin panel I set the size of the photo in a large 1200 x 600 px, the system I should sate for the picture with the height but the width of 600 px must be automated so you do not give me the edge with colored background on the sides of the picture.
In default mode, the system creates a picture of me in height and 600 px 1200 px width of 200px with a white background where the side of the photo.

In version 3.2 (I 2 licenses flynax a few years) this did not happen.

I hope I explained better.

thanks

Maurizio Nicoli
November 27, 2013, 11:42 PM
Hi,
I have an answer since I'm past 15 days?

Thanks

Mike
December 5, 2013, 10:15 AM
Hi, let's resolve it in your new thread please or better via private messages. it's kind of specific request, when we will have solution we will post for others.

Maurizio Nicoli
December 5, 2013, 02:12 PM
Ok.
I replied in a private forum message but something does not work well.
When I go into my sent items box I do not see any message sent even though I have sent them to you.
Thanks

Chris Brown
December 5, 2013, 02:44 PM
Ok.
I replied in a private forum message but something does not work well.
When I go into my sent items box I do not see any message sent even though I have sent them to you.
Thanks

You generally have to mark them as sent, checkbox under where you write the private message.

Petrache Nicolae
December 5, 2013, 10:14 PM
Hi, let's resolve it in your new thread please or better via private messages. it's kind of specific request, when we will have solution we will post for others.

i do hope that flynax team will provide asolution. i hated this apoach from the moment it was implemented. the thumbnails are afected as well. instead of letting them be landscape or portrait or square, to make it easyer, you keept all of them in landscape and zoomed in the wide to fit in the image, resulting in this case heads cut off for instance.

i apreaciate the fact that flynax wants to be original but this is not a improvement of a standard feature wich works just fine in any script...

Mike
December 10, 2013, 09:23 AM
I'm posting solution of Maurizio's request here in case somebody need it.

Default resizing system is much better, this solution in case you don't like pictures to be same size anywhere (or adding white background).

What it does (version 4.1) :

1. thumbnails resizing not affected (if you want to play with thumbnails also remove if(!$boolprotection) condition in the below code)

2. if picture is vertical (height more than width) it will resize by height (to fit max configured height)

3. if picture is horizontal it will resize by width (to fit max configured width)

4. white color filling removed.

includes/classes/rlResize.class.php, function _resize this change is just comment 3 lines


function _resize($numWidth, $numHeight){
global $config;

switch ($this->arrOriginalDetails['mime']){
case 'image/gif':
//GIF image
$this->resResizedImage = imagecreate($numWidth, $numHeight);
break;

case 'image/png':
//PNG image
$this->resResizedImage = imagecreatetruecolor($numWidth, $numHeight);
imagealphablending($this->resResizedImage, false);
imagesavealpha($this->resResizedImage, true);

break;

default:
//JPG image
$this->resResizedImage = imagecreatetruecolor($numWidth, $numHeight);

break;
}

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

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

$resize_method = function_exists('imagecopyresampled') ? 'imagecopyresampled' : 'imagecopyresized';


same file rlResize.class.php


function resize($strPath, $strSavePath, $strType = 'W', $value = '150', $boolProtect = true, $watermark = true)
{
//save the image/path details
$this->strOriginalImagePath = $strPath;
$this->strResizedImagePath = $strSavePath;
$this->boolProtect = $boolProtect;

$this->rlWatermark = $watermark;

//get the image dimensions
$this->arrOriginalDetails = getimagesize($this->strOriginalImagePath);

/*this condition added*/
if( !$this->boolProtect )
{
preg_match('/width="([^"]*?)" height="([^"]*?)"/', $this->arrOriginalDetails[3], $dimensions);
$img_width = $dimensions[1];
$img_height = $dimensions[2];
if($img_width > $img_height)
{
$strType = 'W';
$value = $value[1];
}else
{
$strType = 'H';
$value = $value[0];
}
}




After i did it i realized more simple way to fix this "problem" - just don't resize anything. as some pre-resizing already done in 4.2 version client side (upload system).
If somebody interested not to resize pictures on server side :)



function resize($strPath, $strSavePath, $strType = 'W', $value = '150', $boolProtect = true, $watermark = true)
{
return copy($strPath, $strSavePath);



Again, It's highly not recommended to change it, (especially last change) - default upload/resize function much better than this solution. Do it only if you know that you need it

Maurizio Nicoli
December 12, 2013, 06:53 PM
Thank you Mike so work perfectly.