felixthecat

Zoom limited to 50% in Admin Imagefield

Recommended Posts

Hello,

I really like the new Features Focus and Zoom. Unfortunately the Zoom is limited to 50%. I looked in the sourcecode an found it hard coded in the file InputfieldImage.js zoomSlider.slider component. Any Chance to get the full range from 0 to 100.

Thanks

Share this post


Link to post
Share on other sites

I just looked at it and it not as easy as just changing that value. I've also found that annoying, but I guess the reason is not to get pixelated results...

Share this post


Link to post
Share on other sites
2 hours ago, felixthecat said:

Hello,

I really like the new Features Focus and Zoom. Unfortunately the Zoom is limited to 50%. I looked in the sourcecode an found it hard coded in the file InputfieldImage.js zoomSlider.slider component. Any Chance to get the full range from 0 to 100.

Thanks

 

Nope. 100% would be 0 px, what is not useful. 🙂

Also in different tests it showed that more then 50% maybe very often lead to unwanted results. The max percent what seemed to be useful (for very careful) users was 70%. My bet is, that Ryan uses 50% to support it as a good and successful feature to a broad community.

Share this post


Link to post
Share on other sites
3 minutes ago, bernhard said:

I just looked at it and it not as easy as just changing that value. I've also found that annoying, but I guess the reason is not to get pixelated results...

Yep, if I remember right, you also would have to change code in php files that processes the zoomed variations.

Share this post


Link to post
Share on other sites

Maybe also there. The preview was also wrong on the client side, so there's something more to change in the js file.

Share this post


Link to post
Share on other sites

Yes i know the ImageSizerEngine php file calculates the scale with the function $scale = 1 + (($zoom / 100) * 2);
and limits the zoom values from 2 to 70.
I am using my own custom function to calculate a crop/zoom and build a image. I think it would be more logical to have a zoom-range from 0%-100% or 0.0-1.0. Where 100% means return the full image and 0% is an 0px image 🙂

Anyway... is there some sort of "javascript hook" to change the slider component max value without manipulating the source files?

Thank you

Share this post


Link to post
Share on other sites
46 minutes ago, felixthecat said:

Anyway... is there some sort of "javascript hook" to change the slider component max value without manipulating the source files?

I don't think so, I think the best option would be a pull request 🙂

Share this post


Link to post
Share on other sites

@bernhard i give it a try

here a temporary hacky solution based on somas article about custom js in admin:

http://soma.urlich.ch/posts/custom-js-in-processwire-admin/

 

// site/templates/admin.php

$modules->get('JqueryCore');
$config->scripts->add($config->urls->templates . "scripts/changezoom.js");
require($config->paths->adminTemplates . 'controller.php'); 

// site/templates/scrips/changezoom.js

$(function() {
    $("button.InputfieldImageButtonFocus").click(function() {
        setTimeout (function() { 
            $(".focusZoomSlider" ).slider({max:99})
        },
        200);     
      });
});

 

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Recently Browsing   0 members

    No registered users viewing this page.