Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2010-08-06 08:32:56

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 11,269
Website GitHub

smd_thumbnail: manage multiple thumbnails of your images

If you’re bored of one thumbnail per image and don’t fancy using an auto-resizing script or relying on the browser to stretch your thumbs, smd_thumbnail could be the answer. It allows you to create profiles for as many thumbnail sizes as you like and will automatically create physical thumbnails at those dimensions for any/all of your images.

You can set one profile as a default to be the size you see on the Images tab. A couple of new public-side tags take care of displaying your thumbs.

Download it (Requires PHP 5+ and TXP 4.4.1+)

If anyone has any reports of weirdness or workflow improvements for this plugin, please let me know the details and I’ll see if I can figure it out.

Happy multi-thumbnailing.

Revision history
————————

All available versions and changes are listed here. Each entry indexes the relevant post(s) in the thread to learn about the features.

  • 06 Aug 2010 | 0.10beta | Initial beta release
  • 04 Oct 2010 | 0.10 | Official public release
  • 09 Nov 2010 | 0.11 | Added force_size and add_stamp (both thanks zero) ; removed unnecessary DB call
  • 10 Nov 2010 | 0.12 | Added ability to sync default profile thumbs with the corresponding TXP thumbnails (thanks zero)
  • 10 Nov 2010 | 0.13 | Added confirmation on Create all ; relabelled upload box (thank uli) ; tamed styles ; silenced chmod warnings (thanks zero)
  • 21 Nov 2010 | 0.14 | Permitted thumbs to be larger than the original images (thanks maniqui) ; fixed callbacks for image uploading and deleting
  • 26 Jan 2011 | 0.20 | Tools / prefs separated from profile list ; permitted batch creation via 1) selected images 2) category 3) author (thanks jpdupont) ; added smd_thumb_auto_replace option and altered default behaviour (thanks maniqui) ; fixed TXP thumbnail creation on thumbnail replace and made prefs global — and only available to site admins (all thanks jstubbs) ; fixed New Profile button wrapping (thanks jpdupont)
  • 12 May 2011 | 0.21 | Added smd_thumb_get_profiles() for other plugins to find which profiles are available
  • 12 Oct 2011 | 0.22 | Added display attribute ; added ‘create from’ preference (thanks the blue dragon / maniqui) ; fixed plugin for dashboard use ; fixed jQuery attr/prop in prefs ; fixed Txp menu interference (thanks maniqui)

Last edited by Bloke (2011-10-12 10:55:53)


The smd plugin menagerie — for when you need one more gribble of power from Textpattern. Bleeding-edge code available on GitHub.

Txp Builders – finely-crafted code, design and Txp

Offline

#2 2010-08-06 09:20:30

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

Re: smd_thumbnail: manage multiple thumbnails of your images

Sounds good, tho haven’t tested it yet. But sound good.

I will test when I get some time (or willness) to install the latest dev. Too bad I don’t use SVNs (I only weekly read the changes).

Offline

#3 2010-08-06 15:49:26

JanDW
Plugin Author
From: Providence, RI, USA
Registered: 2008-07-18
Posts: 327
Website

Re: smd_thumbnail: manage multiple thumbnails of your images

This is very cool… something I’ve wished for a couple of times. I don’t have the time to play with it yet, but I will as soon as I get a chance. Thanks, Stef.


TXPDream – A Textpattern Tag Library for Adobe Dreamweaver. (updated for 4.2.0) | jdw_if_ajax – Only serve certain parts of a page when requested with AJAX

Offline

#4 2010-08-06 17:00:18

mapu
Member
From: Munich, Germany
Registered: 2004-03-16
Posts: 141

Re: smd_thumbnail: manage multiple thumbnails of your images

Is this plugin capable to achieve something like this?

Offline

#5 2010-08-06 20:36:36

thebombsite
Archived Plugin Author
From: Exmouth, England
Registered: 2004-08-24
Posts: 3,251
Website

Re: smd_thumbnail: manage multiple thumbnails of your images

The short answer Marcus is – yes it can. But I think you need to go and play with it then come back and ask any specific questions you have about such things as coding, using it with the new <txp:image_list /> tag and using it with article_images. It might be best though if you had a test site you could try it out on.

I am currently using it on Textgarden.

Last edited by thebombsite (2010-08-06 20:37:23)


Stuart

In a Time of Universal Deceit
Telling the Truth is Revolutionary.

Offline

#6 2010-08-06 21:04:20

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 11,269
Website GitHub

Re: smd_thumbnail: manage multiple thumbnails of your images

mapu wrote:

Is this plugin capable to achieve something like this?

The long answer is also yes :-)

You don’t need to resize the existing thumbnails for your new layout: you can create a second profile that fits your new model (e.g. 200×180, no cropping, quality 80%, no sharpening). Then simply hit the Create all button and it’ll go away and make you a whole bunch of new, physical thumbnails at your desired size. You can create as many profiles as you like, add and delete images, quickly activate / deactivate profiles so only certain thumbs are created when you upload or replace images, and so on. You can even upload different thumbs (i.e. not derived from the image) if you wish, for each thumbnail profile.

On the public side you use the <txp:smd_thumbnail /> tag to display them. Works exactly the same as the built in thumbnail tag but you can specify type="profile_name" to display the thumbnail of the given size.

As Stuart says the best way to figure out the capabilities is to try it out. As long as your TXP and server meet the requirements there’s no special instructions. After you’ve played with it, feel free to let me know if you need it to do something else or the workflow could be tightened.


The smd plugin menagerie — for when you need one more gribble of power from Textpattern. Bleeding-edge code available on GitHub.

Txp Builders – finely-crafted code, design and Txp

Offline

#7 2010-08-07 06:20:16

mapu
Member
From: Munich, Germany
Registered: 2004-03-16
Posts: 141

Re: smd_thumbnail: manage multiple thumbnails of your images

Bloke wrote:

The long answer is also yes :-)

Sounds great! I’ll try it!

Offline

#8 2010-08-12 11:00:06

hidalgo
Member
From: Australia
Registered: 2008-02-05
Posts: 77
Website

Re: smd_thumbnail: manage multiple thumbnails of your images

Another brilliant plugin, thanks Stef! All the features I can think of you’ve already covered.

One small problem I’ve had is when trying to change the capitalisation of a profile name i.e. ‘Medium’ to ‘medium’. It’s possible however to change to an interim name and then back to the correct name/case.

I’m looking forward to 4.3.0 now so that I can use this on one of my live sites.

Offline

#9 2010-08-12 11:57:13

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 11,269
Website GitHub

Re: smd_thumbnail: manage multiple thumbnails of your images

hidalgo wrote:

Another brilliant plugin, thanks Stef!

Thank you.

trying to change the capitalisation of a profile name

Ooops thanks for the catch. I’ll see what I can do to fix it.


The smd plugin menagerie — for when you need one more gribble of power from Textpattern. Bleeding-edge code available on GitHub.

Txp Builders – finely-crafted code, design and Txp

Offline

#10 2010-11-07 15:42:54

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 11,269
Website GitHub

Re: smd_thumbnail: manage multiple thumbnails of your images

Officially released

One bug fix for those using the beta version: capitalisation changes for profile names are now permitted (thanks hidalgo).


The smd plugin menagerie — for when you need one more gribble of power from Textpattern. Bleeding-edge code available on GitHub.

Txp Builders – finely-crafted code, design and Txp

Offline

#11 2010-11-07 19:41:23

zero
Member
From: Lancashire
Registered: 2004-04-19
Posts: 1,470
Website

Re: smd_thumbnail: manage multiple thumbnails of your images

Great stuff, Stef! When I resize images it is usually the width, so I am using these types: t320, t240 etc to show me the width. As heights are often different, I don’t specify height and your plugin promptly scales them accurately. HTML then shows like: images/t320/22.jpg?1289149541" width="320" alt="ochre" class="t320" /> HTML5 doesn’t seem to mind not having a height specified any more. However, not having a height causes the image to load last and the page jumps down to accommodate it. (Don’t you just hate the many websites where you are just about to click a link and it jumps about?)

So my question is, is it possible for the plugin to autodetect the missing height or width and write it in the html?

Also, is the ?1289149541 necessary after the .jpg ?

Thanks for great work with plugins and of course Textpattern 4.3. Maaarvelous!!!


BB6 Band My band
Gud One My blog

Offline

#12 2010-11-08 09:25:37

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 11,269
Website GitHub

Re: smd_thumbnail: manage multiple thumbnails of your images

zero wrote:

is it possible for the plugin to autodetect the missing height or width and write it in the html?

I should think so. Makes sense, so leave it with me.

Also, is the ?1289149541 necessary after the .jpg ?

Not really, and I was in two minds whether to make this an option. When I was testing I was getting stale images showing up even when I’d changed the thumbs so that was a simple cache-busting mechanism. The downside of course is that it increases page download bandwidth. Perhaps I’ll turn that dubious ‘feature’ off and find some way (a hidden pref) that means you can globally turn it on or (perhaps also) add a tag option allow_cache="0" to add it on a per-thumb basis.

Thanks for the ideas and the kind words (oh, and sorry about the tag builder snafu re: deprecated attributes in 4.3.0: totally missed that, and entirely my fault).


The smd plugin menagerie — for when you need one more gribble of power from Textpattern. Bleeding-edge code available on GitHub.

Txp Builders – finely-crafted code, design and Txp

Offline

Board footer

Powered by FluxBB