Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2010-10-09 11:52:04

radneck
Plugin Author
Registered: 2005-07-03
Posts: 109

esq_autoimageresize - Automatically resize uploaded images

esq_autoimageresize

Automatically resize uploaded images, using Textpattern’s built-in image manipulating classes

Textpattern 4.2.0+ and GD required. Textpattern 4.3.0 required to handle PNGs with alpha transparency.

Download here.
Current version: 1.03, updated 2011-03-29. If upgrading from 1.01 or below, please uninstall older versions first – see this post for details.

  1. Install and activate the plugin
  2. Click the Options button
    • If you see a warning that GD is not installed, then you will not be able to use this plugin with your current server setup – you need to recompile PHP with GD
    • If you see a warning that GD is not enabled for certain image file types, then your use of this plugin will obviously be limited – you need to recompile PHP with GD with the options for JPG, PNG and GIF
  3. Choose if you want to resize images differently depending on what category they are in, or just one size for all
    • If you choose per-category resizing:
      • When first uploaded, images will not be touched until you assign a category to them (categories must be assigned individually on the Edit Image page – bulk assigning a category on the Images (list) page won’t do it)
      • When replacing an image they will be resized straight away, provided a category has been assigned
      • When changing an image’s category, it will be resized OK if the new dimensions are smaller, but it will not resize to bigger dimensions
    • If you don’t use per-category resizing, the images will be resized straight away when they are uploaded
  4. Choose if you would like the thumbnail upload/create controls disabled – this is included just to make things nice and neat for clients
  5. Enter your desired resize width(s) and height(s) in pixels – numeric data only, do not include px
    • If you leave one of the width or height fields empty, then it will be automatically calculated depending on the uploaded image’s aspect ratio
    • If you leave both empty, the image won’t be resized (durr)
  6. Choose if you want the image to be cropped if your resize dimensions are a different aspect ratio to the uploaded image
    • If you don’t tick this option, the image may be “squashed” into your set dimensions
    • This options of only relevant when you have entered values for both width and height
  7. Go upload some images and they should be nicely resized just the way you wanted!

This plugin uses the core image manipulation classes (which are normally used to create thumbnails), so no external files/libraries are required.
You do need to have GD installed on your server however – this is required by Textpattern for creating thumbnails (if you don’t have it, then the thumbnail creation form won’t even show up).

There are a couple of existing image resizing plugins out there, they are probably a lot more extensive and feature rich. This is just designed to be a simple plugin for sites where the client will be uploading images and they need to be a certain size to not break page layouts.

Please note that if you change the image resize width and height settings, existing images will not be affected. If you are using per-category resizing, remove the category and then re-add it and the image will be resized to your new dimensions. Be careful resizing an image multiple times with this script; you may lose some quality. If you are using global dimensions you will have to re-upload the image to have it resized.

Please let me know if you see any errors or quirky behaviour. I’ve tested it pretty well, but GD is on of those things that seems to cause some people a lot of trouble.

Last edited by radneck (2015-11-04 21:05:24)

Offline

#2 2010-10-10 13:57:34

PascalL
Member
From: Switzerland
Registered: 2009-03-09
Posts: 132
Website

Re: esq_autoimageresize - Automatically resize uploaded images

Excellent ! Thanks!!!

Offline

#3 2010-10-10 21:28:58

jelle
Member
Registered: 2006-06-07
Posts: 165

Re: esq_autoimageresize - Automatically resize uploaded images

Brilliant!

Offline

#4 2010-10-11 04:23:00

radneck
Plugin Author
Registered: 2005-07-03
Posts: 109

Re: esq_autoimageresize - Automatically resize uploaded images

PascalL wrote:

Excellent ! Thanks!!!

jelle wrote:

Brilliant!

Glad you like it guys :)

Last edited by radneck (2010-10-13 06:10:33)

Offline

#5 2010-10-13 06:09:40

radneck
Plugin Author
Registered: 2005-07-03
Posts: 109

Re: esq_autoimageresize - Automatically resize uploaded images

This plugin has been updated guys, please delete the current version from your Textpattern install and upgrade to the latest version (v1.02).

There was an issue with the way the plugin prefs were stored, which meant that preferences stored by a user when the plugin was installed could not be read by other users.

It is important that you delete the current version before upgrading, otherwise the PREF_PRIVATE flag (which was causing the trouble) will stay intact.

Sorry for any inconvenience.

The new version is TXP 4.3.0 compatible as well (yay for alpha levels in PNGs!).

Last edited by radneck (2015-11-04 07:43:43)

Offline

#6 2010-10-25 08:26:51

AtleL
Member
From: Norway
Registered: 2005-07-26
Posts: 10
Website

Re: esq_autoimageresize - Automatically resize uploaded images

This looks absolutely fantastic! Only… I’ve installed the plug-in, and nothing happens… I get no “Options”-button, and I can’t see any options when I try to upload an image. My diagnostics says this about GD: gd_library: “gd_info: 2.0 or higher, GIF, JPG, PNG

I’ve got TxP 4.2.0 running on Apache/2.2.16 with PHP version 5.2.14.

Offline

#7 2010-10-25 11:19:31

radneck
Plugin Author
Registered: 2005-07-03
Posts: 109

Re: esq_autoimageresize - Automatically resize uploaded images

Hi Alte,

The resizing when you upload won’t kick in until you’ve filled in some options (dimensions etc).

Its strange you can’t see the Options link, it should be right under the Help and Edit links, on the Admin > Plugins section.

It won’t show up until you click the No link to activate the plugin (if the link says Yes like the screenshot above, then the plugin is activated).

Let me know how you go.

Last edited by radneck (2015-11-04 07:43:26)

Offline

#8 2010-11-17 20:09:12

maruchan
Member
From: Ukiah, California
Registered: 2010-06-12
Posts: 581
Website

Re: esq_autoimageresize - Automatically resize uploaded images

Does this work in 4.3? It doesn’t seem to be doing anything for me…I have GD installed and the options are filled in correctly.

Offline

#9 2010-11-18 05:54:51

radneck
Plugin Author
Registered: 2005-07-03
Posts: 109

Re: esq_autoimageresize - Automatically resize uploaded images

maruchan wrote:

Does this work in 4.3? It doesn’t seem to be doing anything for me…I have GD installed and the options are filled in correctly.

Hi Marc,

Yes its tested and working on 4.3. It won’t give you much feedback, other than simply resizing the images. Remember if you’re using per-category resize dimensions, you’ll need to apply a category to the image for the resizing to work.

Can you give me any more details about your setup? Is there any errors thrown or other messages displayed?
Give me a run down of what you’re going through and I’ll do my best to troubleshoot.

Last edited by radneck (2015-11-04 07:42:29)

Offline

#10 2010-12-13 11:43:02

gfdesign
Member
From: Argentina
Registered: 2009-04-20
Posts: 401

Re: esq_autoimageresize - Automatically resize uploaded images

Hi. Excellent Plugin.
I had to change PHP version 4.4.9 to 5.2.13 for it works, but I have two problems:
1) It isn´t creating the thubnails.
2) Also, I´m using “lam_image_uploader” plugin that let upload the image from write tab, but your plugin doesn´t work.
What options should I change for it can to make the thumbnails? Any idea ?
Thanks

Last edited by gfdesign (2010-12-13 11:45:36)

Offline

Board footer

Powered by FluxBB