UBBCentral

How to adjust image pixel dimensions for 6.7.1.1

Posted By: Digitalgas

How to adjust image pixel dimensions for 6.7.1.1 - 01/26/18 04:19 AM

I'm having trouble understanding the Attachment settings for "Image Resizing"
Do these settings only apply in Galleries? Not on attached images in forum posts?

User uploaded images into posts are coming through ImageMagick at the same pixel dimensions as they were submitted.
Example: "4,000px × 3,000px (scaled to 1,202px × 902px)"

If I could reduce pixel dimensions, I could set a higher % in Image Quality and still have an efficient file memory size.

What am I missing?
Posted By: Gizmo

Re: How to adjust image pixel dimensions for 6.7.1.1 - 01/26/18 06:22 AM

It would appear that there is a bug with ImageMagick, where it should resize before compression (like GD), but for whatever reason is not. Isaac mentioned that he'll have time this weekend to look further into the issue while I'm working on content rebuilder coding.
Posted By: Digitalgas

Re: How to adjust image pixel dimensions for 6.7.1.1 - 01/26/18 04:40 PM

I switched to the GD2 option in "Attachments" and now the pixel size is being reduced to the chosen settings. I'm able to get 800 pixel images at 80% compression and still get nice optimized file sizes.

Always thought ImageMagick did a little nicer optimization, so I hope the bug can be resolved.

Thanks!
Posted By: Gizmo

Re: How to adjust image pixel dimensions for 6.7.1.1 - 01/26/18 08:33 PM

Images processed through ImageMagick are always more crisp, its why we generally recommend it over GD; hopefully we can make the string sane again after testing.
Posted By: isaac

Re: How to adjust image pixel dimensions for 6.7.1.1 - 01/27/18 12:21 AM

I found the issue and created a quick patch that you can update the file on your own server with right now. Though, It is best to just wait until the next version of UBB.threads is out, since it will have a more detailed code block inserted. This code is only needed if you are using ImageMagick. GD2 does not require this attribute at all.

I've tested this with and without GD2. GD2 presents no visual errors, and still processes the images as intended -- Though, with the attribute added, GD2 may create an warning entry in the error log such as, "unrecognized command "-resize" but image was processed anyways." But I havent checked this. And thats only an assumption.


in forums/libs/image.inc.php

EDIT 2018-02-21:
IF YOU PREVIOUSLY MADE THE FOLLOWING CHANGE TO YOUR IMAGE.INC.PHP FILE, REVERT THE CHANGE OR GRAB A FRESH COPY OF THE FILE FROM THE ORIGINAL ZIP ARCHIVE. THEN SKIP THIS STRIKED-OUT SECTION, AND PROCEED TO THE "MAKE THIS CHANGE" SECTION


FIND (towards the end)
Code
	$exec = "\"{$config['CONVERT_PATH']}\" {$config['FULL_PATH']}/tmp/$sourcefile $thumb {$width}x{$height} $quality {$output}:\"{$config['FULL_PATH']}/tmp/$sourcefile.$type\" 2>&1";

REPLACE WITH
Code
	$exec = "\"{$config['CONVERT_PATH']}\" {$config['FULL_PATH']}/tmp/$sourcefile $thumb -resize {$width}x{$height} $quality {$output}:\"{$config['FULL_PATH']}/tmp/$sourcefile.$type\" 2>&1";


MAKE THIS CHANGE:

FIND (towards the end)
Code
	if ($type == "thumb" || $type == "medium") {
		$thumb = " -thumbnail ";
	} else {
		$thumb = "";
	}

REPLACE WITH
Code
	if ($type == "thumb" || $type == "medium") {
		$thumb = " -thumbnail ";
	} else {
		$thumb = " -resize ";
	}


The ImageMagick resizing issue seems to have been missing from the code long before I came on board with UBBCentral. So I guess its now finally squashed. Digitalgas, thanks for posting about it, to finally give it some needed attention!
Posted By: isaac

Re: How to adjust image pixel dimensions for 6.7.1.1 - 01/27/18 12:24 AM

Graphics Library ImageMagick:
Image Max Width/Height: 1920px
Image Quality: 60%

CyanCode jpg image
5256 x 3509 - 7,201 KB [ORIGINAL]
1920 x 1281 - 525 KB [PROCESSED]

ForestHighway jpg image
500 x 750 - 76 KB [ORIGINAL]
500 x 750 - 36 KB [PROCESSED]


Attached picture CyanCode_5256x3509.jpg
Attached picture ForestHighway_500x750.jpg
Posted By: isaac

Re: How to adjust image pixel dimensions for 6.7.1.1 - 01/27/18 12:26 AM

Graphics Library GD2:
Image Max Width/Height: 1920px
Image Quality: 60%

CyanCode jpg image
5256 x 3509 - 7,201 KB [ORIGINAL]
1920 x 1281 - 350 KB [PROCESSED]

ForestHighway jpg image
500 x 750 - 76 KB [ORIGINAL]
500 x 750 - 38 KB [PROCESSED]

Attached picture CyanCode_5256x3509.jpg
Attached picture ForestHighway_500x750.jpg
Posted By: Digitalgas

Re: How to adjust image pixel dimensions for 6.7.1.1 - 01/27/18 05:02 AM

Thanks for the quick diagnosis and solution!
Posted By: Morgan

Re: How to adjust image pixel dimensions for 6.7.1.1 - 02/11/18 12:00 PM

I'm using 7.6.1.1 and host say they installed ImageMagick 7.0.7-22 Q16 x86_64 2018-02-10

Isaac, I must say this is wonderful news HOWEVER I have one issue

after testing several times this is my feedback.

It resizes and compresses as it should BUT when using the Gallery with the new (Isaacs) codestring it does not upload thumbnails or medium size images anymore
only the full size. see attachmens here

Link to the gallery posts are here
http://www.britbike.com/forums/ubbthreads.php/forums/32/1/britbike-gallery

link to the post with new code that did not work
http://www.britbike.com/forums/ubbthreads.php/galleries/725173

Do you have any ideas what it could be?
I cut out and pasted only the exact code that you wrote above

PS here is a link to the forum attachment that worked fine
http://www.britbike.com/forums/ubbt...-with-60-imagemagick-new-code#Post725175

attachments below:
Left thumbnail shows when using unedited code
middle shows when edited code is used
right image shows three images please read the header of each but the left broken as it shows no thumbnail

Attached picture Screen Shot 2018-02-11 at 12.43.23.jpg
Attached picture Screen Shot 2018-02-11 at 12.46.49.jpg
Attached picture Screen Shot 2018-02-11 at 12.47.43.jpg
Posted By: Morgan

Re: How to adjust image pixel dimensions for 6.7.1.1 - 02/11/18 01:46 PM

Isaac, it look like this forum has same issue as i describe above
see here I uploaded a post yesterday and so did Gizmo
https://www.ubbcentral.com/forums/ubbthreads.php/forums/48/1/photo-gallery
Posted By: isaac

Re: How to adjust image pixel dimensions for 6.7.1.1 - 02/11/18 01:49 PM

Thanks Morgan. I received your previous 4 posts relating to this issue. I don't plan on doing anything about it at 5:30am on Sunday morning. I'll look in to on Monday even, when I get home from work. Thank you for reporting this.
Posted By: isaac

Re: How to adjust image pixel dimensions for 6.7.1.1 - 02/22/18 04:57 AM

Originally Posted by Morgan
Isaac, it look like this forum has same issue as i describe above
see here I uploaded a post yesterday and so did Gizmo
https://www.ubbcentral.com/forums/ubbthreads.php/forums/48/1/photo-gallery


Hey again Morgan. Sorry for the delay since my previous reply. Its been a busy week here. One that actually started late last weekend -- gah!

I finally had some time to review the code again. This time making further corrections to get everything working as expected.

I've updated my previous post to reflect those changes. It can be found at:
https://www.ubbcentral.com/forums/u...-pixel-dimensions-for-6-7-1-1#Post261065

Cheers laugh
Posted By: Morgan

Re: How to adjust image pixel dimensions for 6.7.1.1 - 02/22/18 09:04 AM

Isaac, I did the change and it works thank you very much.

I noticed one other thing now as I tried to drag the photos to my image manager and it did not work. Only when I select the normal way not drag.
Tested to drag photos on UBBCentral it worked fine but not on my forum.
see attached image what showed after I tried to drag the photo.

I wonder what could cause this? Have I missed a setting?

Attached picture Screen Shot 2018-02-22 at 09.51.37.jpg
Posted By: isaac

Re: How to adjust image pixel dimensions for 6.7.1.1 - 02/22/18 03:02 PM

Originally Posted by Morgan
I noticed one other thing now as I tried to drag the photos to my image manager and it did not work. Only when I select the normal way not drag.
Tested to drag photos on UBBCentral it worked fine but not on my forum.
see attached image what showed after I tried to drag the photo.

I wonder what could cause this? Have I missed a setting?


please use search smile and stay on topic

https://www.ubbcentral.com/forums/u...ag-drop-attachments-not-working-with-mac

or you could be missing files in your ubb_js directory. or you are using internet explorer 10, as the link above suggests.
Posted By: Morgan

Re: How to adjust image pixel dimensions for 6.7.1.1 - 02/22/18 05:28 PM

Thank you smile
Posted By: isaac

Re: How to adjust image pixel dimensions for 6.7.1.1 - 02/22/18 06:27 PM

@Morgan,

I sent you a PM with some links. Cheers laugh
© 2018 UBB.threads PHP Forum Software Community