Cropper script not cropping properly

This is the place to discuss bugs that have been found in the most recent version of PivotX. Posting bugs will ensure that the Development Team is aware of them and that they will be addressed when resources are available.

Re: Cropper script not cropping properly

Postby hansfn » Wed Feb 01, 2012 11:49 pm

Of course there is no option to create a thumbnail when you upload an image. It wouldn't be useful.

He-he, but there has always been such an option. In Pivot 1.40.x (always) and in PivotX 2.1.x (only if 'Automatic Thumbnails' were enabled). The setting in PivotX has a very clear explanation: "Automatic Thumbnails - Create thumbnails automatically when uploading images." The auto creation of thumbnails were removed by accident in PivotX 2.2.x when we switched to the plupload image uploader. Enough history.

I'll look at the cropper script and see if we have messed something up. And, Harm, please check if fancybox can behave better for people working the way Schop does - Fancybox should be a drop-in replacement for the default thickbox.
hansfn
Developer
 
Posts: 3282
Joined: Sun Nov 25, 2007 7:48 pm
Location: Molde, Norway

Re: Cropper script not cropping properly

Postby Harm10 » Thu Feb 02, 2012 12:00 am

hansfn wrote:And, Harm, please check if fancybox can behave better for people working the way Schop does - Fancybox should be a drop-in replacement for the default thickbox.

I will if Schop provides me with somewhat more detail or a link on what goes wrong. It could be that he wants the popup logic in the editor changed which is something I was hoping to do some time (but still have to locate the place in the core where to do it).
Quality is in the detail of things............

Want to change or update your PivotX site? Mail or PM me!
I can also convert your site to a Wordpress site!
Harm10
Developer
 
Posts: 2011
Joined: Wed Jun 17, 2009 9:37 am
Location: Somewhere in The Netherlands (aka Holland)

Re: Cropper script not cropping properly

Postby Schop » Thu Feb 02, 2012 2:41 am

Harm10 wrote:
hansfn wrote:And, Harm, please check if fancybox can behave better for people working the way Schop does - Fancybox should be a drop-in replacement for the default thickbox.

I will if Schop provides me with somewhat more detail or a link on what goes wrong. It could be that he wants the popup logic in the editor changed which is something I was hoping to do some time (but still have to locate the place in the core where to do it).


The pop-up logic does not need to change. Like Hans said, the fancybox extension should be a drop-in, out-of-the-box replacement for Thickbox.

The solution is simpler than it looks (I think). The code in snippet_fancybox.php from line 177 to 216 should be changed. If there is a thumbnail, you should assume it has the right size. The html <img> tag does not need the width and height parameters.

To illustrate this: when I setup PivotX and make templates, I take precautions so that thumbs display properly. I make sure they can not get too wide for the area they are supposed to be displayed in. This has always worked great. Thickbox displays the pop-ups like I expect them to. In the example in a previous post in this topic, I showed the thumb of 300 * 240 pixels. My settings in file uploads are: 'width = 300 pixels, height = 999 pixels', so if I upload an image, and use the 'bounded size' option, the thumb will never get wider than 300 pixels. If the user chooses the 'fixed proportions' option, the thumbnail will be 300 * 999 pixels, which is fine, because the user can see that while creating the thumb. If they choose to use 'free crop', they are on their own, which is the intent of that option. So far, everything is fine, the thumbnail is created with the size you want, happiness all around.

Until you activate Fancybox. Because now, it all of a sudden decides that my thumbs need to be displayed 300 pixels * 999 pixels, distorting the aspect ratio of the thumbnail. Trust me, I have not met a user yet that understands this. Even power users, like bloggers on AmsterdamCentraal.nl for example, have questioned this behavior. We had a discussion about it before, and I was not able to get my point across at the time, so I just modified Fancybox.

Summarizing this whole rant: Thumbnails that were created by a user (with whatever method they used: imagetools, automatic, cropper, whatever), should be displayed the way they were created. If I choose to create a 20 * 20 pixels thumbnail, it better be displayed that way, and not distorted by a script.

If you want me to, I can modify snippet_fancybox.php, and we will never have to worry about the issue again.
User avatar
Schop
Contributor
 
Posts: 485
Joined: Mon Apr 21, 2008 1:47 pm
Location: Hudson, Ohio

Re: Cropper script not cropping properly

Postby Schop » Thu Feb 02, 2012 4:39 am

I have one more thing to add. Here is the documentation on how to insert a popup image: http://book.pivotx.net/page/1-4-1#ancho ... es--popups

As you can see, the method I use is not really obscure :)
User avatar
Schop
Contributor
 
Posts: 485
Joined: Mon Apr 21, 2008 1:47 pm
Location: Hudson, Ohio

Re: Cropper script not cropping properly

Postby Harm10 » Thu Feb 02, 2012 9:39 am

Schop wrote:If you want me to, I can modify snippet_fancybox.php, and we will never have to worry about the issue again.
Is not necessary. I get your point (now). I think this behavior has been there for a long time. In essence the change should be: if there is a thumbnail don't specify dimensions according to some fixed setting or if dimensions are needed for whatever reason deduce them from the thumbnail itself. Right?
Quality is in the detail of things............

Want to change or update your PivotX site? Mail or PM me!
I can also convert your site to a Wordpress site!
Harm10
Developer
 
Posts: 2011
Joined: Wed Jun 17, 2009 9:37 am
Location: Somewhere in The Netherlands (aka Holland)

Re: Cropper script not cropping properly

Postby Schop » Thu Feb 02, 2012 12:32 pm

Not sure. This behavior was not in the original Fancybox script, but I thin got put in there after you became the 'owner' of Fancybox :).

Just remove the width and height parameters from the img tag html that is generated. If there is a thumb, is has a width and height. Done.
User avatar
Schop
Contributor
 
Posts: 485
Joined: Mon Apr 21, 2008 1:47 pm
Location: Hudson, Ohio

Re: Cropper script not cropping properly

Postby Harm10 » Fri Feb 17, 2012 2:53 pm

Just released a minor update of extension Fancybox. As the dimensions in the img tag are useful when the content is part of a Cycleshow I left those in place. Instead I changed the default behavior of handling an existing thumbnail to using the found dimensions of the thumbnail. This code was already there and if you pick up Fancybox and don't define anything additional in your config (like fancybox_thumbnail) or add parm thumbbehav to your popup the thumbnail shown will be the one you created yourself.
Is it possible for you to test whether this extension now works like you want it out of the box?
Quality is in the detail of things............

Want to change or update your PivotX site? Mail or PM me!
I can also convert your site to a Wordpress site!
Harm10
Developer
 
Posts: 2011
Joined: Wed Jun 17, 2009 9:37 am
Location: Somewhere in The Netherlands (aka Holland)

Re: Cropper script not cropping properly

Postby Schop » Fri Feb 17, 2012 3:27 pm

I will test it in the next couple of days, although I still do not agree with the chosen solution. Why would Fancybox have certain behavior because another extension relies on it?

If Cycleshow needs thumbs of a certain size, I suggest it handles that with its own setting, or make sure you insert the thumbs for Cycleshow using TimThumb. But maybe I am nitpicking now.
User avatar
Schop
Contributor
 
Posts: 485
Joined: Mon Apr 21, 2008 1:47 pm
Location: Hudson, Ohio

Previous

Return to 2.x Bugs

Who is online

Users browsing this forum: No registered users and 1 guest

cron