Jump to content

Croppable Image 3


horst

Recommended Posts

I used simple var_dump to debug a bit as I don't know why tracy debug is not working(Please tell me if you have any idea :)). I found that the issue is positioned at ProcessCroppableImage3.module line 234 and 235. isset($this->input->post->quality) and isset($this->input->post->sharpening) are returning false. Thus, the value is returned as options['quality'] instead of user input intval($this->input->post->quality).

// when I choose 60 quality
var_dump($this->input->post->quality, isset($this->input->post->quality), is_numeric($this->input->post->quality), 0<intval($this->input->post->quality), 101>intval($this->input->post->quality));
  
// return : string(2) "60" bool(false) bool(true) bool(true) bool(true)

 

Link to comment
Share on other sites

  • 1 month later...

Updated to latest version PW and CroppableImage3 but old code from templates doesn't work anymore are there code examples to call CroppableImage3 in templates. Thanks!

if($page->mosaik_title_1) { echo "
<div class='three columns'>
<a href='{$page->mosaik_url_1}/'>
<span class='m1'>{$page->mosaik_title_1}</span>
<img src='{$page->mosaic_photo_1->eq(0)->getThumb('thumbnail')}' alt='{$page->mosaic_photo_1->description}' /></a></div>";}

and

foreach($page->children as $child)
            echo "
                <div class='cat1 cat5'>
                <div class='port-item-container'>
                    <div class='port-box'>
                            <a rel='bookmark' title='{$child->title}' href='{$child->url}'>
                            <img src='{$child->overviewimg->eq(0)->getThumb('thumbnail')}' alt='$child->title'>
                            </a>
                    </div>
                    <div class='port-item-title'>
                        <h6>{$child->title}</h6>
                        <span>{$child->overviewtxt}...<a href='{$child->url}'> Lees verder »</a></span>
                    </div>
                </div>
                </div>
                ";
Link to comment
Share on other sites

changing...

<img src='{$child->overviewimg->eq(0)->getThumb('thumbnail')}' alt='$child->title'>

to...

<img src='{$child->overviewimg->eq(0)->getCrop('thumbnail')}' alt='$child->title'>

did not work...

...and give error:

Exception: There is no crop setting for the template 'home' called 'thumbnail' (in /domains/gemsbok.nl/DEFAULT/fresh/site/modules/CroppableImage3/FieldtypeCroppableImage3/FieldtypeCroppableImage3.module line 209)

And have set the crop setting to square,160,160

Link to comment
Share on other sites

37 minutes ago, adrian said:

@Oca2 - please try to avoid double posting and if you do, please follow up on both so people don't try to help you when you've already been helped.

Thanks!

Cheers,
Adrian

Ok will follow up this time and next time avoid double post :)

 

  • Like 1
Link to comment
Share on other sites

No more errors :)

But...

I don't want to go through the update process renaming all images files... to complicated so I will manually update the images...

...But if I select new images from admin they are still not visible on the front-end???

Link to comment
Share on other sites

Check file in attachment, that should rename all your existing files to the new [please do read instructions carefully, make sure you have a back-up]
BTW, I didn't write it, but I have used it a few times, with success.

also, new syntax is + ->url
So, I guess in your case:

<img src='{$child->overviewimg->eq(0)->getCrop('thumbnail')->url}' alt='$child->title'>

Hope this helps....

cropupdate.php

 

Quote

Exception: There is no crop setting for the template 'home' called 'thumbnail' (in /domains/gemsbok.nl/DEFAULT/fresh/site/modules/CroppableImage3/FieldtypeCroppableImage3/FieldtypeCroppableImage3.module line 209)

This is because, when changing from 'CropImage' to 'CroppableImage3', you actually have to re-enter the Crop Settings, in your case 'thumbnail'

  • Like 1
Link to comment
Share on other sites

21 hours ago, Oca2 said:

No more errors :)

But...

I don't want to go through the update process renaming all images files... to complicated so I will manually update the images...

...But if I select new images from admin they are still not visible on the front-end???

Look here, there is complete upgrade procedure with help:

 

Link to comment
Share on other sites

8 minutes ago, horst said:
22 hours ago, Oca2 said:

 

Look here, there is complete upgrade procedure with help:

Thanks for chiming in @horst - I have already linked to that: 

This is the problem with multiple threads for the same issue, :) but I think @Oca2 has the message on that now :)

  • Like 1
Link to comment
Share on other sites

On 1/26/2018 at 1:36 AM, adrian said:

Thanks for chiming in @horst - I have already linked to that: 

This is the problem with multiple threads for the same issue, :) but I think @Oca2 has the message on that now :)

I think it is to complicated... would be nice if this was fixed by a default update... not by hand going through source codes 2 much time and possibility's 2 break stuff.

Link to comment
Share on other sites

Just now, Oca2 said:

I think it is to complicated... would be nice if this was fixed by a default update... not by hand going through source codes 2 much time and possibility's 2 break stuff.

Remember that these modules were built by different developers - CroppbaleImage3 is not an upgrade to the Thumbnails module. The Thumbnails module was abandoned and @horst was kind enough to build this one and also put together a script to make the migration as easy as possible. 

The conversion from Thumbnails to CroppableImage is the only issue I have had with migrating any of my sites from PW 2 to 3 - I think that is pretty incredible for a major version upgrade.

I am not meaning to sound dismissive, I understand it's not a simple migration, but I don't think it should be expected to be automatic in this scenario - I hope you understand.

  • Like 3
Link to comment
Share on other sites

26 minutes ago, adrian said:

Remember that these modules were built by different developers - CroppbaleImage3 is not an upgrade to the Thumbnails module. The Thumbnails module was abandoned and @horst was kind enough to build this one and also put together a script to make the migration as easy as possible. 

The conversion from Thumbnails to CroppableImage is the only issue I have had with migrating any of my sites from PW 2 to 3 - I think that is pretty incredible for a major version upgrade.

I am not meaning to sound dismissive, I understand it's not a simple migration, but I don't think it should be expected to be automatic in this scenario - I hope you understand.

Yes I understand 101% now!

I thought it was a core plugin...

Can't wait to have the code up and running I'm on 50% updating... 50% works :)

This works :)

<img src='{$page->mosaic_photo_2->eq(0)->getCrop('thumbnail')->url}' alt='{$page->mosaic_photo_2->description}' /></a></div>";}

This not :(

<img src='{$child->overviewimg->eq(0)->getCrop('thumbnail')->url}' alt='$child->title'>

 

Edited by Oca2
  • Like 1
Link to comment
Share on other sites

Any chance we can get the addition of a method to check if there has been a crop defined for the image (over the default)? And possibly some way in the admin to reset the crops?

By all means if I get a chance I will look at doing this myself and submitting a pull request.

 

Thansk @horst

Link to comment
Share on other sites

  • 3 weeks later...

There are no such steps. The cropable image and the focus point are completly different things and can be used side by side. 

If you want to drop cai and use focus point, you have to switch the api code in your templates. Before you completely remove cai calls, you may change them to a call to remove variations. But others then that isn't necessary. 

Link to comment
Share on other sites

3 minutes ago, horst said:

There are no such steps. The cropable image and the focus point are completly different things and can be used side by side. 

If you want to drop cai and use focus point, you have to switch the api code in your templates. Before you completely remove cai calls, you may change them to a call to remove variations. But others then that isn't necessary. 

I haven't used the Focus/Zoom yet but I thought that they actually do the same job as Croppable Image 3...

Link to comment
Share on other sites

  • 2 months later...

@horst, sorry to bother you with this (and sorry if it's a dumb question in the first place), but what's the current state of this module like?

I'm in desperate need of "pixel perfect" pre-defined crops, and while the focus and zoom feature is really cool, it solves a different problem entirely. Reading some of the posts here I'm wondering if this module is still something I should go with, or do I just need to wait and hope that @ryan decides to add pre-defined crop areas to the core one day?

Thanks! ?

  • Like 1
Link to comment
Share on other sites

@teppo, This module is ready to use with the current stable and dev versions of PW (3.0.99+). I know that many users (and me too) actively uses it in many sites. It is also simple to use in conjunction with MarkupSourceSet.

So, I think I will not add new features to it, but I will maintain the compatibility of it with future PW versions!

Some time ago, it becomes compatible with new UIKit-AdminTheme. Here is a screen:

screen_cai3_01.thumb.jpg.789512e64e54f920915cdfd021079ab6.jpg

 

  • Like 4
  • Thanks 1
Link to comment
Share on other sites

  • 3 months later...

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