Jump to content

PW 3.0.89 – Core updates


ryan
 Share

Recommended Posts

Can't wait to try out the new focus feature!

One question, I haven't tried it, just seen the vid (on the phone now). Does this replace the 'cropping' => 'southeast' from the $options array?

What happens if you crop "ne" at 400 x 200 (from an image 1000 x 800) for example then use the focus tool in the page editor?

This new feature looks like I can throw all my pre-empting out the window, leave crop at centre, just set the size and use focus. Which would be awesome.

  • Like 1
Link to comment
Share on other sites

Great addition, but I have problems focusing images via $page->children call.

Description:

If I output the image on the same page the focus works, but if I call it from another page I cannot get the focused image. Focus is centered in this case.

foreach ($page->children as $child) {
  $image = $child->myimagefield;
  print_r($image->focus());
}

This will lead to following error message:

Call to a member function focus() on null.

Can someone confirm this behaviour?

Best regards

 

 

Link to comment
Share on other sites

OMG just tried it out, this feature is KILLER! :) so much easier now, just set some image defaults (i.e. quality) and leave the rest (cropping to true rather than n, s, se, nw etc.), then just adjust image by image in the admin, amazing.

Thanks @ryan

Unlike @Juergen above, my image field only allows one image and it works fine.

Link to comment
Share on other sites

2 hours ago, SamC said:

Unlike @Juergen above, my image field only allows one image and it works fine.

The cropping works now also fine in my case, the only difference is in outputting the coordinates.

If it is an image array you can use

$image->focus()

but if your image is not in array you have to use

$image->focus

-> without brackets

I was a little bit confused for the first time, because I have used a square crop and therefore the crop focus seems to be in center instead of the coordinates. So I wanted to check if the focus coordinates are still there. Therefore I have needed to output the coordinates.

  • Like 1
Link to comment
Share on other sites

Sorry @Juergen I got my wires crossed here, I'm not using ->focus() at all. Just been messing about in the admin, I output just with:

<?php
  // if page has single image field called 'featuredImage'
  if ($page->featuredImage) {
    // save some typing...
    $image = $page->featuredImage;

    // for demo purposes, don't leave this in!
    $options = array(
      "forceNew" => true
    );
    
    $rec = $image->size(150, 75, $options);
  }
?>



<div class="container py-5">
  <div class="row">
    
    <div class="col">
      <img src="<?php echo $rec->url; ?>" />
      <p>
        Changed width and height</br>
        Width: <?php echo $rec->width() . "px"; ?></br>
        Height: <?php echo $rec->height() . "px"; ?>
      </p>
    </div>

  </div>
</div>

 

  • Like 1
Link to comment
Share on other sites

  • 2 weeks later...
On 27/01/2018 at 6:42 PM, Juergen said:

The cropping works now also fine in my case, the only difference is in outputting the coordinates.

If it is an image array you can use


$image->focus()

but if your image is not in array you have to use


$image->focus

-> without brackets

I was a little bit confused for the first time, because I have used a square crop and therefore the crop focus seems to be in center instead of the coordinates. So I wanted to check if the focus coordinates are still there. Therefore I have needed to output the coordinates.

I would say that is a bug then, there shouldn't be, in my eyes, a difference in syntax between Single Image or Image Array. 

Link to comment
Share on other sites

Thank you Ryan for focus point feature.

Before this, I used option with select field where editor define focus point (crop from top percentages) - but right now it would be more precious and editors will like it more! Thanks.

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...