Jump to content

Croppable Image 3


horst

Recommended Posts

On 12/6/2016 at 4:00 PM, horst said:

I have upgraded a site yesterday too. Here everything is working as expected. With both, existing and new created images.

(PW 3.0.39 to 3.0.43)

 I have no time to investigate further but this fixes it (line 344)

// if ($image->pagefiles === $pagefiles) {
if ($image->pagefiles->page->id === $pagefiles->page->id) {

Perhaps "===" is the culprit? PHP docs says

Quote

When using the identity operator (===), object variables are identical if and only if they refer to the same instance of the same class.

  • Like 1
Link to comment
Share on other sites

5 hours ago, joey102030 said:

Thanks Horst

Just tried it with a jpeg and it works a treat.

Any plans to get this working for PNG / GIFs?

Plans yes, - but currently no time. It will need a complete redesign of the storage. Currently it is stored with the original files in IPTC, and thats not supported by PNG and GIF.

  • Like 1
Link to comment
Share on other sites

13 hours ago, tpr said:

 I have no time to investigate further but this fixes it (line 344)


// if ($image->pagefiles === $pagefiles) {
if ($image->pagefiles->page->id === $pagefiles->page->id) {

Perhaps "===" is the culprit? PHP docs says

Have updated it now to version 0.9.17. There was another one pending with this part of the code. I thought I had already comitted it. Sorry!

  • Like 2
Link to comment
Share on other sites

Having an issue here too after upgrading from PW 3.X to PW 3.0.44

Firstly I was getting an error about the width of a crop so I replaced the entire site>modules>CroppableImage3 folder with the latest 0.9.17

Now I'm getting the following error 

Error: Uncaught Error: Call to a member function getCrop() on null in /var/www/vhosts/site.com/httpdocs/site/templates/blog-post.php:104
Stack trace:
#0 /var/www/vhosts/site.com/httpdocs/wire/core/TemplateFile.php(268): require()
#1 /var/www/vhosts/site.com/httpdocs/wire/core/Wire.php(374): ProcessWire\TemplateFile->___render()
#2 /var/www/vhosts/site.com/httpdocs/wire/core/WireHooks.php(682): ProcessWire\Wire->_callMethod('___render', Array)
#3 /var/www/vhosts/site.com/httpdocs/wire/core/Wire.php(402): ProcessWire\WireHooks->runHooks(Object(ProcessWire\TemplateFile), 'render', Array)
#4 /var/www/vhosts/site.com/httpdocs/wire/modules/PageRender.module(514): ProcessWire\Wire->__call('render', Array)
#5 [internal function]: ProcessWire\PageRender->___renderPage(Object(ProcessWire\HookEvent))
#6 /var/www/vhosts/site.com/httpdocs/wire/core/Wire.php(376): call_user_func_array(Array, Array)
#7 /var/www/vhosts/site.com/httpdocs/wire/core/WireHooks.php(682): ProcessWire\Wire->_callMethod('___ (line 104 of /var/www/vhosts/site.com/httpdocs/site/templates/blog-post.php) 

This error message was shown because: you are logged in as a Superuser. Error has been logged.

Any suggestions on this one?

 

Link to comment
Share on other sites

  • 1 month later...
  • 2 weeks later...

Anyone using this module with the latest dev (3.051)? After updating from the master branch (3.042 at the time of writing), it no longer points to the full URL of the crops, i.e.

URL in Master: "/site/assets/files/9168/death-of-a-fisherman.675x0-landscape.jpg"
Truncated URL in Dev: "/site/assets/files/9168/"

A modules refresh hasn't fixed this issue.

Link to comment
Share on other sites

On 30.1.2017 at 11:58 AM, jacmaes said:

Anyone using this module with the latest dev (3.051)? After updating from the master branch (3.042 at the time of writing), it no longer points to the full URL of the crops, i.e.


URL in Master: "/site/assets/files/9168/death-of-a-fisherman.675x0-landscape.jpg"
Truncated URL in Dev: "/site/assets/files/9168/"

A modules refresh hasn't fixed this issue.

Can't reproduce that. All is working as expected with 3.0.52 (fresh install from scratch)

How have you updated the version? Have you tried to clear / recreate other caches too? (Modules-Cache, FileCompilercache, etc.)

Link to comment
Share on other sites

@horst Yes, I've refreshed the modules a couple of times, and I've made sure to clear the cache (browser cache + "cache" folder in "assets"). I've tried on three different sites that are very similar, and same problem. 

@adrian Upgrading PW is indeed the only thing I did. Reverting back to the master branch fixes the issue immediately. My field setting is as such: 

field.png

And I'm calling the image this way:

<img alt="<?= $page->title; ?>" src="<?= $page->image->first->getCrop('landscape')->url; ?>">

 

Link to comment
Share on other sites

On 30/01/2017 at 10:58 AM, jacmaes said:

Anyone using this module with the latest dev (3.051)? After updating from the master branch (3.042 at the time of writing), it no longer points to the full URL of the crops, i.e.


URL in Master: "/site/assets/files/9168/death-of-a-fisherman.675x0-landscape.jpg"
Truncated URL in Dev: "/site/assets/files/9168/"

A modules refresh hasn't fixed this issue.

I just had same issue after an upgrade to 3.0.51 and it couldn't be fixed by flushing the Modules.

 

 

 

Link to comment
Share on other sites

On 1/31/2017 at 0:35 PM, Peter Knight said:

I just had same issue after an upgrade to 3.0.51 and it couldn't be fixed by flushing the Modules.

I have the same issue. The module was working great on 3.0.33, then i upgraded to 3.0.52 and the frontend method of getting the crop no longer works;
the images are there in the folders with the suffix, and the backend stuff all works; just can't get the crops to output on the front end for some reason; the method is just returning null;

I have another site on a different server where this is running on 3.0.52 and does work...

Link to comment
Share on other sites

15 hours ago, Macrura said:

I have the same issue. The module was working great on 3.0.33, then i upgraded to 3.0.52 and the frontend method of getting the crop no longer works;
the images are there in the folders with the suffix, and the backend stuff all works; just can't get the crops to output on the front end for some reason; the method is just returning null;

I have another site on a different server where this is running on 3.0.52 and does work...

On one server it is running after upgrading to 3.0.52, on another one not! This is not really a pattern, or is it one?

@Macrura, can you give me access to that one where it is returning null? I use it on my installs and it works all as expected.

Link to comment
Share on other sites

one of these was upgraded from the old cropping module to the new one, and one was started on 3x branch, and just added the cropping module; the module was probably installed after the upgrade to 3.0.52; not sure if any of those things make any difference;

I can get you access to the admin and the FTP - i'm assuming you need both; will PM you in a bit.

  • Like 1
Link to comment
Share on other sites

in the meantime i can see from some quick testing that the getCrop method is getting stuck here:

// return InputfieldCroppableImage3 or null if not found
$inputFieldInstance = $this->_getInputFieldInstance($event);

  • Like 1
Link to comment
Share on other sites

2 minutes ago, Macrura said:

in the meantime i can see from some quick testing that the getCrop method is getting stuck here:

// return InputfieldCroppableImage3 or null if not found
$inputFieldInstance = $this->_getInputFieldInstance($event);

Any chance you are running an old version of the module. That method is no longer used:

https://github.com/horst-n/CroppableImage3/blob/e87b602cffbbdd648a48aa7a4975f927ff58f4d7/FieldtypeCroppableImage3/FieldtypeCroppableImage3.module#L80-L81

  • Like 3
Link to comment
Share on other sites

ok well yes, i was apparently running an older version (weird, just downloaded this from modules directory), but no idea how i had an out-of-date version, and the upgrades module shows nothing about this module...

so this is fixed, by upgrading manually to the version on github

  • Like 3
Link to comment
Share on other sites

2 minutes ago, Macrura said:

the upgrades module shows nothing about this module

I wonder if it has anything to do with using a string for the version number? I am switching my modules over to string version numbers as well, so would be good to know if that is the problem?

Link to comment
Share on other sites

I guess we need to do some testing, with regards to the version number issue? not sure how to conveniently test it though, but could have a look at the upgrades module and try and see why it doesn't even list the CroppableImage3 module...

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