Forum Moderators: phranque

Message Too Old, No Replies

Need some forum advice

Avatar parameters

         

abrodski

4:07 am on Apr 23, 2010 (gmt 0)

10+ Year Member



Hello!
I need some advice about parameters of attachments. I have unlimited space at my host, but I'm afraid that being too generous might get me into troubles if people start abusing it (I'm talking about the total size of attachment folder)...
Say, if I want to make a backup or transfer it to another host etc., it might become much more difficult if I don't limit it.
Am I wrong? The default is 10 MB or so...is it enough? Your recommendation about max. sizes per post, per attachment...?
Stick to defaults? To me it seems that 128 KB per attachment is a sick joke...maybe I'm wrong.
And 150...for thumbnails...what is that px?
P.S. I use SMF 1.1.11

thecoalman

5:51 am on Apr 23, 2010 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



I have unlimited space at my host,


While you have "unlimited" space on shared hosting that is not the case on higher end plans. The "unlimited" is really a marketing gimmick because they know very few sites using these plans will ever use more than a few hundred MB's and/or they will hit other limits like CPU. Keep that in mind for the future, if you have long running forum and have to move to better plan.

What I've found is very few people abuse the upload feature on my forum, you'll get an occasional person posting a bunch of nonsense so you just send them a friendly PM about not using the upload feature for pointless images. Actually if you insure they are only uploading their own images it pretty much will keep everyone in check and you're going to want to do that anyway because of copyrights.

If 10 MB is the total size for all attachments you'll quickly fill that up.

128 KB per attachment is a bit small however what I've done is allow up to 5MB per image and I resize them server side to a max resolution of 1200px either side. Actually comes out around 150KB for most images. This is allow the members especially those that aren't tech savvy the ability to upload just about anything and I can make sure I don't have a whole bunch of wasted space on huge images without much compression. You'd probably have to modify your forum to get this functionality.


As far as the 150 I'd assume that would be for the thumbnail, I'm not familiar with SMF. Personally I have it at 300px for thumbnails. Never did like those little tiny thumbnails.

abrodski

7:16 pm on Apr 23, 2010 (gmt 0)

10+ Year Member



Well, unfortunately, I won't have to worry about higher end plans for quite a while...
I made it around 50 MB for a total attachment folder size...
yeah, 150 px is nothing, so I made it up to 300 px which is reasonable, though I might make it a little bigger.
And do you think that allowing attachments like .zip and .rar...is it safe? I mean, people won't start attaching viruses etc?
The problem is that I have GD module on my host enabled (its a Linux hosting) and it saves pics (thumbnails of them)as PNG and then if its 300x225 px, then its about 150 KB, which is too heavy. And if I choose JPEG, then the save thumbnail is about 10 KB which is fine, but the quality is bad. See...I checked in GIMP and the same jpg thumbnail picture with the same size should be around 25-30 KB with a decent quality. You know, when you save it in JPEG you have a scroll bar and you can choose the size vs. quality in an output image. So I assume that GD module automatically uses the lower quality and less sized jpg. images as thumbnails.
And I don't know if there's a way to change that.
I heard about another module, forgot its name..magicsomething...

rocknbil

2:03 am on Apr 24, 2010 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



You're thinking of Imagick. Imagick is the PHP interface to ImageMagick, which is pretty much a requirement when you exceed the 2MB default maximum upload file size of PHP (this is the upload, not your attachment folder size.) The reason for this is that GD constructs an uncompressed bitmap in memory, which can be exponentially larger than 2MB, eating up memory fast.

Not too likely ImageMagick will be available on shared, but I **have** seen it happen, and recently, too. So ask your host.

If these scripts are under your control, the third parameter of image[jpg|gif|bmp|png]() is the quality/compression setting, you can play with that.

abrodski

8:47 am on Apr 24, 2010 (gmt 0)

10+ Year Member



I was told that my host does have Imagick (well, its a pretty good host)...that it's installed.
But the support person said that I have to submit the ticket to get the info about Imagick.
Frankly, I have no idea how to access it, play with it, etc
Support person mentioned testing GD library and that I should put image.png file in the same directory as a script and I was given some PHP script... But I have no clue...
I guess I have to learn more about the subject...
As per 2 MB limit...you meant that I can't upload by default a file (say, image) which is larger than 2 MB?
But can't I change default PHP directive on the server to allow larger file uploads? Or if I have Imagick, then its fine as it is?

lammert

1:11 pm on Apr 24, 2010 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



Default, PHP will only allow file uploads upto 2MB per file. This is limited in the php.ini with the upload_max_filesize parameter. On shared hosting that central parameter can't be changed because the php.ini configuration file is shared with all the other users of the same server. But some hosting configurations allow you to do it in an .htaccess file instead. the following two lines in your .htaccess may increase the maximal uploadable file size to 10MB:

php_value upload_max_filesize 10M
php_value post_max_size 16M

Note that when you increase the upload_max_filesize parameter, you also have to increase the maximum allowed post message size. Increasing these values may trip other fixed boundaries for your setup like maximum script execution time, maximum memory use of an PHP instance etc.

rocknbil

8:51 pm on Apr 24, 2010 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Correct, you can get around the PHP defaults, but what ImageMagick addresses that GD does not:

GD constructs an uncompressed bitmap in memory, which can be exponentially larger than 2MB, eating up memory fast.


When you exceed 2MB uploads, often this will exhaust the default 32 MB PHP memory limit as well. This is why they default it to 2MB uploads, it rarely causes issues at that restriction.

You can also change the PHP memory allocation, again, don't know if your shared host will allow that, but you can ask. Even if you succeed, do you want the server eating up more than 32MB of memory for huge file uploads and resizing?

ImageMagick opens as a separate process and does much of it's work in virtual memory on disk, so it's not as heavy on memory for image manipulation.

abrodski

11:43 pm on Apr 24, 2010 (gmt 0)

10+ Year Member



Thanks for the information.

abrodski

4:43 pm on Apr 25, 2010 (gmt 0)

10+ Year Member



I submitted a ticket to my host about Imagick...
They have this info available:

ImageMagick is already installed for PHP on all servers and can be accessed by the path /usr/bin. We are currently running ImageMagick 6.5.9.

To check the current version, if updated, use the following command in SSH:

convert -version

Well, I can't access SSH because I would have to send them a fax of my passport or scan and e-mail it to them...

But let's assume that everything is fine...
So maybe someone could explain to me in a simple language (prefferably step by step), what should I do in order to activate it (if needed) and configure it to work with SMF forum (I'm talking about resizing images posted by users and making them a jpeg file with a specific dimensions and MOST importantly-make sure the JPEG quality is good, because I currently have a low quality/higher compression level, probably by default and I'm not satisfied with an output quality of thumbnail images that are posted on the forum). As far as I know, its a GD module that operates, and not Imagick, but I don't know...I can only say that in phpinfo.php it's written that GD module is installed, but nothing is written about Imagick or Image Magick.
I have no idea how to access Imagick and change the parameters in it (I'm talking about what Rocknbil posted above "If these scripts are under your control, the third parameter of image[jpg|gif|bmp|png]() is the quality/compression setting, you can play with that").

lammert

6:58 pm on Apr 25, 2010 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



The easiest to learn Imagick is just to start playing with it. You could start at the PHP official documentation [php.net] and try some of the examples. The integration of a specific solution in your SMF forum software depends on your installation and is outside the scope of this forum.

rocknbil

7:18 pm on Apr 25, 2010 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



OK, I'm probably confusing you more than anything, but here goes . . . Let me start with this:

(I'm talking about what Rocknbil posted above "If these scripts are under your control, the third parameter of image[jpg|gif|bmp|png]() is the quality/compression setting, you can play with that").


This is regarding GD library, not Imagick. I was making an assumption, that you were editing the code itself, and as the thread unfolded I can see you are not, you're just working with the message board software. So ignore that bit . . . in fact, the previous being the case, you may be chasing a ghost if this message board software doesn't support Imagick/ImageMagick. The following is in case it does, and I can give you clues where to look.

what should I do in order to activate it (Imagick) (if needed)


Might not be needed, see below, but if it is, ask support if the PHP API Imagick is enabled or installed.

"If needed" - originally you said

I heard about another module, forgot its name..magicsomething...


I rarely work with open source programs, but something made me think you might have seen this in your board's setup. I know it's an option in vBulletin. Dig around your board software's admin and look for the place image uploads are managed. In vBulletin, there is an option to use the GD library (default) or ImageMagick. If you select ImageMagick, there will be a text field to enter the path to the binaries, and that is what this is for from the support response: --> /usr/bin

While you're seeing if Imagick is supported in the admin area of your board, look around for settings in respect to the uploaded image quality, they might also be there (or should be.) Another place to look would be the configuration file for this script.

So before asking support, see if your board software has it built in.

I'm sure the creators of your message board software will have a forum, these questions can likely be answered best there.

abrodski

7:40 pm on Apr 25, 2010 (gmt 0)

10+ Year Member



No, I didn't see in admin center the option to choose between Imagick and GD...vBulletin is not open source and they probably have more options for admins.
I will try to find out if my forum software works with Imagick at all before anything...
Thanks for clarifying about the code.

abrodski

6:11 pm on Apr 27, 2010 (gmt 0)

10+ Year Member



The issue seems to be over now. I was told that SMF works with GD module.