Portrait pictures

2 years 4 months ago #355
Topic Author
gbsweb's Avatar
Posts: 9
Portrait pictures

Hello,
Norcompetitions uploads even horizontally pictures that are vertically (portrait format). Is there a solution to this problem?

Thank you

2 years 4 months ago #359
Dmitry's Avatar
Posts: 660
Re: Portrait pictures

Hi!

This is not a problem, but intended behavior. NorrCompetition does not transform medium and big photos on upload and never did. Please read our help doc about sizes - Recommendations on image sizes

Dmitry


Like our extensions and support?
Add your voice to the JED listing with a 100-score review: bit.ly/2ciJBqC
Thanks!

2 years 3 months ago #380
Topic Author
gbsweb's Avatar
Posts: 9
Re: Portrait pictures

No, maybe I explained badly. The problem by uploading a photo vertically.
However, I have solved by adding this code:

After line 271 $thumb = new Imagick($imagePath); in components\com_competition\libraries\image.php



			$orientation = $thumb->getImageOrientation(); 
		
			switch($orientation) { 
				case imagick::ORIENTATION_BOTTOMRIGHT: 
					$thumb->rotateimage("#000", 180); // rotate 180 degrees 
				break; 
		
				case imagick::ORIENTATION_RIGHTTOP: 
					$thumb->rotateimage("#000", 90); // rotate 90 degrees CW 
				break; 
		
				case imagick::ORIENTATION_LEFTBOTTOM: 
					$thumb->rotateimage("#000", -90); // rotate 90 degrees CCW 
				break; 
			} 
		
			// Now that it's auto-rotated, make sure the EXIF data is correct in case the EXIF gets saved with the image! 
			$thumb->setImageOrientation(imagick::ORIENTATION_TOPLEFT); 

And for photo upload by mobile I added this code:

Replace line 29 input type="file" in com_competition\bootstrap2\fields\photo.php with
input type="file" accept="image/*;capture=camera" data-sigil="photo-input"

2 years 3 months ago #381
Dmitry's Avatar
Posts: 660
Re: Portrait pictures

I still do not completely understand the problem. I see that you are changing the orientation, but why? Do you mean that the initial photo has wrong orientation? Can you give an example of such photo :)

accept="image/*;capture=camera"

Nice catch. Will add this to our next version.

Dmitry


Like our extensions and support?
Add your voice to the JED listing with a 100-score review: bit.ly/2ciJBqC
Thanks!

2 years 3 months ago #382
Topic Author
gbsweb's Avatar
Posts: 9
Re: Portrait pictures

I changing the orientation because images uploaded from mobile are often wrong orientation. Test with image in attach.

I change also the code in administrator\components\com_competition\helpers\photo.php in line 640
from if (false === JFile::copy(NC_PATH_PHOTOS_TMP . '/' . $path, $mediumImg))
to if (false === JFile::copy(NC_PATH_PHOTOS_TMP . '/orig_' . $path, $mediumImg))

because medium photo were grainy pictures

You can get our help: Monday - Friday / 09:00 to 17:00 (GMT+2). but not limited. Our staff will be pleased to provide Premium support to every paid subscriber asap, but sometimes you should be ready to wait for our reply for up to 3 days. In case of free extensions we do the best to develop and maintain them either, but their support is not necessary.

Product Latest Update