Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#133 2011-09-26 23:30:47

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

Re: smd_thumbnail: manage multiple thumbnails of your images

frickinmuck wrote:

I love this plugin!

Why, thank you.

I was wondering if it’s possible to use this with smd_gallery

Yes, you can do it with multiple galleries, or try this (untested) construct:

<txp:smd_gallery countform="1:thumb_large, :!1:thumb_small" [...other options...] />

Then in Form thumb_large:

<txp:smd_thumbnail type="Large" id="{id}" />

and of course a similar tag in thumb_small. The gallery tag’s countform should then execute thumb_large for only the first image and pass control to thumb_small for every image that isn’t the first. At least, in theory :-)


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

#134 2011-09-26 23:36:38

frickinmuck
Member
Registered: 2008-05-01
Posts: 118

Re: smd_thumbnail: manage multiple thumbnails of your images

I just did it using txp:images, although I think your suggestion gives powerful options for other uses. Here’s what I used:

<txp:images limit="1"><a href="<txp:image_url />" rel="lightbox-inventory"><txp:article_image thumbnail="1" /></a></txp:images>
<txp:images limit="8" offset="1" wraptag="div" break="" >
     <a href="<txp:image_url />" rel="lightbox-inventory"><txp:smd_thumbnail type="Small" offset="1" /></a>
</txp:images>

(with Large set as the default size).

Last edited by frickinmuck (2011-09-26 23:38:01)


The AI does not hate you, nor does it love you, but you are made out of atoms which it can use for something else.

Offline

#135 2011-10-12 04:44:05

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

Re: smd_thumbnail: manage multiple thumbnails of your images

Hi Stef,

Although I can’t find it now, I think you somewhere mentioned the issue related to Remora dropdowns being shown below the “Thumbnail Profiles” fieldset.
As it seems it’s not solvable via z-index dance (at least, not without also touching Remora’s CSS), I suggest this possible fix:

#smd_thumb_profiles { width:700px; margin:0 auto 18px; position:relative; }
(…)
.smd_thumb_btn { position:absolute; right:10px; top:-12px; text-align:center; padding:3px; }

Basically, it removes the position:relative on the fieldset, which solves any z-index issues between dropdowns and the fieldset. Then, it also removes the position:absolute from the “Tools / Prefs” button, so it shows just inside the fieldset.


La música ideas portará y siempre continuará

TXP Builders – finely-crafted code, design and txp

Offline

#136 2011-10-12 10:50:55

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

Re: smd_thumbnail: manage multiple thumbnails of your images

Thanks maniqui. I’ve put that into v0.22. This release also brings:

  • New preference for creating thumbs from Txp’s main image or its thumbnail (thanks Gil / maniqui)
  • display attribute for choosing whether to output the thumbnail or a raw URL to the thumbnail so you can create your own <img> tag
  • Fix for using the plugin on an admin-side dashboard
  • Fix for jQuery 1.6+ (.attr() / .prop() resolution)

Let me know how this one fares.


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

#137 2011-10-12 14:29:35

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

Re: smd_thumbnail: manage multiple thumbnails of your images

Thank you, Stef.

New preference for creating thumbs from Txp’s main image or its thumbnail (thanks Gil / maniqui)

Please, could you refresh me a little about what this new feature does? I can’t recall what I may have requested in the past! :)

BTW, on a site where I’ve used smd_thumbnail, I’ve decided to change the way I’m (ab)using it.
I was using different smd_thumbnail profiles to store different versions (not just different sizes) of the “same” image. For example, different POVs or close-ups of the same product.
Although it seems a “clever” trick and it may work in some simple scenarios, it also adds some complexity: tacit rules, or risks of overwriting customized thumbnails on batch regeneration, etc.


La música ideas portará y siempre continuará

TXP Builders – finely-crafted code, design and txp

Offline

#138 2011-10-12 14:43:55

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

Re: smd_thumbnail: manage multiple thumbnails of your images

maniqui wrote:

Please, could you refresh me a little about what this new feature does? I can’t recall what I may have requested in the past! :)

It was started by Gil with talk of making it work better with ebl_image_edit. Essentially if you have messed around with the cropping of your original Txp thumbnails by using ebl_image_edit, you can use those as the basis for new smd_thumbs instead of the main image.

different versions (not just different sizes) of the “same” image

Nice! If there’s anything you think the plugin could do to help in this regard let me know. I guess I could offer an option to turn off batch regeneration so you have less chance to clobber your thumbs. Then, as long as you have turned off the option to recreate thumbs on image replacement that’s a big step.


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

#139 2011-10-12 15:02:57

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

Re: smd_thumbnail: manage multiple thumbnails of your images

maniquí wrote:

different versions (not just different sizes) of the “same” image

Bloke wrote:

Nice! If there’s anything you think the plugin could do to help in this regard let me know.

I will have to think a bit, but then, I think that the way I approached (different versions of the “same” image stored on each profile) is somehow flawed. It breaks (or brings too far) the “thumbnails” concept. If it’s a different image, then it should be uploaded as a new image.

That being said… it just occurred to me this: there is an “special case” that I’d like you to consider: rotated thumbnails. It seems to fall in the middle between “a different image” and “the same image”.

I foresee the ability of rotating thumbnails both on:

  • a per-image basis. You go to the Edit screen for a particular image, click on a particular thumbnail and then select to rotate it.
  • a per-profile option

In both cases, you have to consider that there are two possible orderings of the steps (rotate & create, create & rotate), so two possible different outcomes:

  • create the thumb for this profile and then rotate it, or
  • rotate the image and then create the thumb

La música ideas portará y siempre continuará

TXP Builders – finely-crafted code, design and txp

Offline

#140 2011-10-12 20:35:46

THE BLUE DRAGON
Member
From: Israel
Registered: 2007-11-16
Posts: 619
Website

Re: smd_thumbnail: manage multiple thumbnails of your images

Bloke wrote:

Thanks maniqui. I’ve put that into v0.22. This release also brings:

  • New preference for creating thumbs from Txp’s main image or its thumbnail (thanks Gil / maniqui)

Sweet! :)
Thanks a lot!
I will give it a try sometime this weekend.

Offline

#141 2011-10-31 15:06:10

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

Re: smd_thumbnail: manage multiple thumbnails of your images

From the help docs:

Active: Enable/disable this thumbnail size so it will/won’t be automatically generated when the next image is uploaded. Click the checkbox to instantly switch the profile on/off. Click the ‘Active’ word in the heading row to toggle the status of all profiles. Note that this setting governs how the All sizes dropdown entry interacts with the Create and Delete buttons

This works as advertised.
It’s a nice feature, particularly because it’s hosting-space friendly, as it let the user upload an image without worrying that a gazillion of (maybe unneeded) thumbnails will be created (assuming the user has a gazillion of smd_thumbnail profiles).
In other words, I find it useful to have active/inactive profiles for when the user uploads a new image, as it avoids the automatic creation of many thumbnails.

Then, I’d find it more useful if the user could still create thumbnail for inactive profiles, on a per-image basis.
So… I wonder if the drop down (the one with “All sizes” and also one option for each active profile, on the “Image -> Edit” screen) could also include the inactive profiles.
User may need to have particular extra thumbnails (created from inactive profiles) for a particular image.

In code terms, I think the only needed change is this, on function smd_thumb_edit:
Original code:

$profiles = array('all' => smd_thumb_gTxt('smd_thumb_all_sizes'));
$thumbs[] = '<div id="smd_thumbs">';
foreach ($rs as $row) {
  if ($row['flags'] & SMD_THUMB_ACTIVE) {
    $profiles[$row['name']] = $row['name'];
  }
  $thumbs[] = smd_thumb_img($row, $currimg);
}

Mod to enable the creation of thumbnails for inactive profiles:

$profiles = array('all' => smd_thumb_gTxt('smd_thumb_all_sizes'));
$thumbs[] = '<div id="smd_thumbs">';
foreach ($rs as $row) {
  $profiles[$row['name']] = $row['name']; // CONDITION WRAPPING THIS LINE REMOVED
  $thumbs[] = smd_thumb_img($row, $currimg);
}

What do you think?

Last edited by maniqui (2011-10-31 15:08:58)


La música ideas portará y siempre continuará

TXP Builders – finely-crafted code, design and txp

Offline

#142 2011-10-31 15:23:57

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

Re: smd_thumbnail: manage multiple thumbnails of your images

maniqui wrote:

I’d find it more useful if the user could still create thumbnail for inactive profiles, on a per-image basis.

I could make it a(nother) preference? A global change like this might be otherwise confusing: you’re switching off a profile so it should, imo, be permanently off for all interactions unless you specifically say otherwise. How about something like:

Override disabled profiles: {o} never  { } for individual images  { } on batch create  { } both

That might be doable if I put some thought into it. Would that work for you? Or is that too confusing? Any better ideas / options?

Last edited by Bloke (2011-10-31 15:25:27)


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

#143 2011-10-31 15:58:22

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

Re: smd_thumbnail: manage multiple thumbnails of your images

A global change like this might be otherwise confusing.

Yes, sorry, I didn’t want to suggest a global change that would change current (expected) behavior. An option should be the way.

you’re switching off a profile so it should, imo, be permanently off for all interactions unless you specifically say otherwise

I know that “having an inactive profile” and “wanting to use it in some way” may sound a bit contradictory.
My thoughts were more on the line of : “Why having an inactive profile if you can’t use it for anything? Won’t it be better to just delete it?”.

As said, I find it useful to have inactive profiles, which avoids, on image upload, massive creation of usually-unneeded thumbnails .

Example:

- user has profiles “square”, “medium”, “small”, “featured”.

- only “square” and “medium” are active, because those are the most commonly used across the website

- user still wants to be able to create “small” and “featured” versions of some images, to use them on other places of the website (directly embedded in article’s body, or maybe associated to an slideshow).

To achieve that, current functionality will imply this workflow:

1) user activates some not-usually-neeeded inactive profiles.
2) user uploads image(s). Thumbnails are created for each active profile.
3) user disables the not-usually-needed profiles again.

Or alternatively, this steps:

1) user uploads image. Thumbnails are created for each active profiles.
2) user activates some not-usually-needed inactive profiles
3) user goes to the editing page for a particular image
4) user creates the extra thumbnails he needs
5) user goes back to image listing and disables (i.e. set to inactive) some profiles

It’s not that following those steps are rocket-science, but they seem more prone to error.

The proposed idea (having the ability to create thumbnails for inactive profiles on a per-image basis) is to allow this workflow:

1) user uploads image(s). Thumbnails are created for each active profile.
2) user goes to the editing page for a particular image
3) user creates some extra thumbnails for the inactive profiles.

Regarding the implementation of an option:

Override disabled profiles: {o} never  { } for individual images

That would be enough, imo.

Last edited by maniqui (2011-10-31 16:00:11)


La música ideas portará y siempre continuará

TXP Builders – finely-crafted code, design and txp

Offline

#144 2011-12-04 02:31:04

ajw-art
Member
Registered: 2010-02-10
Posts: 33

Re: smd_thumbnail: manage multiple thumbnails of your images

I’m using smd_thumbnail to generate several images on my site, including the images in my portfolio. The tricky bit is that the images under a single project aren’t necessarily the same orientation. After thinking about it for a bit I came up with a bit of code that SHOULD work, but I hit another snag— I don’t know if there’s a way to perform greater/lesser than calculations within a txp variable, and that’s an integral part of this plan working. Here’s the code I’m thinking of using:

<txp:images wraptag="ul" class="slides" break="li">
 <txp:variable name="pimage" value="<txp:image_info type="h" />
    <txp:if_variable name="pimage" value="Greater than X, where X is the height of the horizontal thumbnails">
		<txp:smd_thumbnail type="port-detail-large-v" />
  <txp:else />			
		<txp:smd_thumbnail type="port-detail-large" />
</txp:images>

Is there some way to do this in textpattern? Or is there another way to get <smd_thumbnail> to output both vertical and horizontal images for an article?

Edit: Once again, your plugins came to the rescue! After some more research I came across smd_switch, and after some experimentation I came up with this code, which does exactly what I want.


<txp:smd_switch item='<txp:image_info type="h"/>'  debug="1">
   <txp:smd_case type="gt" value="532" fallthru="1">
      <txp:smd_thumbnail type="port-detail-large-v"/>
  </txp:smd_case>
 <txp:smd_case type="lt" value="550">
     <txp:smd_thumbnail type="port-detail-large" />
 </txp:smd_case>
 </txp:smd_switch>
</txp:images>

Thanks Stef!

Last edited by ajw-art (2011-12-04 03:13:56)

Offline

Board footer

Powered by FluxBB