Jump to content
horst

Croppable Image 3

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

Share this post


Link to post
Share on other sites
7 hours ago, horst said:

This is not intended, but its previous state is only saved for jpegs, not for png or gif formats.

Thanks Horst

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

Any plans to get this working for PNG / GIFs?

Share this post


Link to post
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

Share this post


Link to post
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

Share this post


Link to post
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?

 

Share this post


Link to post
Share on other sites
On 12/16/2016 at 10:30 AM, tpr said:

Modules refresh?

Yep - worked, thanks.

It was more like 'Modules refresh' X 5 but I got there

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
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.)

Share this post


Link to post
Share on other sites

That truncated URL suggests to me that you are calling an array of images rather than a single image. Is upgrading PW the only thing you did?

  • Like 1

Share this post


Link to post
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; ?>">

 

Share this post


Link to post
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.

 

 

 

Share this post


Link to post
Share on other sites

Has anyone managed to hide the Crop button? I tried with Admin Custom Files but with no success.

EDIT: Ok I did it with Admin Custom Files.

Share this post


Link to post
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...

Share this post


Link to post
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.

Share this post


Link to post
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

Share this post


Link to post
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

Share this post


Link to post
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

Share this post


Link to post
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

Share this post


Link to post
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?

Share this post


Link to post
Share on other sites

@Macrura thanks, I can confirm that I no longer have the issue after downloading the module from Github manually. 

  • Like 2

Share this post


Link to post
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

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


  • Recently Browsing   0 members

    No registered users viewing this page.

  • Similar Content

    • By gebeer
      I am happy to present my new fieldtype FieldtypeImageFromPage. It is made up of 2 modules:
      Fieldtype Image Reference From Another Page is a Fieldtype that stores a reference to a single image from another page. The image can be selected with the associated Inputfield.
      Inputfield Select Image From Page is an Inputfield to select a single image from images on a predefined page and it's children.
      And there also is a helper module that takes care of cleanup tasks.
      This module evolved out of a discussion about my other Module FieldtypeImagePicker.  It caters for use cases where a set of images is being reused multiple times across a site. With this fieldtype these images can be administered through a chosen page. All images uploaded to that page will be available in the inputfield.
      When to use ?
      Let editors choose an image from a set of images that is being used site-wide. Ideal for images that are being re-used across the site.
      Suited for images that are used on multiple pages throughout the site (e.g. icons).
      Other than the native ProcessWire images field, the images here are not stored per page. Only references to images on another page are stored. This has several advantages:
      one central place to organize images when images change, you only have to update them in one place. All references will be updated, too. (Provided the name of the image that has changed stays the same) Features
      Images can be manipulated like native ProcessWire images (resizing, cropping etc.) Image names are fully searchable through the API Accidental image deletion is prevented. When you want to delete an image from one of the pages that hold your site-wide images, the module searches all pages that use that image. If any page contains a reference to the image you are trying to delete, deletion will be prevented. You will get an error message to help you edit those pages and remove references there before you can finally delete the image. How to install and setup
      Download and install this module like any other modules in ProcessWire Create a page in the page tree that will hold your images. This page's template must have an images field Upload some images to the page you created in step 2 Create a new field. As type choose 'Image Reference From Another Page'. Save the field. In 'Details' Tab of the field choose the page you created in step 2 Click Save button Choose the images field name for the field that holds your images (on page template from step 2) Click Save button again Choose whether you want to include child pages of page from step 2 to supply images Add the field to any template You are now ready to use the field View of the inputfield on the page edit screen:

      View of the field settings

      The module can be installed from this github repo. Some more info in the README there, too.
      In my tests it was fairly stable. After receiving your valued feedback, I will eventually add it to the modules directory.
      My ideas for further improvement:
      - add ajax loading of thumbnails
      Happy to hear your feedback!
       
    • By gebeer
      Although the PW backend is really intuitive, ever so often my clients need some assistance. Be it they are not so tech savvy or they are not working in the backend often.
      For those cases it is nice to make some help videos available to editors. This is what this module does.
      ProcessHelpVideos Module
      A Process module to display help videos for the ProcessWire CMS. It can be used to make help videos (screencasts) available to content editors.
      This module adds a 'Help Videos" section to the ProcessWire backend. The help videos are accessible through an automatically created page in the Admin page tree. You can add your help videos as pages in the page tree. The module adds a hidden page to the page tree that acts as parent page for the help video pages. All necessary fields and templates will be installed automatically. If there are already a CKEditor field and/or a file field for mp4 files installed in the system, the module will use those. Otherwise it will create the necessary fields. Also the necessary templates for the parent help videos page and it's children are created on module install. The module installs a permission process-helpvideos. Every user role that should have access to the help video section, needs this permission. I use the help video approach on quite a few production sites. It is stable so far and well received by site owners/editors. Up until now I installed required fields, templates and pages manually and then added the module. Now I added all this logic to the install method of the module and it should be ready to share.
      The module and further description on how to use it is available on github: https://github.com/gebeer/ProcessHelpVideos
      If you like to give it a try, I am happy to receive your comments/suggestions here.
    • By Robin S
      A module created in response to the topic here:
      Page List Select Multiple Quickly
      Modifies PageListSelectMultiple to allow you to select multiple pages without the tree closing every time you select a page.
      The screencast says it all:

       
      https://github.com/Toutouwai/PageListSelectMultipleQuickly
      https://modules.processwire.com/modules/page-list-select-multiple-quickly/
    • By gebeer
      Hello all,
      sharing my new module FieldtypeImagePicker. It provides a configurable input field for choosing any type of image from a predefined folder.
      The need for it came up because a client had a custom SVG icon set and I wanted the editors to be able to choose an icon in the page editor.
      It can also be used to offer a choice of images that are used site-wide without having to upload them to individual pages.
      There are no image manipulation methods like with the native PW image field.
      Module and full description can be found on github https://github.com/gebeer/FieldtypeImagePicker
      Kudos to @Martijn Geerts. I used his module FieldTypeSelectFile as a base to build upon.
      Here's how the input field looks like in the page editor:

      Hope it can be of use to someone.
      If you like to give it a try, I'm happy to hear your comments or suggestions for improvement. Eventually this will go in the module directory soon, too.
    • By bernhard
      @Sergio asked about the pdf creation process in the showcase thread about my 360° feedback/survey tool and so I went ahead and set my little pdf helper module to public.
      Description from PW Weekly:
       
      Modules Directory: https://modules.processwire.com/modules/rock-pdf/
      Download & Docs: https://github.com/BernhardBaumrock/RockPDF
       
      You can combine it easily with RockReplacer: 
      See also a little showcase of the RockPdf module in this thread:
       
×
×
  • Create New...