Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2013-03-18 17:38:16

philwareham
Core designer
From: Haslemere, Surrey, UK
Registered: 2009-06-11
Posts: 3,564
Website GitHub Mastodon

Max size of image uploads

Is there a maximum limit on the filesize allowed for uploading images (regardless of what is in php.ini)?

One of my clients wants to upload large images to Textpattern (~5mb in size) and use a PHP script (timthumb.php) to generate images on the fly to the size required on a page. The script works fine for images around 1mb, but something prevents him from uploading images much larger than that.

Offline

#2 2013-03-18 18:20:17

Gocom
Developer Emeritus
From: Helsinki, Finland
Registered: 2006-07-14
Posts: 4,533
Website

Re: Max size of image uploads

There is a size limit in the preferences panel for uploads. Outside from that, the limiting factors are PHP’s configuration options upload_max_filesize, post_max_size and memory_limit, and then the server limits as the maximum allocatable memory for PHP’s process.

The size limit in preference panel can take as high value as PHP’s configuration allows. If you need to up the limit, I would recommend creating a directory specific configuration exception for Textpattern. You can do that with a .htaccess file if PHP is run as Apache module. Place a .htaccess file to your textpattern directory with the following in it:

php_value upload_max_filesize 30M
php_value post_max_size 30M
php_value memory_limit 64M

After you have created the file next to your config.php file, you can try to increase the size limit again. Be warned tho, I wouldn’t recommend increasing those above limits system wide, but just for the scripts that need more room (per directory exceptions). Last thing you want is to have never exiting 900 MB processes running on your server when someone finds a bug somewhere from the site.

If PHP is not run as an Apache module, the above options can be set using a PHP’s own directory-specific configuration file.

In general, Textpattern’s upload and download functionality doesn’t work well for large files. Same goes for any type of dynamic thumbnail scripts.

Last edited by Gocom (2013-03-18 18:28:38)

Offline

#3 2013-03-18 18:38:33

philwareham
Core designer
From: Haslemere, Surrey, UK
Registered: 2009-06-11
Posts: 3,564
Website GitHub Mastodon

Re: Max size of image uploads

Cheers Jukka, I’ll do the htaccess suggestion.

Offline

#4 2013-03-18 21:11:32

towndock
Member
From: Oriental, NC USA
Registered: 2007-04-06
Posts: 329
Website

Re: Max size of image uploads

timthumb.php looks damned handy.

Any idea how CPU hungry timthumb.php would be on a rather busy site?

Offline

#5 2013-03-18 22:16:48

philwareham
Core designer
From: Haslemere, Surrey, UK
Registered: 2009-06-11
Posts: 3,564
Website GitHub Mastodon

Re: Max size of image uploads

@towndock

Well, the timthumb script writes the resized image to a cache directory, so I guess once an image is initially generated there is little further CPU overhead. Jukka might have a different opinion.

There does seem to be a good case for loading a fairly large original image into a CMS and then auto-generating cropped/scaled/filtered copies of it as required. Non-destructive to the original image, and if your site ever changes dimensions or the W3C make a solution to HiDPI/mobile optimised images etc. all you need to do is amend a couple of lines of code and all new images are generated from those originals again.

On the minus side, I don’t know how well this script plays with server cacheing, or optimising of image data (it might be fine, I just don’t know). There was a vulnerability in an earlier version of the script that caused a shitstorm in the WordPress world (where it is used a lot in themes) but that was fixed.

Offline

#6 2013-03-19 07:12:08

milosevic
Member
From: Madrid, Spain
Registered: 2005-09-19
Posts: 390

Re: Max size of image uploads

I have used timthumb a lot… since I discovered SLiR. I Am not an expert but seems taht SLIR manages better the image caching. Take it a look.


<txp:rocks/>

Offline

#7 2013-03-19 07:29:42

tye
Member
From: Pottsville, NSW
Registered: 2005-07-06
Posts: 859
Website

Re: Max size of image uploads

I’m another who uses and vouches for SLIR

I think someone from here put me onto it… not sure who, but thanks :)

Offline

#8 2013-03-19 11:00:44

Gocom
Developer Emeritus
From: Helsinki, Finland
Registered: 2006-07-14
Posts: 4,533
Website

Re: Max size of image uploads

philwareham wrote:

Jukka might have a different opinion.

Introducing PHP to the request pipe will have an impact, even if it’s just used to direct the request to cache, where it read a file and outputs it. Compared to a normal file request handled just by your HTTP server, you are starting PHP, reading the file using PHP and passing the output from PHP to your server, which then takes care about getting the information to the client.

Last edited by Gocom (2013-03-19 11:01:53)

Offline

#9 2013-04-07 09:32:32

merz1
Member
From: Hamburg
Registered: 2006-05-04
Posts: 994
Website

Re: Max size of image uploads

tye wrote:

I’m another who uses and vouches for SLIR

FYI: From the actual github.com/lencioni/SLIR/blob/master/core/slir.class.php

@todo Remote image fetching?

TimThumb can fetch external images


Get all online mentions of Textpattern via OPML subscription: TXP Info Sources: Textpattern RSS feeds as dynamic OPML

Offline

Board footer

Powered by FluxBB