Jump to content

Recommended Posts

Posted

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
Posted

Good to hear you and your family are doing fine Ryan. As always nice solution for a problem which seems to resolved by fixed crops, but this is a way better UX for the content editors. 

  • Like 2
Posted

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

 

 

Posted

The image is there and now I get the focus coordinates if I remove the brackets.

This works:

print_r($child->singleimage->focus);

but this not:

print_r($child->singleimage->focus());

 

Posted

I use 7.0.27. I have croppable image installed too. My first thought was that there is an interference between the default image field and croppable image 3.

Posted

Strange behavior, I have to investigate further. What I also have discovered is that the duplicate action is no longer present in the dropdown. ???

Posted

Ok I found the cause. There was a wrong setting in my image field.

You have to set it to output an array of elements instead of a single element.

My image field only allows 1 image so I set it to auto. This caused the behavior.

Posted

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.

Posted
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
Posted

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
  • 2 weeks later...
Posted
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. 

Posted

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.

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.
×
×
  • Create New...