Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#61 2010-12-02 13:43:37

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

Re: smd_thumbnail: manage multiple thumbnails of your images

jpdupont wrote:

is it possible to allow “create all” for checked images only ?

Sadly, plugins don’t have access to the multi-edit dropdown yet so I can’t do it from there. I may, however, be able to do it by reading the checkmarks at the time you click the button. But before I go through the motions of figuring out how to do that, may I ask why? What’s your workflow situation that requires you to only create a series of thumbs for certain images, as opposed to all of them? It may be that there’s another approach I can take, or refactor the plugin in a different way to help achieve your goals.

To create thumbnails for just uploaded images only ?

I’m not sure I get this. When you click Create all it goes through every image in the database and creates thumbs of them for all active profiles. By definition of them being in the database, the images must therefore all have been uploaded. Would you mind explaining what you mean, please?


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

#62 2010-12-02 14:38:35

jpdupont
Member
Registered: 2004-10-01
Posts: 752

Re: smd_thumbnail: manage multiple thumbnails of your images

Each time I create an article, I allow to join a few images, as a Fancybox galery.

  • I upload a 1000px big image
  • Then I ask smd_thumbnail to create 2 thumbnails : a 330px thumbnail to include in articles and a 75×75 to generate the Fancybox galery.

I just upload an article with about 25 images.
I want to create the the 2 thumbnails for those 25 images. But Create all work for all the images in the database, not for the just uploaded serie.
It would be fine to be allowed to check the 25 new images then to clic on create all – I mean Create the thumbnails for checked images.

Or … create thumbnail for images with a particular category.

Offline

#63 2010-12-07 17:50:56

maniqui
Member
From: Buenos Aires, Argentina
Registered: 2004-10-10
Posts: 3,070
Website

Re: smd_thumbnail: manage multiple thumbnails of your images

Hi Bloke,
I’ll have to look in the documentation to see if the following is stated as a feature.
I’ve noticed that if you upload a new main/full image, all thumbnails are recreated and they will rewrite any “custom” (manually uploaded) thumbnail.

/me not like that!


La música ideas portará y siempre continuará

TXP Builders – finely-crafted code, design and txp

Offline

#64 2010-12-07 19:40:21

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

Re: smd_thumbnail: manage multiple thumbnails of your images

maniqui wrote:

if you upload a new main/full image, all thumbnails are recreated and they will rewrite any “custom” (manually uploaded) thumbnail.

Erm, I thought that the core recreated the thumbnails on (re)upload too? I was supposed to model smd_thumbnail’s behaviour on the core behaviour. If that’s not the case can you sugest what should happen?


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

#65 2010-12-07 20:47:12

maniqui
Member
From: Buenos Aires, Argentina
Registered: 2004-10-10
Posts: 3,070
Website

Re: smd_thumbnail: manage multiple thumbnails of your images

Being that smd_thumbnail brings a super powerful “Create” button to the “Images -> Edit image” screen, and being that this button lets the user manually trigger the creation of all thumbnails (for every smd_thumbnail profile), if he wants/needs/wishes to do so, he can just pust the button.

Thus, I won’t expect smd_thumbnail recreating/overwriting all the thumbnails for every smd_thumbail profile automatically, when I’m “just” replacing the main/full image.
If then, I would want/need/wish to recreate all thumbnails, I can willingly hit the “Create” button while the “All sizes” option is selected on the dropdown menu.

Hope it makes sense!


La música ideas portará y siempre continuará

TXP Builders – finely-crafted code, design and txp

Offline

#66 2010-12-07 21:17:40

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

Re: smd_thumbnail: manage multiple thumbnails of your images

maniqui wrote:

if he wants/needs/wishes to do so, he can just pust the button.

True. And in the next version I’ve started toying with allowing said Create all button to actually become “Create some” and then offering the options of ‘all’, ‘selected’, ‘by category’ or ‘by author’. Time will tell if I can make it work properly.

But in the meantime, switch off the plugin and do this:

  1. Upload an image
  2. Ensure a thumb width/height are set in the Edit screen and upload a custom thumbnail
  3. Upload another image to replace the current one

Watch what happens to the thumbnail: it’s recreated from the main image again. That’s exactly the same functionality as smd_thumbnail. And you know why? Because the TXP core function that smd_thumbnail hijacks to do its magic doesn’t distinguish between a new upload and a re-upload. To TXP they are the same thing and they both call the thumbnail creation portion of the script. The only way I might be able to tell is by the existence of a thumbnail file in the relevant profile directory. If the file exists then I will be able to abort. But some people might want this auto-update functionality, as it’s the same as TXP is now, so I’ll have to offer an option somehow.

An alternative if you know you’re going to be doing some mass re-uploads: you can simply disable the profile(s) of the thumbnails you don’t want to be replaced and they’ll be skipped. Just click on the ‘Active’ heading in the Thumbnail profiles panel and the state of all profiles will be toggled in one click so you can ‘protect’ the greyed out ones from being replaced on upload.

Last edited by Bloke (2010-12-07 21:19:31)


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

#67 2010-12-07 23:22:26

maniqui
Member
From: Buenos Aires, Argentina
Registered: 2004-10-10
Posts: 3,070
Website

Re: smd_thumbnail: manage multiple thumbnails of your images

Bloke wrote:

True. And in the next version I’ve started toying with allowing said Create all button to actually become “Create some” and then offering the options of ‘all’, ‘selected’, ‘by category’ or ‘by author’. Time will tell if I can make it work properly.

I was referring to the one in the “editing an image” page, not the one in “Images” listing tab.
I clarify this because it’s that “Create” button on the “editing an image” page the one that provides the functionality of creating all smd_thumbnails at once. Then, the mass thumbnail creation/overwriting (for a particular image) could be doable by just pushing that button, instead of being done automatically (and inevitable) on image re-upload.

Watch what happens to the thumbnail: it’s recreated from the main image again. That’s exactly the same functionality as smd_thumbnail. And you know why? Because the TXP core function that smd_thumbnail hijacks to do its magic doesn’t distinguish between a new upload and a re-upload.

I can confirm that TXP core functionality is to re-create the thumbnail when the image gets replaced by a new one.
My opinion stands even for TXP core functionality: I’d rather manually re-create the thumbnail (by hitting the “Create” button) when replacing/re-uploading an image, than letting TXP decide that it has to create and overwrite the old thumbnail with a new one, in an inevitable way.

To TXP they are the same thing and they both call the thumbnail creation portion of the script. The only way I might be able to tell is by the existence of a thumbnail file in the relevant profile directory. If the file exists then I will be able to abort. But some people might want this auto-update functionality, as it’s the same as TXP is now, so I’ll have to offer an option somehow.

If you consider that smd_thumbnail default action should be consistent with TXP core functionality, I’ve nothing to argue against that.
But if you could address this issue (let’s call it: “inevitable thumbnail mass re-creationg & overwriting on image re-upload”) on smd_thumbnail, that would be great.
It may be a simple checkbox (if possible) next to the Upload image input field, or even, a profile-wide or plugin-wide option, directly on the Profiles manager table, that reads like this: “Check if you don’t want smd_thumbnails to be massively created/overwritten
on image (re)-upload”.

What do you think? Technically possible?

An alternative if you know you’re going to be doing some mass re-uploads: you can simply disable the profile(s) of the thumbnails you don’t want to be replaced and they’ll be skipped. Just click on the ‘Active’ heading in the Thumbnail profiles panel and the state of all profiles will be toggled in one click so you can ‘protect’ the greyed out ones from being replaced on upload.

Cool hidden feature the “click on Active heading to disable all profiles” (probably on docs, but didn’t recall about it). Good to know, thanks!


La música ideas portará y siempre continuará

TXP Builders – finely-crafted code, design and txp

Offline

#68 2010-12-07 23:30:35

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

Re: smd_thumbnail: manage multiple thumbnails of your images

maniqui wrote:

I was referring to the one in the “editing an image” page, not the one in “Images” listing tab.

Ok, of course, Silly me.

I’d rather manually re-create the thumbnail (by hitting the “Create” button) when replacing/re-uploading an image, than letting TXP decide that it has to create and overwrite the old thumbnail with a new one, in an inevitable way.

Then I’ll see what I can do to fix this. It’ll probably be in the form of a hidden option that you can set if that’s the way you prefer to work. e.g. smd_thumbnail_auto_create (0/1). If I can shoehorn it into the existing layout I will, but the chances are that I won’t feel justified to write an entire screen for one pref so the hidden pref route might be the way I implement it.

Cool hidden feature

“Hidden” in the docs yes :-) But I don’t blame you for not reading those: I wouldn’t either!


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

#69 2010-12-07 23:33:04

maniqui
Member
From: Buenos Aires, Argentina
Registered: 2004-10-10
Posts: 3,070
Website

Re: smd_thumbnail: manage multiple thumbnails of your images

“Hidden” in the docs yes :-) But I don’t blame you for not reading those: I wouldn’t either!

I’m a fan of your documentation! Check your website stats: probably it gets hit by someone from Argentina once a week…

Last edited by maniqui (2010-12-07 23:38:22)


La música ideas portará y siempre continuará

TXP Builders – finely-crafted code, design and txp

Offline

#70 2010-12-08 16:26:11

Niconemo
Member
From: Rhône-Alpes, France
Registered: 2005-04-18
Posts: 557

Re: smd_thumbnail: manage multiple thumbnails of your images

Hey, how did I miss that plugin ?

It looks so cool for any thumbnail/screen-size/full-size gallery !

I must try it now !

Last edited by Niconemo (2010-12-08 16:26:55)


Nico

Offline

#71 2010-12-15 13:53:13

Niconemo
Member
From: Rhône-Alpes, France
Registered: 2005-04-18
Posts: 557

Re: smd_thumbnail: manage multiple thumbnails of your images

Great plugin !

Just one request and it will be the perfect one fo me :

We can choose Height or Width (or both), but it’s hard to manage vertical /horizontal images if we don’t want them to turn square…

A third choice Greater size would be welcome. So that we could define a single style that would set the height of a vertical image OR the with of a horizontal one.

Don’t know if that makes sense…

Last edited by Niconemo (2010-12-15 13:53:48)


Nico

Offline

#72 2010-12-15 14:32:33

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

Re: smd_thumbnail: manage multiple thumbnails of your images

Niconemo wrote:

We can choose Height or Width (or both), but it’s hard to manage vertical /horizontal images if we don’t want them to turn square… A third choice Greater size would be welcome

Glad you like the plugin. So you want a profile that somehow figures out the aspect ratio of the image and adjusts itself accordingly? Sorry, probably not going to happen as the underlying (TXP core) function needs to store the physical dimensions and the plugin can’t rewrite profiles on the fly.

As an alternative, have you considered this bit of trickery:

  1. create two thumbnail profiles, one called Wide and one called Tall
  2. set the Wide profile’s height and leave its width 0 so it auto-scales the width in proportion
  3. set the Tall profile’s width and leave its height 0 so it auto-scales the height in proportion
  4. when you want to display the thumbnail, employ some smd_if magic to determine which to display

For example:

<txp:images category="some_cat">
   <txp:smd_if field='<txp:image_info type="w" />' operator="gt" value='<txp:image_info type="h" />'>
      <txp:smd_thumbnail type="Wide" />
   <txp:else />
      <txp:smd_thumbnail type="Tall" />
   </txp:smd_if>
</txp:images>

How’s that for a workaround? You’ll waste a bit of disk space storing two thumbs for each image when you really only want one, but you can decide if that’s an acceptable trade-off.

Last edited by Bloke (2010-12-15 14:35:14)


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