Skip to main content
Topic: [ADDON] Resize attached images (Read 26901 times) previous topic - next topic
0 Members and 1 Guest are viewing this topic.

Re: [ADDON] Resize attached images

Reply #30

Thanks Spuds, that works perfectly, attached the result. What do you think about the quality? For me is good enough, we are talking about a 68 KB jpg file, 1200 px width.

Yep, it was clear enough from your previous message  8)

Re: [ADDON] Resize attached images

Reply #31

I think I found a bug:  ;D
The precedent tests were made editing an existing topic, so I had no problems attaching the 1,1MB PNG image, but if I try to reply to a topic attaching the same image I get: Aston_Martin_Car_PNG_Car_Clipart-99.png : (1040 KB) Your file is too large. The maximum attachment size allowed is 500 KB.
I don't think this is normal, if I can update a post with an image I should also be able to upload the same image to a new post. Now I remember why I set that limit to 0. ;)


sorry for my bad english

Re: [ADDON] Resize attached images

Reply #32

Are you talking about the general file size limit for an attachment?

If so, I don't have the bug. My limit is set to 20 mb though.  O:-)

Re: [ADDON] Resize attached images

Reply #33

QuoteWhat do you think about the quality?
Certainly showing artifacts.  In that same code where you made the edit, you could try changing the 80% to 85% and see how you like that.  Will be slightly larger but should help with the blocking going on.

QuoteI don't think this is normal,
Sounds like a bug as well ... will check !

QuoteBelow is the german translation.

Can it be there's a little bug with the help texts?
Those work for me, but will check again.  Thanks for the translation and spell checking  ;)



Re: [ADDON] Resize attached images

Reply #34

Quote from: radu81 – The precedent tests were made editing an existing topic, so I had no problems attaching the 1,1MB PNG image, but if I try to reply to a topic attaching the same image I get: Aston_Martin_Car_PNG_Car_Clipart-99.png : (1040 KB) Your file is too large. The maximum attachment size allowed is 500 KB.
I have not been able to duplicate this so far ... when you go to reply, what does it say in the attachment area, there should be a line like .... (Restrictions: 20 per post, maximum total size 8,192 KB, maximum individual size 4,096 KB) The size values should be your server max limits (as determined by the addon), not the limits set in the admin panel.  If the addon is off then it would show the admin panel limits.

Also I tried 85% on the jpeg quality, not much change in file size or quality ....

Re: [ADDON] Resize attached images

Reply #35

When editing an existing message I see:
Allowed file types: doc, gif, jpg, pdf, txt, zip, png
Restrictions: 20 per post, 18 remaining, maximum total size 1,048,576 KB, 1,048,389 KB available, maximum individual size 524,288 KB

when posting a new reply
Allowed file types: doc, gif, jpg, pdf, txt, zip, png
Restrictions: 20 per post, maximum total size 10,000 KB, maximum individual size 500 KB
sorry for my bad english

Re: [ADDON] Resize attached images

Reply #36

What values are in your phpinfo() ( can use admin-> main -> support and credits and select more detailed next to php info for:

upload_max_filesize
post_max_size

Also to improve the jpeg quality, add
Code: [Select]
				$imagick->setSamplingFactors(array('1x1', '1x1', '1x1'));
right after the borderImage line that you added to get the white background.  Let me know what you think of that.  Yes the image is a bit larger (88.25kb) but it greatly reduced the artifacts IMO.
Last Edit: March 09, 2017, 11:47:54 am by Spuds

Re: [ADDON] Resize attached images

Reply #37

Upload_max_filesize 512 MB 
Post_max_size 1024
There is a phpinfo.php in the root of my domain.

I'll try the edit you suggest, I'm on mobile right now.

Anyway, please have  a look at my precedent post, is clear that in edit mode use the hosting values (which is OK) while in posting a new reply it uses the smf values. They are different
sorry for my bad english

Re: [ADDON] Resize attached images

Reply #38

Strange.

When you get a chance, open up Air_Resize.subs.php, find the function ipb_air_prepost()  (its the first one).

Enter a
Code: [Select]
var_dump($function_name);
inside the if statement, right before the "// Showing the post, or attempting to post?" comment.

Then try the modify, reply, and new topic actions and let me know what get pushed out at the top of the page.   They should all say string 'action_index' (length=12)  You can then remove that var_dump line, I'm just wanting to see if another mod is causing a problem.

Re: [ADDON] Resize attached images

Reply #39

I did the edit you suggested, and I am getting:
- in edit mode: string(12) "action_index" (Restrictions: 20 per post, 18 remaining, maximum total size 1,048,576 KB, 1,048,389 KB available, maximum individual size 524,288 KB)
- in reply mode: string(12) "action_post2" (Restrictions: 20 per post, maximum total size 10,000 KB, maximum individual size 500 KB)
- in new topic: string(12) "action_index" (Restrictions: 20 per post, maximum total size 1,048,576 KB, maximum individual size 524,288 KB)

In edit mode and new topic I am able to add PNG > 500 kb and they get converted to jpg. Only in reply mode it keeps the elkarte settings for single attachment.

Addons installed:
Attachment Image Resize 1.0.2
Fancy Box 4 ElkArte 1.0.1 (unistalled, and installed the 1.0.2 version)
Google Analytics tracking 0.0.1
Google Member Map 1.0.2
ImageCache 1.0
Inline Attachments 1.0
No Frills Snow for ElkArte 1.0
NoFollow 0.0.2
Quick Quote 0.2
Remove Last Edit By 1.0.0
SimpleAds 1.0.2
SimplePortal 1.0.0 Beta 1
Smush.it! 0.3

Thanks for your help Spuds.

EDIT: I unistalled ILA addon but nothing changed. Still testing...

I think I found something useful:
I am using the quick reply (simple editor, no smileys or editor buttons). I was not using the "Reply button" but the "Preview" button, so when trying to add a new reply:
- using Preview button: string(12) "action_post2" (Restrictions: 20 per post, maximum total size 10,000 KB, maximum individual size 500 KB)
-using Reply button: string(12) "action_index" (Restrictions: 20 per post, maximum total size 1,048,576 KB, maximum individual size 524,288 KB)

So the problem is only when I use the "Preview" button. Topic edit, new topic and topic reply using the "Reply" button works fine  8)
Last Edit: March 09, 2017, 04:12:11 pm by radu81
sorry for my bad english

Re: [ADDON] Resize attached images

Reply #40

Its that action_post2 that is causing the issue, the addon only changes the limits for action_index ... just curious that you are seeing a action_post2  :-\   I'll have to install some of those addons and see if I can see where that is happening.

for now you can test by changing the if statement in the ipb_air_prepost (same on you got the debug info from) to
Code: [Select]
		if ($function_name === 'action_index' || $function_name === 'action_post2')

That should fix the form issue and allow you to send in a larger file, but I'm not sure if there will be side effect like it does not resize / reencode the image as it should.  I'll try to do some testing tonight.

Re: [ADDON] Resize attached images

Reply #41

sorry Spuds I just edited the precedent post (probably while you were replying)
sorry for my bad english

Re: [ADDON] Resize attached images

Reply #42

Finaly solved, the problem was... me :D since I never use the Reply button, instead I use the Preview button which brings me to full editor, but as you show there are different functions, action_index for Reply and action_post2 for Preview. Don't ask why I use the Preview button! I don't know, probably because is always there near to my mouse cursor :)

Quote from: Spuds –
Code: [Select]
		if ($function_name === 'action_index' || $function_name === 'action_post2')

That should fix the form issue and allow you to send in a larger file, but I'm not sure if there will be side effect like it does not resize / reencode the image as it should.  I'll try to do some testing tonight.
That did the trick, with this edit I am able to upload PNG files and they get resized and converted to JPG :)

sorry for my bad english

Re: [ADDON] Resize attached images

Reply #43

Is there a way (or make it an option in the addon settings please) to open images not in the same tab/window, but in a different?

Re: [ADDON] Resize attached images

Reply #44

@Jorin‍ I think your question is related to fancybox addon and not to resize attached images addon
sorry for my bad english