Jump to content


Photo

Release: Thumbnails

Module

  • Please log in to reply
308 replies to this topic

#61 apeisa

apeisa

    Hero Member

  • Moderators
  • 3,154 posts
  • 1705

  • LocationVihti, Finland

Posted 30 January 2012 - 05:12 AM

I have committed this change at some point: https://github.com/a...135f4fa5824b20f

There are more differences than mouseover/mouseenter (I was using native js-event instead of jQuery), so your fix might well work on all browsers. What I don't understand is why it has broken now? Maybe browser cache with all of us or something like that...?

EDIT: I tested this and it works nice. Thanks Soma for the fix. I merged it in and also removed one unnecessary debug message I had forgotten there.

#62 Soma

Soma

    Hero Member

  • Moderators
  • 5,055 posts
  • 3821

  • LocationSH, Switzerland

Posted 30 January 2012 - 06:20 AM

Glad I could help.

TO my understanding, it wasn't working cause you check for "hover" event in the live method, and then e.type will never return "mouseenter". It's unlike the .hover method which binds mouseenter,mouseleave. Dunno why exactly it is like this, but I guess it should work all well.

I haven't tried but maybe it would require to write .live("mouseenter mouseleave", function ... ) { if (e.type=="mouseenter") .. to make it work with those events.

@somartist | modules created | support me, flattr my work flattr.com


#63 Marty Walker

Marty Walker

    Sr. Member

  • Members
  • PipPipPipPip
  • 476 posts
  • 274

  • LocationKatoomba, AU

Posted 01 February 2012 - 04:21 AM

Hi,

In Chrome and Safari (OS X) this line works:
if( e.type === 'mouseover')
but this line (in the latest commit) doesn't:
if( e.type === 'mouseenter')

I can't test this is Firefox 9 because I can't even log into PW with it.

Regards
Marty

#64 ryan

ryan

    Reiska

  • Administrators
  • 7,797 posts
  • 6572

  • LocationAtlanta, GA

Posted 01 February 2012 - 11:53 AM

I can't test this is Firefox 9 because I can't even log into PW with it.


Why can't you login into PW with Firefox 9? (FF9 is my native browser). Just curious if I've missed something? :)

#65 apeisa

apeisa

    Hero Member

  • Moderators
  • 3,154 posts
  • 1705

  • LocationVihti, Finland

Posted 01 February 2012 - 12:17 PM

Hi,

In Chrome and Safari (OS X) this line works:

if( e.type === 'mouseover')
but this line (in the latest commit) doesn't:
if( e.type === 'mouseenter')

I can't test this is Firefox 9 because I can't even log into PW with it.

Regards
Marty


Marty, there shouldn't be any mouseenter left (https://github.com/a...eldCropImage.js). Are you sure that isn't coming from browser cache?

#66 Marty Walker

Marty Walker

    Sr. Member

  • Members
  • PipPipPipPip
  • 476 posts
  • 274

  • LocationKatoomba, AU

Posted 01 February 2012 - 04:08 PM

Hi Antti,

I used soma's code line from the previous page. I've double-checked that the InputfieldCropImage.js isn't cached. I just tried that line with 'mouseenter' instead of 'mouseover' in Firefox 10 and I don't get the image hovers.

Scratch that. It appears to be work now. I was at this for an hour yesterday. All's good now.

@ryan I reinstalled it (now to FF10) and it works fine now. No idea why it stopped me logging in even after FF's numerous updates recently.

Regards
Martin

#67 Marty Walker

Marty Walker

    Sr. Member

  • Members
  • PipPipPipPip
  • 476 posts
  • 274

  • LocationKatoomba, AU

Posted 02 February 2012 - 08:47 PM

Sorted.

#68 Pete

Pete

    Forum Admin

  • Administrators
  • 2,422 posts
  • 1455

  • LocationChester, England

Posted 28 February 2012 - 05:14 PM

I might be taking things a bit far with my latest idea, but I have plenty of scenarios where I on;y want a specific crop to be available to the first image in a list of images and not the rest, and then have a different crop available for the rest and not the first one (so first thumbnail bigger than the rest).

I was thinking of trying to re-jig the code I did to allow crops to be tied to specific templates to something like this:

big_thumbnail,300,200,news:first,article
small_thumbnail,160,100,news:!first,article

So in the code above, for the news template a colon separates the template name from a keyword - first - so the big thumbnail is only available as an option for the first image in the list. In the second config row for the small thumbnail, it is !first, with the exclamation mark meaning NOT (as it does in PHP).

Both crops are available for all images in the article template as no image-specific setting is specified for that template.

I did quickly look into this a few weeks ago and it looked a bit more complicated than the previous code change I did, but I don't think it's impossible.

The only concern I can see here is that as soon as you re-order the images, the first image in a list might be further down the list, so I'm not sure what to do there. Maybe I should just assume that people would click Save once they've re-ordered the page and then they can re-select their crops as normal? I think that that would be a small price to pay for the additional functionality - especially since not a lot of people may find it useful, but I hope others might see the benefits and have some usage scenarios in mind too :)

Anyway, it's not high up my list of priorities, but I thought I'd see who else is interested in this.

#69 Marty Walker

Marty Walker

    Sr. Member

  • Members
  • PipPipPipPip
  • 476 posts
  • 274

  • LocationKatoomba, AU

Posted 28 February 2012 - 07:02 PM

A site I built in EE a while back had a similar scenario. I had a few rows of images with a check box next to each that, when checked, made that image the hero image. I haven't tried this but could you not use the repeater field with the thumbnails and check box field to say use this image's large thumbnail and use the smaller thumbnail for the remaining images?

I haven't played with the repeater field yet so I might be talking nonsense.

#70 Pete

Pete

    Forum Admin

  • Administrators
  • 2,422 posts
  • 1455

  • LocationChester, England

Posted 29 February 2012 - 03:59 AM

That's kind of what I'm trying to do, but hide the thumbnail links when they're not needed to avoid confusion - that's what this next bit of code would do :)

#71 PawelGIX

PawelGIX

    Jr. Member

  • Members
  • PipPip
  • 20 posts
  • 12

  • LocationPoland

Posted 08 March 2012 - 03:01 PM

I was thinking of trying to re-jig the code I did to allow crops to be tied to specific templates to something like this:

big_thumbnail,300,200,news:first,article
small_thumbnail,160,100,news:!first,article


I think that would be better to set up a a thumbnail by the form field. Configuration would be more flexible.
I have cases where a template has multiple images in different sizes.
In the current approach. I set a thumbnail based on the template. For each field, I get three dimensions.


Maybe it would be better in this way:
// article_tpl template
thumb_100x100,100,100,field_name_img1
thumb_300x300,300,300,field_name_img2
thumb_500x500,500,500,field_name_img3



// and in the news_tpl
thumb_150x150,150,150,field_news_img1
thumb_350x350,350,350,field_news_img2,other_field_name_img2
thumb_550x550,550,550,field_news_img3

Or in this way:
// article template
thumb_100x100,100,100,template_name[field_name_img1]
thumb_300x300,300,300,template_name[field_name_img2],template2_name[field_name2_img2]
thumb_500x500,500,500,template_name[field_name_img3]


It may even be better to move the configuration to the form field settings?

#72 Pete

Pete

    Forum Admin

  • Administrators
  • 2,422 posts
  • 1455

  • LocationChester, England

Posted 09 March 2012 - 02:15 AM

That would be nIce, I agree, but not too simple the way the module currently works.

Now that PW has per-field settings for the same field on different templates I can see how something like that could work - I just have no idea how to code it ;)

#73 apeisa

apeisa

    Hero Member

  • Moderators
  • 3,154 posts
  • 1705

  • LocationVihti, Finland

Posted 09 March 2012 - 02:33 AM

I agree that template level settings would be a nice improvement. Unfortunately I don't have any time in short term with this module (other than possible bug fixes).

#74 PawelGIX

PawelGIX

    Jr. Member

  • Members
  • PipPip
  • 20 posts
  • 12

  • LocationPoland

Posted 09 March 2012 - 03:49 PM

I made some changes to this module. I moved to CropImage configurations. Own unique configuration for each field. You can have multiple fields in a template with different settings.
Limiting scope to the template is still possible.
thumb,100,200,basic-page is still possible.

Here is fork https://github.com/PawelGIX/Thumbnails

#75 apeisa

apeisa

    Hero Member

  • Moderators
  • 3,154 posts
  • 1705

  • LocationVihti, Finland

Posted 09 March 2012 - 04:01 PM

Great stuff Pawel, thanks for working on this. Feel free to send pull request. I think this is improvement that everyone wants!

PS: This is module is becoming pretty nice community effort: three different developers + one sponsoring. And also using one third party open source tool, jCrop.

#76 PawelGIX

PawelGIX

    Jr. Member

  • Members
  • PipPip
  • 20 posts
  • 12

  • LocationPoland

Posted 09 March 2012 - 07:53 PM

I wonder about change configuration to the JSON format.
In this way, we could provide more options for the site administrator. But the configuration becomes more difficult :/

[
   {
      "name": "my new thumb",
      "template": [ "basic-page", "home" ],
      "aspectRatio": 1,
      "minSize": [100,100],
      "maxSize": [  200,200 ]
   },
   {
      "name": "small thumb",
      "aspectRatio": null
   },
   {
      "name": "thumbnail2",
      "width": 100,
      "height": 200
   }
]

What do you think about this?

#77 Pete

Pete

    Forum Admin

  • Administrators
  • 2,422 posts
  • 1455

  • LocationChester, England

Posted 10 March 2012 - 03:23 AM

I do like the idea of Min and max size as it is currently possible to create a small crop that is actually enlarged on the site.

I'll have a think about config later and see if I can come up with a suggestion.

#78 PawelGIX

PawelGIX

    Jr. Member

  • Members
  • PipPip
  • 20 posts
  • 12

  • LocationPoland

Posted 10 March 2012 - 05:52 AM

I do like the idea of Min and max size as it is currently possible to create a small crop that is actually enlarged on the site.

This is something else.
jCrop Documentation
jCrop allows you to specify the dimensions of graphics that you cut.
You can allow for example 100x200px MIN or 100x500px MAX for images in siebar. This way you can cut the picture of a different height but fixed width 100px.

#79 Pete

Pete

    Forum Admin

  • Administrators
  • 2,422 posts
  • 1455

  • LocationChester, England

Posted 10 March 2012 - 09:17 AM

Back when I played with it a few years ago, you could set the crop box to be the actual crop size (so if you uploaded a 1600x1280 image and your image is to be cropped to 320x200, it can give you a starting box that size that you can't make any smaller, but could make bigger proportionally - that's what I was talking about (although I suspect you already worked that out ;)).

If accidentally uploading images that are smaller than the crop the crop box could just scale down so it uses up as much of the image as possible or something.

Just an idea - it all works fine as it is and I'm looking forward to playing with the per-field settings later today/tomorrow :) Just out of interest, to the per-field settings work in the new per-template settings that ryan introduced recently for things like naming the same field differently for different templates? Being able to have just one "images" field and set the settings for that field in the many templates I use it in would be awesome :)

#80 PawelGIX

PawelGIX

    Jr. Member

  • Members
  • PipPip
  • 20 posts
  • 12

  • LocationPoland

Posted 10 March 2012 - 05:01 PM

If accidentally uploading images that are smaller than the crop the crop box could just scale down so it uses up as much of the image as possible or something.

I think we should have "Min Image Dimensions" as we have "Max ImageDimensions". You should get a message that the image is too small.


Just an idea - it all works fine as it is and I'm looking forward to playing with the per-field settings later today/tomorrow :) Just out of interest, to the per-field settings work in the new per-template settings that ryan introduced recently for things like naming the same field differently for different templates? Being able to have just one "images" field and set the settings for that field in the many templates I use it in would be awesome :)

I looked at these new features and I do not think it was possible for now.
I do not know how to add a field to be visible in chosen context. Maybe Ryan knows how :].

But you can do this right now in this way:
thumbnail,200,200,basic-page,home
big_thumbnail,500,500,other_template_name
medium_thumbnail,300,300,post_template






Also tagged with one or more of these keywords: Module

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users