horst

module
Croppable Image 3

134 posts in this topic

Croppable Image 3 (beta)

for PW 3.0.20+

Sponsored by http://dreikon.de/, many thanks Timo & Niko!

You can get it in the modules directory!

Please refer to the readme on github for instructions.

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

For updating from the legacy Thumbnail / CropImage to CroppableImage3 read on here.

20 people like this

Share this post


Link to post
Share on other sites

How the new editor window looks like.

9 people like this

Share this post


Link to post
Share on other sites

This looks great @horst - just one initial request - can we lose the "Wow that looks great" button label and make it simply "Continue" or "Accept" or something similar. And maybe the "Not happy, crop again" link should be a button with "Redo Crop" ?

PS I know these labels are a legacy of the original thumbnails module, but they do sound a little weird to me.

8 people like this

Share this post


Link to post
Share on other sites
15 hours ago, adrian said:

This looks great @horst - just one initial request - can we lose the "Wow that looks great" button label and make it simply "Continue" or "Accept" or something similar. And maybe the "Not happy, crop again" link should be a button with "Redo Crop" ?

PS I know these labels are a legacy of the original thumbnails module, but they do sound a little weird to me.

What have you done Adrian!?!? 

TBH I was surprised that those lived so long. They always made me smile :)

8 people like this

Share this post


Link to post
Share on other sites
8 minutes ago, apeisa said:

What have you done Adrian!?!? 

TBH I was surprised that those lived so long. They always made me smile :)

I was waiting for your response here - sorry about that - no offense intended :)

2 people like this

Share this post


Link to post
Share on other sites

No offense, but oh so many tears. I will get over this. Someday.

3 people like this

Share this post


Link to post
Share on other sites

I'm thinking about to implement a "show historical label texts" module config checkbox. Antti, would this help to get over this a bit faster?

(Some customers really liked that. "Oh, thats so positive! Fine.") :)

 

5 people like this

Share this post


Link to post
Share on other sites

Aren't your module sponsors withdraw seeing this? :)

2 people like this

Share this post


Link to post
Share on other sites

I actually like when software is not so serious. And I think most people do. Or at least it is not stop for success, take a look at MailChimp and Slack for example. 

@horst the legacy labels setting would make my day! 

1 person likes this

Share this post


Link to post
Share on other sites
8 minutes ago, apeisa said:

I actually like when software is not so serious. And I think most people do. Or at least it is not stop for success, take a look at MailChimp and Slack for example. 

@horst the legacy labels setting would make my day! 

Wow - now I feel so boring and serious :)

Seriously (ha ha) though, I think there is a great place for fun elements in software, but I think it's important who it's aimed at and whether they'll see it as fun or just confusing - "you gotta keep it smart people" (dorky TV quote there)!

Getting OT, but why do all phone companies around the world seem to use cute animals in their advertising? I don't see the fun because I can't see the connection - the fun has to be relevant.

3 people like this

Share this post


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

Wow - now I feel so boring and serious :)

Yeah, now I'm thinking about to setup a radio or select with something like:

   "I am serious"

   "I like it funny"

   "I'm brave, surprise me"

 

@apeisa: Yes, that was exactly what one customer said to me a month ago: "Oh, thats nice and not so serious. I like it. It is the same way like Mailchimp do."

3 people like this

Share this post


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

Aren't your module sponsors withdraw seeing this? :)

Haha, I don't hope so!

Share this post


Link to post
Share on other sites

Version 0.9.12

I added a single centralized translation file. It combines all text strings of all module and dependency files. This way it should be easier or lesser work to translate it. (<- hint @ceberlin, @Manfred62, @yellowled :))

@apeisa: Also the legacy and serious text selection is included. (legacy is default!)

 

 

 

6 people like this

Share this post


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

legacy is default!

boo! hiss!

Just kidding :) I actually don't mind it at all now that the crop again option is a button rather than a text link.

1 person likes this

Share this post


Link to post
Share on other sites

Haha! Yep, and also, if you or your customer are more from the serious side, it is only a selection and a save click to change it. :)

Share this post


Link to post
Share on other sites
Quote

this way it should be easier or lesser work to translate it. (<- hint

Ok, I will take care of the translation to DE tonight...

2 people like this

Share this post


Link to post
Share on other sites

Hi Horst,

it's great to see CoppableImage again in PW3!
For me as Superuser all is fine, but if I login with another role (with right "page-edit-image") the modal crop-window switches to the pagetree-view.

1 person likes this

Share this post


Link to post
Share on other sites

Hmmm after installing the new Version I have a problem:

When clicking on "Wow that looks great / Accept" the modal window does not close anymore. It does not close, when I click on the "X" in the upper right corner either.

Plus, there are a few Javascript errors:

InputfieldCroppableImage3.js:31 Uncaught TypeError: Cannot read property 'width' of undefined

I testet in on my Mac with Chrome and Firefox. Same behaviour in both browsers.

Share this post


Link to post
Share on other sites

Here it is working without errors. Also, the relevant part for that hasn't changed between the last versions.

Maybe browser cache issue, or, if that doesn't help. Delete all files and folders under site/modules/CroppableImage3/ ... and copy a fresh one new Version into it, to make sure to have all the latest versions?

I can switch force and back between the two modal windows multiple times, and I also can close it via the buttons and the X.

13 hours ago, Noboru said:

For me as Superuser all is fine, but if I login with another role (with right "page-edit-image") the modal crop-window switches to the pagetree-view.

I will test this and come back here, when done.

Share this post


Link to post
Share on other sites
13 hours ago, Noboru said:

Hi Horst,

it's great to see CoppableImage again in PW3!
For me as Superuser all is fine, but if I login with another role (with right "page-edit-image") the modal crop-window switches to the pagetree-view.

Same behave here, sorry.

What I encountered in short, is: I get different color for the modal windows title bar (?), and it doesn't open the processPage. So, it is an access issue. I need to investigate further. ...

Share this post


Link to post
Share on other sites

Somehow I had lost the permission settings during the rewrite. Also there were a chance for some interfere with the permission of the older Croppable module.

Now I have fixed it with the update to version 0.9.14

But it will not update / correct itself, :(

To get rid of the bug, everyone who has installed a version lesser than 0.9.14 should follow these manual steps:

  1. copy the module files >= 0.9.14 into site/modules/CroppableImage3/
  2. goto admin > modules > site > ProcessCroppableImage3, open it, select uninstall and uninstall it
  3. now refresh the modules cache
  4. and install the ProcessCroppableImage3
  5. open all your user roles that need edit rights for crop images and add the new " image-crop-3 " permission to them

Ready!

For fresh installs of version 0.9.14+, everything works out of the box.

5 people like this

Share this post


Link to post
Share on other sites

Hello Horst,

I got problems with the crop function. I always get the error message "process returns no content" after clicking the cropping button:

Here are the crop settings of my image field:

Screenshot_13.jpg

As you can see I have added pre-defined crop settings to the image field.

And here you can see what happens if I press the crop button:


5xsM3xVPfB.gif

The modal window always shows that no content will be returned. I have tried to catch an error with Tracy Debugger but not luck.

PW: 3.0.32, User: Superuser, PHP 5.6.25, Server: Apache, Croppable image 3: version 0.9.14

Any idea?

Best regards Jürgen

Share this post


Link to post
Share on other sites

How do you have installed it? Was a previous version there before?

If there is no Process installed, that could be because:

the ProcessImageCroppable3 isn't installed or not installed correct. maybe it misses its admin page?

Have you checked that ProcessCroppableImage3 is installed?

Did you have under Admin > Pages > a page with title "Croppable Images 3", and what is its process and name?

 

1 person likes this

Share this post


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

  • Recently Browsing   0 members

    No registered users viewing this page.

  • Similar Content

    • By cosmicsafari
      Hi All,
      Fairly new to ProcessWire so apologies if this is a daft question, but I am having a go creating my first module. I have set it up and enabled it as per the docs.
      However I have created another class within the same module directory, which was going to be used in the main module file but I can't get it to work for the life of me and I believe its due to me not fully understanding the namespace side of things.
      Example:
      MyModule.module.php
      <?php namespace ProcessWire; class MyModule extends WireData implements Module { public static function getModuleInfo() { return array( 'title' => 'Test Module', 'version' => 1, 'summary' => 'Test module', 'href' => '', 'singular' => true, 'autoload' => true, 'icon' => 'exchange', ); } public function newMethod( $testMessage ) { $foo = new Foo($testMessage); $foo->getFoo(); } } Foo.php
      <?php namespace ProcessWire; class Foo { protected $foo; public function __construct($foo) { $this->foo = $foo; } public function getFoo() { return $this->foo; } } Now as I understand it both these files should exist under the ProcessWire namespace, so in theory I should be able to use Foo within MyModule without any use statements as they both exist at the same level within the ProcessWire namespace?
      However when I try something like so:
      $myModule = $modules->getModule('MyModule'); $myModule->myMethod('Foo'); I would have thought this should return 'Foo', however I keep running into errors like:
      Any help would be appreciated.
    • By Max Allan Niklasson
      Hi, I think this is my first topic, even though I've been working with PW a few years. But now, I'm trying to restructure my way of coding, cause many templates (like activities for birding societies) are re appearing in multiple different websites. Since this, I've been working on redo this into a module, but as far as I have read I cannot store the templates (related to specific module) in the module's folder. It has to be in the templates folder?
       
    • By kongondo
      Menu Builder
       
      Modules Directory
      Project Page
      Read Me (How to install, use, etc..)

      If you want a navigation that mirrors your ProcessWire page tree, the system allows you to easily create recursive menus using either vanilla PHP or Soma's great MarkupSimpleNavigation. In some cases, however, you may wish to create menus that:
      1. Do not mirror you site's page tree (hirarchies and ancestry); and
      2. You can add custom links (external to your site) to.

      That is primarily where Menu Builder comes in. It is also helpful if you:
      3. Prefer creating menus via drag and drop
      4. Have a need for menus (or other listings) that will be changing regularly or that you want to allow your admin users to edit.

      The issue of custom menus is not new here in the forums. The difference is that this module allows you to easily create such menus via drag and drop in the Admin. Actually, you can even use it to just create some list if you wanted to. In the backend, the module uses the jQueryUI plugin nestedSortable by Manuele J Sarfatti for the drag and drop and is inspired in part by the WP Custom Menu feature.
       
      Please read the Read Me completely before using this module. 
      For Complex or highly-customised menus, it is recommended to use the getMenuItems() method as detailed in this post.
       
      Features
      Ability to create menus that do not mirror your ProcessWire Page Tree hierarchy/structure Menus can contain both ProcessWire pages and custom links Create menu hierarchies and nesting via drag and drop Easily add CSS IDs and Classes to each menu item on creating the menu items (both custom and from ProcessWire pages) or post creation. Optionally set custom links to open in a new tab Change menu item titles built from ProcessWire pages (without affecting the original page). E.g. if you have a page titled 'About Us' but you want the menu item title to be 'About' Readily view the structure and settings for each menu item Menus stored as pages (note: just the menu, not the items!) Menu items stored as JSON in a field in the menu pages (empty values not stored) Add menu items from ProcessWire pages using page fields (option to choose between PageAutocomplete and AsmSelect [default]) or a Selector (e.g. template=basic-page, limit=20, sort=title). For page fields, you can specify a selector to return only those specified pages for selection in the page field (i.e. asm and autocomplete) For superusers, optionally allow markup in your menu titles, e.g. <span>About</span> Menu settings for nestedSortable - e.g. maxLevels (limit nesting levels) Advanced features (e.g. add pages via selector, menu settings) currently permissible to superadmins only (may change to be permission-based) Delete single or all menu items without deleting the menu itself Lock down menus for editing Highly configurable MarkupMenuBuilder - e.g. can pass menu id, title, name or array to render(); Passing an array means you can conditionally manipulate it before rendering, e.g. make certain menu branches visible only to certain users [the code is up to you!]  Optionally grab menu items only (as a Menu object WireArray or a normal array) and use your own code to create custom highly complex menus to meet any need. More... In the backend, ProcessMenuBuilder does the menu creation. For the frontend, menus are displayed using MarkupMenuBuilder.

      Credits

      In this module's infancy (way back!), I wanted to know more about ProcessWire modules as well as improve my PHP skills. As they say, what better way to learn than to actually create something? So, I developed this module (instead of writing PW tutorials as promised, tsk, tsk, naughty, naughty!) in my own summer of code . Props to Wanze, Soma, Pete, Antti and Ryan whose modules I studied (read copied ) to help in my module development and to Teppo for his wonderful write-up on the "Anatomy of fields in ProcessWire" that vastly improved my knowledge and understanding of how PW works. Diogo and marcus for idea about using pages (rather than a custom db table), onjegolders for his helpful UI comments, Martijn Geerts, OrganizedFellow, dazzyweb and Mike Anthony for 'pushing me' to complete this module and netcarver for help with the code.
       
      Screens

    • By kongondo
      Introducing Variations, an Input- and Fieldtype for product variations and their attributes.
      Product variations is a topic that has been coming up now and then, especially in the recent past.  This module seeks to fill this gap. Though it's in its early stages of development, it is already functional and can be used as is. I decided to make an early announcement (modules development forum) in order to get early feedback from potential users. 
      The module is an alternative take on how variations can be built for a product. Imagine the ubiquitous T-Shirt. The product could vary by ...Size, Colour, Material, etc...These variations could in turn have internal variations, i.e. attributes....so, Size [Small, Large], Colour [Red, Blue]...etc; you get the drift.
      The usual approaches to building variations have been either to use Multiple pages, Repeaters, Page Table, Table or Matrix (limited to 1x1 variations). In this module, we do it a bit differently.
      First, the variations occur not at the Field level (meaning all product pages would have the same variations and attributes for each template) but at the page level. Secondly, there are no multiple pages for each variation and/or attributes; a product is a single page. The variations and their attributes are defined by site editors at the page level. Once a variations configuration has been defined, it is applied to the page and all possible combinations are generated (i.e. the Red,Small,Cotton; Red,Large,Cotton, etc) in the Inputfield. There is no limit to the number of variations and attributes that can be defined, although you will be amazed at how quickly the combinations grow! Prices are entered for each combination when editing the page. Combinations without prices are not saved to the database. Please note that prices cannot themselves vary at the page-level. Meaning, you cannot have ONE variation configuration that has different price inputs per product in the same FieldtypeVariations field.
      The module ships with an API for outputting variation combinations in the frontend. Search, database and in-memory work as normal in the frontend. In the backend, DataTables provides a nice paginated, filterable table. Prices can be entered on any pages (of the table) without loss of data (meaning you can enter prices on page 1, scroll to page 10, enter more prices, filter or search the products table, enter more prices and finally save; no data will be lost).
      I still have a couple of ideas and plans pending but would love to hear from you, thanks.
      Below is a short video demo of the module in its current state. Things may/will change, both UI and features. Btw, the Fieldtype, although primarily targeted at commerce applications, is by no means limited to this. Other uses requiring combinations of whatever number of variables are very much within the remit of the module.
      Planned/Hoped for features
      Import/Export product variations and attributes (Excel, etc) Full integration with Padloper (I will have to  discuss with @apeisa) SKU fields for each product variation Add/Remove extra subfields, e.g. multi-currency prices (currently there is only 1 input for each product variations' price) Product variation images? Etc... Please not this module is not related to this other planned module (but it may eventually).
      Sneak Peek Demo
       
       
    • By bernhard
      hi everybody,
      this is a preview of a module that i'm working on for quite a long time. I needed it for an intranet office management application that i'm still working on. It makes it very easy to create very customized Datatables using the awesome jquery datatables plugin (www.datatables.net)
       
      EARLY ALPHA release!
      It's very likely that there will lots of changes to this module that may cause breaking your implementations.
       
      Module source
      https://gitlab.com/baumrock/RockDataTables2/tree/master
      Screencast:

       
      Remarks:
      The module is intended to be used on the backend. Loading styles is at the moment only done via adding files to the $config->styles/scripts arrays. Also the communicaton to javascript is done via the $config->js() method that is built into the admin and would have to be implemented manually on frontend use. But it would not be difficult of course
       
      Installation:
      Nothing special here, just download + install
       
      Example setup of the most minimal Table:
      you always need 2 files to create a table:
      php file to define the columns and related data (page selector) js file to control the client-side actions like rendering, sorting, etc PHP
      // init datatables module $dt2 = $modules->get('RockDataTables2'); // setup columns // name $col = new dtCol(); $col->name = 'name'; $col->title = 'Name'; $col->data = function($page) { return $page->title; }; $dt2->cols->add($col); // setup table $dt2->id = 'dt_kundenliste'; // give your table an id $dt2->js('/site/modules/ProcessRockProjects/dt_kundenliste.js'); // tell it where to find the related javascript // ################################## // ajax request -> return data // non-ajax -> render table // ################################## if($config->ajax) { // here you can setup your page selector // this will for sure change in the future to support filtering etc echo $dt2->getJSON($pages->find('template=rockcontact, sort=random, limit=10000')); die(); } else return $dt2->render(); JS
      $(document).ready(function() { // setup variables var opt = ProcessWire.config.dt_kundenliste; // options from backend var colDefs = []; // column definitions // custom column definitions here (see https://datatables.net/reference/option/columnDefs for all options) // load default column definitions colDefs = colDefs.concat(dtGetDefaultDefs(opt)); // initialise table $('#dt_kundenliste').DataTable({ ajax: './kundenliste/', columnDefs: colDefs, }); }); that's it - as easy as that!

       
      Customization example:
      in the screencast you see an example that i'm using in a process module. i put the table inside an InputfieldMarkup just to have the same look&feel all around the admin. you see that you could also use this module to create tables quickly and easily using @kongondo s runtime markup module.
      complete PHP code:
      $this->headline('Kundenliste'); $form = $modules->get('InputfieldForm'); // init datatables module $dt2 = $modules->get('RockDataTables2'); // setup columns // name $col = new dtCol(); $col->name = 'name'; $col->title = 'Name'; $col->data = function($page) { return $page->title; }; $dt2->cols->add($col); // type $col = new dtCol(); $col->name = 'type'; $col->data = function($page) { return $page->rockcontact_type->title; }; $dt2->cols->add($col); // modified $col = new dtCol(); $col->name = 'modified'; $col->data = function($page) { $obj = new stdClass(); $obj->timestamp = $page->modified; $obj->display = date('d.m.Y', $page->modified); return $obj; }; $dt2->cols->add($col); // setup table $dt2->id = 'dt_kundenliste'; $dt2->js('/site/modules/ProcessRockProjects/dt_kundenliste.js'); $f = $modules->get('InputfieldMarkup'); $f->value = $dt2->render(); $form->add($f); // ################################## // ajax request -> return data // non-ajax -> render form + table // ################################## if($config->ajax) { echo $dt2->getJSON($pages->find('template=rockcontact, sort=random, limit=10000')); die(); } else $out .= $form->render(); return $out; what is interesting here is this part:
      // modified $col = new dtCol(); $col->name = 'modified'; $col->data = function($page) { $obj = new stdClass(); $obj->timestamp = $page->modified; $obj->display = date('d.m.Y', $page->modified); return $obj; }; $dt2->cols->add($col); datatables support orthogonal data (https://datatables.net/extensions/buttons/examples/html5/outputFormat-orthogonal.html). a date column is a good example, because you need to DISPLAY a formatted date (like 10.02.2017) but you need to be able to SORT this column by a different value (timestamp). its very easy to accomplish this by providing both values in your json. Btw: You could also just transfer the timestamp and do the formatting on the client-side via javascript. Next Example will show ho this would work. Both cases can be necessary, it's just an example here.
      back to topic: now we have both data available and need to tell the table wich data to use for which action. it's easy, just add the definition to the array:
      // modified date colDefs.push({ targets: opt.colnames.indexOf('modified'), render: { _: 'display', sort: 'timestamp', }, }); this tells the datatable to use the display-value for displaying (and filtering) and the timestamp-value for sorting. see https://datatables.net/reference/option/columns.render
      you can also easily modify a simple non-orthogonal data via a render function:
      // name colDefs.push({ targets: opt.colnames.indexOf('name'), render: function ( data, type, full, meta ) { return '<span class="blurry" title="'+data+'">'+data+'</span>'; }, }); this adds the span with "blurry" class to every cell of type "name". i did this to blur all the client data in my screencast
      the complete javascript:
      $(document).ready(function() { // setup variables var opt = ProcessWire.config.dt_kundenliste; // options from backend var colDefs = []; // column definitions // custom column definitions here // see https://datatables.net/reference/option/columnDefs for all options // name colDefs.push({ targets: opt.colnames.indexOf('name'), render: function ( data, type, full, meta ) { return '<span class="blurry" title="'+data+'">'+data+'</span>'; }, }); // typ colDefs.push({ targets: opt.colnames.indexOf('type'), render: function ( data, type, full, meta ) { return '<a href="#" style="white-space: nowrap;">'+data+'</a>'; }, }); // modified date colDefs.push({ targets: opt.colnames.indexOf('modified'), render: { _: 'display', sort: 'timestamp', }, }); // load default column definitions colDefs = colDefs.concat(dtGetDefaultDefs(opt)); // initialise table $('#dt_kundenliste').DataTable({ ajax: './kundenliste/', columnDefs: colDefs, scrollY: "400px", scrollCollapse: true, scrollX: "100%", pageLength: 10, }); }); you can also have scrollbars just by adding options to your datatable. also fixed columns are possible. just see the docs on datatables.net

      Why i created this module:
      of course i know @Soma s module but i needed a lot more features and the newer datatables version. also i like to define all the columns as objects and have everything on one place. lister & markupadmindatatable: nice for basic tables but lacks of features to modify the appearance of the cell values (like rendering icons, background colors and so on) datatables provides a great frontend API for filtering, showing/hiding columns, getting data, modifying it... it also plays well together with frontend charts like google chart api in this case:
       
      todo / roadmap:
      all kinds of column filters (like seen in the example above that shows an older and bloated version of this module) support for ajax filters and pagination (currently all filtering and sorting is done on the client side. i tried it with up to 50.000 rows and got reasonable results. initial loading took around 10sec. but of course this heavily depends on the complexity of your table and your data.