Jump to content
horst

Croppable Image 3

Recommended Posts

6 hours ago, Robin S said:

@horst, what if you create a new module file/class in the root of the CroppableImage3 directory named 'CroppableImage3', and that class does nothing apart from auto-install the other classes?

Not ideal of course but might be an okay workaround seeing as you are stuck with the existing directory name.

Was allready done. It resulted in not correctly installing all needed dependencies (with a wrapper class: three). It only installed two out of three, then complaining about the missing one. System broken! :(

Share this post


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

It resulted in not correctly installing all needed dependencies (with a wrapper class: three). It only installed two out of three, then complaining about the missing one.

Taking the current version of CI3 and adding this 'CroppableImage3.module' file in the module root enabled all the dependent modules to be installed/uninstalled in one go without any major problem for me:

<?php namespace ProcessWire;

class CroppableImage3 extends WireData implements Module {

    public static function getModuleInfo() {
        return array(
            'title'    => 'Croppable Image 3',
            'summary'  => 'One or more image uploads (optional predefined crops)',
            'author'   => 'Horst Nogajski',
            'version'  => '1.1.5',
            'requires' => 'ProcessWire>=3.0.20, PHP>=5.3.8',
            'installs' => 'FieldtypeCroppableImage3, InputfieldCroppableImage3, ProcessCroppableImage3',
            'icon'     => 'crop'
        );
    }

    public function ___uninstall() {
        // Remove related modules on uninstall - not essential
        $this->modules->uninstall('FieldtypeCroppableImage3');
        $this->modules->uninstall('InputfieldCroppableImage3');
        $this->modules->uninstall('ProcessCroppableImage3');
    }

}

Tracy picks up a few minor PHP notices coming from ProcessCroppableImage3 during install/uninstall but should be simple enough to iron those out. Lines 344 & 349 on install, lines 48 & 49 on uninstall - I think these notices occur with the current version too.

If you went this way you could consider moving FieldtypeCroppableImage3.module back into a subfolder just to keep things tidy.

Also, after adding this file the Upgrades module detects CroppableImage3.

  • Like 1

Share this post


Link to post
Share on other sites

That's what I made in Version 1.1.0: https://github.com/horst-n/CroppableImage3/commit/6a52e7726170bf3d81981c1d0da9cc247bbaa1b0

-------

Ok, your test was on a first install of the module, and not as an upgrade, yes?

How does it work out for those who have installed a version prior to 1.0.0? Thats the most common and important situation!

You have installed the 3 modules, each in its subfolder or not, but Fieldtype... is the main module, than you use the update module button, (you will need an existing wrapperclass CroppableImage3.module in the github repo for this to work!). <= Thats what I have tried already and it hasn't worked for me. Always left one dependency uninstalled.

But I will try this once more, as 1.1.6, - just to check if my test with 1.1.0 / 1.1.1 wasn't interfered with another issue that made it broken.

Many thanks for your support @Robin S ! :)

Share this post


Link to post
Share on other sites
41 minutes ago, horst said:

Ok, your test was on a first install of the module, and not as an upgrade, yes?

Yes, it was just a test of a first install. But just now I forked the module and added the new CroppableImage3.module to the module root (nothing else). With the current CI3 version already installed I installed the modified module via "Add Module From URL": https://github.com/Toutouwai/CroppableImage3/archive/master.zip

This seemed to work without a hitch. Installing via the Upgrades module is perhaps a little different, but I have no way to test that.

  • Like 1

Share this post


Link to post
Share on other sites

Anyone else experiencing this issue with the UiKit backend? :-( Any fixes? 

croppableimage3-uikit.jpg

Share this post


Link to post
Share on other sites

Due to less time, I will wait until the UIKit Admin is official / stable, before trying to locate and fix incompatibilities. But any pull request is welcomed.

Share this post


Link to post
Share on other sites
Just now, horst said:

Due to less time, I will wait until the UIKit Admin is official / stable, before trying to locate and fix incompatibilities. But any pull request is welcomed.

Thank you! :-)

  • Like 1

Share this post


Link to post
Share on other sites
3 hours ago, Robin S said:

This seemed to work without a hitch. Installing via the Upgrades module is perhaps a little different, but I have no way to test that.

I will test that again later on, thanks Robin!

Share this post


Link to post
Share on other sites

@Robin S, please can you test an update from an installed version prior to 1.1.0?

I have updated the github repo to 1.1.7.

The first "update" has to be done by installing via ClassName in side -> modules -> new: Module Class Name = CroppableImage3

It has worked for me this way. Existing directory was changed / updated with all new files, old unused files were removed.

And now, after that, it is recognized by the updater module! Yeah!

  • Like 3

Share this post


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

The first "update" has to be done by installing via ClassName in side -> modules -> new: Module Class Name = CroppableImage3

Yep, all went smoothly with an update from v1.0.0 beta - nice one :-)

  • Like 2

Share this post


Link to post
Share on other sites

Here are the latest "official" notes ;)

 

-------------------------------------------------------------------------

 

Updating from prior versions:

 

Updating from Croppable Image 3 with versions prior to 1.1.7, please do this as a one time step:

In the PW Admin, go to side -> modules -> new, use "install via ClassName" and use CroppableImage3 for the Module Class Name. This will update your existing CroppableImage3 module sub directory, even if it is called a new install. After that, the module will be recogniced by the PW updater module, what makes it a lot easier on further updates. :)

 

-------------------------------------------------------------------------

 

Sticking with a PW legacy 2.8.20+ Version (none namespaced)?

- I have created a CroppableImage2 snapshot, which you can get from the github repo branch: CroppableImage2 


-------------------------------------------------------------------------

  • Like 3

Share this post


Link to post
Share on other sites
On 15.10.2016 at 5:00 PM, horst said:

Maybe the setting is not relevant, but saving it one time before open the cropper modal?

I need to test this.

Hey horst.

Really awesome module!! Guess I stumbled upon it once before, but sadly didn't take the time to really check it out.

Anyways... just installed it and saw the same warning as ukyo before "Notice: Undefined property: stdClass::$manualSelectionDisabled". Going to settings screen and hit Submit resolved it. I'm on 3.0.62.

Keep up the good work!

  • Like 1

Share this post


Link to post
Share on other sites
On 3.9.2016 at 7:59 PM, horst said:

It isn't designed to support this. But I also don't see much disadvantage for this usecase. Lets assume the width you want to support is 1400, 960, 480.

  • Setup the image field with min-width: 1400 and min-height: 788  (= 1400 / 16 * 9)
  • Create a cropsetting image16x9,
  • call it with 100% quality as master-source for the variations

$master = $page->images->first()->getCrop("image16x9", "quality=100");
$large = $master->width(1400);
$medium = $master->width(960);
$small = $master->width(480);

Or directly use the markup srcset module from @tpr and only pass the master to it!

This is what also works for me! But my problem now is, when the user changes the cropping area and saves the image the thumbnail variations are not reset / deleted. Any way this could be done automatically? 

593f99cea0be2_Bildschirmfoto2017-06-13um09_52_12.png.49fc66baf51d7dc7380c3a7665bbaad8.png

Share this post


Link to post
Share on other sites

Not really sure about it, but your cropnames uses - chars, what may conflict with the pageimage suffixes. Suffixes are concatenated with the - char. Maybe you can try to change your names from 3-zu-1 to 3zu1?

Share this post


Link to post
Share on other sites

No, that does not make a difference. I have to manually delete the variations anyway. 

In the file FieldtypeCroppableImage3ConfAdaptor.php there is a unused function called doTheDishes($deleteVariations=false) but as I see it this is nowhere called.

 

Share this post


Link to post
Share on other sites

It isn't unused, it is called everytime the settings get changed. And it do the dishes. :)

Share this post


Link to post
Share on other sites
On 6/13/2017 at 1:51 PM, horst said:

Oh, sorry, your are right. This one is old stuff. It is superseeded by: https://github.com/horst-n/CroppableImage3/blob/0946fdce7b1c9859f94adf764df80d73c201bbbc/FieldtypeCroppableImage3/FieldtypeCroppableImage3.module#L364-L365

And this one cleans out every obsolete variation on setting changes.

I think it's a different thing what @dreerr is talking about.

Consider this scenario:

  1. Set a crop setting on an Image field, eg. "work-thumb, 320, 270"
  2. Use it with a srcset solution (either with a module or manually) and that will make you a 320x270 image and some variations - let's assume only one, 160x135:
    image.-work-thumb.jpg
    image.-work-thumb.160x135.jpg

     

  3. Now edit the image again and crop a different part. The results:

    image.-work-thumb.jpg <- changes according to the new crop
    image.-work-thumb.160x135.jpg <- no change!

     

I'm also interested in a solution because CI3 can't be used for srcset purposes atm if I get it right. What I could imagine as a simple fix is that when CI3 saves a new crop it would delete any size variation of it (in this example all images that are named "image.-work-thumb.WIDTHxHEIGHT.jpg"). Then the srcset generators could re-create these size variations again. Perhaps this behavior could be optionally set in the module's settings.

  • Like 5

Share this post


Link to post
Share on other sites

Hi @tpr,
I will look into this and add a solution that will work properly together with markup-srcset, (and other cases).
Thanks for the clarification. :)

  • Like 6

Share this post


Link to post
Share on other sites
42 minutes ago, horst said:

@mauricemoss, @ukyo, @dreerr, @tpr

I have uploaded an update to the github repo that fixed the PHP notices and added removal of CropImage children after creating a new CropImage.

I've just upgrade it to the new version. I selected my thumbnail predefined crop and then I cropped a new area of the thumbnail but NONE of the variations removed. What I'm doing wrong?

Share this post


Link to post
Share on other sites

Thanks @horst, just checked and I can verify it works as expected!

A few things (nothing biggie):

  • the original image seems to get a new modified date in the filesystem. Is it necessary or a bug?
  • I would love to see a tiny preview of the cropped image (without hover). Would it be possible to append eg. a 0x48px (or so) thumbnail image to the crop size name? Just to have a small indication how it looks like.
  • Tracy shows a PHP notice in the main module's settings page: "PHP Notice: Undefined index: sharpening in .../FieldtypeCroppableImage3ConfAdaptor.php:96"

Anyway I'm happy this issue is fixed, now I can continue uploading images to a site that I put aside. Thanks again!

  • Like 2

Share this post


Link to post
Share on other sites
1 hour ago, tpr said:

Thanks @horst, just checked and I can verify it works as expected!

A few things (nothing biggie):

  • the original image seems to get a new modified date in the filesystem. Is it necessary or a bug?
  • I would love to see a tiny preview of the cropped image (without hover). Would it be possible to append eg. a 0x48px (or so) thumbnail image to the crop size name? Just to have a small indication how it looks like.
  • Tracy shows a PHP notice in the main module's settings page: "PHP Notice: Undefined index: sharpening in .../FieldtypeCroppableImage3ConfAdaptor.php:96"

Anyway I'm happy this issue is fixed, now I can continue uploading images to a site that I put aside. Thanks again!

The originals timestamp gets updated because the new settings for the croprectangle (x/ypos & width/height), and sharpening & quality values get stored into dedicated IPTC-fields. (ATM, for jpeg only, what also is the reason for thinking about other solutions)

Tiny previews is a nice idea. If you don't mind I will take your suggestion and bring it into the module.

Will fix that asap.

Many thanks for checking and suggestions! <3

  • Like 2

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
      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:
       
    • By ukyo
      FieldtypeFontIconPicker
      Supported Icon Libraries
      FontAwesome 4.7.0 Uikit 3.0.34 IonicIcons 2.0.1 Cahangelog
      NOTE: Module store data without prefix, you need to add "prefix" when you want to show your icon on front-end, because some of front-end frameworks using font-awesome with different "prefix".
      Module will search site/modules/**/configs/IconPicker.*.php and site/templates/IconPicker.*.php paths for FieldtypeFontIconPicker config files.
      All config files need to return a PHP ARRAY like examples.
      Example config file : create your own icon set.
      File location is site/configs/IconPicker.example.php
      <?php namespace ProcessWire; /** * IconPicker : Custom Icons */ return [ "name" => "my-custom-icons", "title" => "My Custom Icon Set", "version" => "1.0.0", "styles" => array( wire("config")->urls->templates . "dist/css/my-custom-icons.css" ), "scripts" => array( wire("config")->urls->templates . "dist/js/my-custom-icons.js" ), "categorized" => true, "attributes" => array(), "icons" => array( "brand-icons" => array( "title" => "Brand Icons", "icons" => array( "google", "facebook", "twitter", "instagram" ) ), "flag-icons" => array( "title" => "Flag Icons", "icons" => array( "tr", "gb", "us", "it", "de", "nl", "fr" ) ) ) ]; Example config file : use existing and extend it.
      File location is site/configs/IconPicker.altivebir.php
      <?php namespace ProcessWire; /** * IconPicker : Existing & Extend */ $resource = include wire("config")->paths->siteModules . "FieldtypeFontIconPicker/configs/IconPicker.uikit.php"; $url = wire("config")->urls->templates . "dist"; $resource["scripts"] = array_merge($resource["scripts"], ["{$url}/js/Altivebir.Icon.min.js"]); $resource["icons"]["flag-icons"] = [ "title" => "Flag Icons", "icons" => array("tr", "en", "fr", "us", "it", "de") ]; $resource["icons"]["brand-icons"]["icons"] = array_merge($resource["icons"]["brand-icons"]["icons"], array( "altivebir" )); return $resource; After you add your custom config file, you will see your config file on library select box. Library Title (Location Folder Name).

      If your library categorized and if you have categorized icons set like uikit and fontawesome libraries, you will have category limitation options per icon field or leave it empty for allow all categories (default).

      Example : output
      if ($icon = $page->get("iconField")) { echo "<i class='prefix-{$icon}' />"; } MarkupFontIconPicker Usage
      // MarkupFontIconPicker::render(YourIconField=string, Options=array) echo MarkupFontIconPicker::render($page->YourIconField, [ 'prefix' => 'uk-icon-', // Icon class prefix, if you have different prefix, default is : "fa fa-" 'tag' => 'span', // Icon tag default is : "i" 'class' => 'fa-lg', // If you have extra cutom classes, for example : icons sizes, Array or Sting value 'style' => 'your custom styles if you have' // Array or String Value ]); Theme support

      Search support

      Category support

       
×
×
  • Create New...