Jump to content

CroppableImage


horst

Recommended Posts

just read the whole thread - this seems to happen somethimes...check forceNew also.

was off and i've put this in my config.php

/**
 * ImageSizer options
 */
$config->imageSizerOptions = array(
	'forceNew' => true, // force create new thumbs/images
);

But no effect - even it shouts that forceNew is true.

Important hint could be that i use the imagefields with a PageTable field...but on my local Installation all works??

Link to comment
Share on other sites

without looking into the code, - maybe it will work when you select the array of items as formatted return value, under FIELDS -> images -> Details -> Formatted Value. (?)

BTW, this module is in alpha state. ;-)

  • Like 2
Link to comment
Share on other sites

YOU SAVED MY LIFE TONIGHT...;)

works if i changed from "AUTO" to "SINGLE ELEMENT".....seems to be a issue with 2.6.19.

I know it's alpha state but it works on all my other instances and servers just this problem is caused by the dev version of PW!

Thank you again - now i can go sleep ^-^

  • Like 1
Link to comment
Share on other sites

When using this module with PW 2.6.19 dev, if I uploaded an image then clicked to zoom before saving, I was getting a blank popup with the following error in the js console:

Uncaught TypeError: Cannot read property 'find' of undefined

I tracked it down to the following lines in InputfieldCroppableImage.js

        magnificOptions = {
            type: 'image',
            closeOnContentClick: true,
            closeBtnInside: true,
            image: {
                titleSrc: function (item) {
                    return item.el.find('img').attr('alt');
                }
            },

I fixed the error by editing it to match the following lines in wire/modules/Inputfield/InputfieldImage/InputfieldImage.js

        var magnificOptions = {
                type: 'image', 
                closeOnContentClick: true, 
                closeBtnInside: true,
                /*
                image: {
                        titleSrc: function(item) {
                                return item.el.find('img').attr('alt'); 
                        }
                },
                */

Horst, can you check this is correct and I haven't been a n00b?

Link to comment
Share on other sites

  • 2 weeks later...

Horst - any chance you could add this to the modules directory and just put (Alpha) in the title or description or something?

It's been a while since I installed it and I couldn't remember the name of it so took me a while to find :)

  • Like 1
Link to comment
Share on other sites

Really? I thought we don't put alpha state modules into the directory?

Wouldn't it be better to put the URL from the forum thread and GitHub repo into the modules description, if it isn't already there?

The module is only half way ready, but most of the part what needs to be finished cannot be done by me. So, when it is in the directory, it gets more attention and, I believe, more requests for to make it fit into the UI, and let it also have all the fine new stuff that the core image field has, etc, etc. All what I can't do. :(

Link to comment
Share on other sites

All of these have a "Release State" of Alpha: http://modules.processwire.com/search/?q=alpha so there are a few there already.

You're right, it would give it more attention, but isn't it at a stage where it is preferable to use this instead of the older Thumbnails module? Out of a choice of one or the other, if this fixes things that are broken in Thumbnails module I would rather use this one :)

I'm not sure what bits you are referring to when you say there are parts that need finishing? It seems to fit into the UI just fine from what I can see.

Link to comment
Share on other sites

 I'm not sure what bits you are referring to when you say there are parts that need finishing? It seems to fit into the UI just fine from what I can see.

There were other voices here in that thread :)

If you like, I can do, but I'm not sure that it is really helpful.

  • Like 1
Link to comment
Share on other sites

I skim-read all 6 pages - seems to be a few old bits, some bits that are maybe still issues but not sure (works for me?). A lot of issues seem to be potentially different servers whilst some are UI perhaps but it's hard to tell.

I'm easy - I've made sure I've bookmarked it now ;) - but maybe having it in the modules directory will bring more people to help as well as more people to ask questions? I can understand your hesitation though - could be a lot of new questions!

  • Like 1
Link to comment
Share on other sites

  • 4 weeks later...

What do you mean with the timestamp? The timestamp when the variation will be created / recreated? If yes, I think this isn't possible without some extra programming logic.

CroppableImage is an API tool, that means, you have to define some (static) constants in the template files during development time, like a suffix. This is needed to detect if an imagevariation already exists or need to created on execution time. It would need an extra layer, etc.

I don't know what you want to do with the timestamp, but you know you are totally free how to create the markup for an image tag. And the timestamp is already stored in the filemtime() of the file. So, if you need the timestamp in PHP, you already have it with filemtime(), but I guess you need it on client side with javascript? Then you may read it and put it into a data-timestamp attribute of the image tag, for example:

$ts = filemtime($image->filename);
echo "<img src='{$image->url}' data-timestamp='{$ts}' />";

If that isn't helpful for you, please tell us a bit more what you are after with the timestamp.

And welcome to the forums! :)

Link to comment
Share on other sites

Hi Horst, thank you for your warm welcome :) 

My question indeed needed a little more details. I'm using processwire as an API for a backbone webapp. (artexis-app, best to view it in chrome :)

I'm also port it to an Ipad application with Apache Cordova.

It has to work offline, so I download all the assets to the Ipad. I included an update function and it checks the file name, I want to add a timestamp the the cropped image to see if it has changed. Like: image_1447076736.-thumbnail.jpg.

I can't use the modified property of the image, because that's changed when it's downloaded on the Ipad. 

@Adrian:

Thanks for your suggestion, but I think that only applies when the image is uploaded and not the cropped image. Is that correct? 

Link to comment
Share on other sites

Thanks for your suggestion, but I think that only applies when the image is uploaded and not the cropped image. Is that correct? 

 
 
That is basically correct, but the timestamp will also be included in the filename of the cropped version. Is it important that the timestamp is updated to match the exact time the image is actually cropped? The "Rename on Save" option might work - haven't tested.
  • Like 2
Link to comment
Share on other sites

 
That is basically correct, but the timestamp will also be included in the filename of the cropped version. Is it important that the timestamp is updated to match the exact time the image is actually cropped? The "Rename on Save" option might work - haven't tested.

It isn't imported that the timestamp match the exact time, the "Rename on Save" function did the trick! Thanks a lot!  :)

  • Like 1
Link to comment
Share on other sites

  • 2 weeks later...

seems that pagetable got updated and now displays images in a new way:

post-2137-0-30571800-1448310337_thumb.pn

the problem is that the id of the link is wrong (it uses the page id with the pagetable, not the item id where the actual field resides)

my quickfix was to hide the buttons via css:

table div.cropLinks {display: none;}
Link to comment
Share on other sites

  • 3 weeks later...

Hi there, I need to show a cropped image from another page, which is selected with a page-field.

I get the following error:

Error: Call to a member function getCrop() on a non-object 

here is the code I use:

<?php foreach ($page->selected_page as $portfolio_item) {
	echo "<article class='one-fourth'\n>";
	$image = $portfolio_item->foto->first()->getCrop('vorschau');
	echo "<a href='{$portfolio_item->url}' alt=''>\n";
	echo "<img src='{$image->url}' width='220' alt''>\n";
	echo "</a>\n";
	echo "<a href='{$portfolio_item->url}' class='project-meta'>\n";
	echo "<h5 class='title'>{$portfolio_item->title}</h5>\n"; 
	echo "<span class='categories'>Lorem ipsum dolor sit amet</span>\n";
	echo "</a>\n";
	echo "</article>\n";
}
?>			

On the portfolio page itself there is no error when showing the cropped image - anybody an idea what can be wrong?

Link to comment
Share on other sites

  • 1 month later...

Has anyone tried this module with the 3x branch?

I'm getting all sorts of errors after trying to upgrade to 3.05, such as "Exception: Method Pageimage::getThumb does not exist or is not callable in this context..." and "Error: Class 'ProcessWire\ProcessCroppableImage' not found (line 208 of /var/www/my-domain.com/site/assets/cache/FileCompiler/site/modules/CroppableImage/FieldtypeCroppableImage/FieldtypeCroppableImage.module)"

Link to comment
Share on other sites

FYI, we have observed that if the source image is a progressive JPEG, crops created by this module will always start at 0,0 (the top left corner), regardless of the position specified by the user when creating the crop. Re-exporting the source images as regular, non-progressive JPEGs allows them to be cropped correctly.

  • Like 1
Link to comment
Share on other sites

  • 3 weeks later...

Has anyone tried this module with the 3x branch?

I'm getting all sorts of errors after trying to upgrade to 3.05, such as "Exception: Method Pageimage::getThumb does not exist or is not callable in this context..." and "Error: Class 'ProcessWire\ProcessCroppableImage' not found (line 208 of /var/www/my-domain.com/site/assets/cache/FileCompiler/site/modules/CroppableImage/FieldtypeCroppableImage/FieldtypeCroppableImage.module)"

Yep, sadly.

Does anyone know a fix?  :(  I would like to use PW 3, but I need CroppableImage.

Link to comment
Share on other sites

Unfortunately not all dependency files (.php, .module) of the croppable images module are detected and compiled by the modules compiler of PW 3. I think this is already told to Ryan, but not sure. If you like, you can add an issue to the Github repo of the devns branch: https://github.com/ryancramerdesign/ProcessWire/blob/devns/wire/core/FileCompiler.php

Link to comment
Share on other sites

Yep, sadly.

Does anyone know a fix?  :(  I would like to use PW 3, but I need CroppableImage.

I dont know your exact needs but until the module is fixed, you might look at ProcessCropImage which is working with PW3. You will not get all the enhancement of CroppableImage but can be a good start or I am dumb ?

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
  • Recently Browsing   0 members

    • No registered users viewing this page.
  • Similar Content

    • By MarkE
      This fieldtype and inputfield bundle was built for storing measurement values within a field, rendering them in a variety of formats and converting them to other units or otherwise modifying them via the API.
      The API consists of a number of predefined functions, some of which include...
      render() for rendering the measurement object, valueAs() for converting the value to another unit value, convertTo() for converting the whole measurement object to different units, and add() and subtract() for for modifying the stored value by the value (converted as required) in another measurement. In the admin the inputfield includes a checkbox (which can be optionally disabled) for converting values on page save. For an example if a value was typed in as centimeters, the unit was changed to metres, and the page saved with this checkbox selected, said value would be automatically converted so that e.g. 170 cm becomes 1.7 m.

      A simple length field using Fieldtype Measurement and Inputfield Measurement.
      Combination units (e.g. feet and inches) are also supported.
      Please note that this module is 'proof of concept' at the moment - there are limited units available and quite a lot of code tidying to do. More units will be added shortly.
      See the GitHub at https://github.com/MetaTunes/FieldtypeMeasurement for full details and updates.
    • By tcnet
      File Manager for ProcessWire is a module to manager files and folders from the CMS backend. It supports creating, deleting, renaming, packing, unpacking, uploading, downloading and editing of files and folders. The integrated code editor ACE supports highlighting of all common programming languages.
      https://github.com/techcnet/ProcessFileManager

      Warning
      This module is probably the most powerful module. You might destroy your processwire installation if you don't exactly know what you doing. Be careful and use it at your own risk!
      ACE code editor
      This module uses ACE code editor available from: https://github.com/ajaxorg/ace

      Dragscroll
      This module uses the JavaScript dragscroll available from: http://github.com/asvd/dragscroll. Dragscroll adds the ability to drag the table horizontally with the mouse pointer.
      PHP File Manager
      This module uses a modified version of PHP File Manager available from: https://github.com/alexantr/filemanager
       
    • By tcnet
      This module implements the website live chat service from tawk.to. Actually the module doesn't have to do much. It just need to inserted a few lines of JavaScript just before the closing body tag </body> on each side. However, the module offers additional options to display the widget only on certain pages.
      Create an account
      Visit https://www.tawk.to and create an account. It's free! At some point you will reach a page where you can copy the required JavaScript-code.

      Open the module settings and paste the JavaScript-code into the field as shown below. Click "Submit" and that's all.

      Open the module settings
      The settings for this module are located int the menu Modules=>Configure=>LiveChatTawkTo.

       
    • By tcnet
      Session Viewer is a module for ProcessWire to list session files and display session data. This module is helpful to display the session data of a specific session or to kick out a logged in user by simply delete his session file. After installation the module is available in the Setup menu.

      The following conditions must be met for the module to work properly:
      Session files
      Session data must be stored in session files, which is the default way in ProcessWire. Sessions stored in the database are not supported by this module. The path to the directory where the session files are stored must be declared in the ProcessWire configuration which is by default: site/assets/sessions.
      Serialize handler
      In order to transform session data easier back to a PHP array, the session data is stored serialized. PHP offers a way to declare a custom serialize handler. This module supports only the default serialize handlers: php, php_binary and php_serialize. WDDX was dropped in PHP 7.4.0 and is therefore not supported by this module as well as any other custom serialize handler. Which serialize handler is actually used you can find out in the module configuration which is available under Modules=>Configure=>SessionViewer.

      Session data
      The session data can be displayed in two different ways. PHP's default output for arrays print_r() or by default for this module nice_r() offered on github: https://github.com/uuf6429/nice_r. There is a setting in the module configuration if someone prefers print_r(). Apart from the better handling and overview of the folded session data the output of nice_r() looks indeed nicer.

      Links
      ProcessWire module directory
      github.com
    • By Robin S
      Repeater Easy Sort
      Adds a compact "easy-sort" mode to Repeater and Repeater Matrix, making those fields easier to sort when there are a large number of items.
      The module also enhances Repeater Matrix by allowing a colour to be set for each matrix type. This colour is used in the item headers and in the "add new" links, to help visually distinguish different matrix types in the inputfield.
      Screencasts
      A Repeater field

      A Repeater Matrix field with custom header colours

      Easy-sort mode
      Each Repeater/Matrix item gets an double-arrow icon in the item header. Click this icon to enter easy-sort mode.
      While in easy-sort mode:
      The items will reduce in width so that more items can be shown on the screen at once. The minimum width is configurable in the field settings. Any items that were in an open state are collapsed, but when you exit easy-sort mode the previously open items will be reopened. You can drag an item left/right/up/down to sort it within the items. The item that you clicked the icon for is shown with a black background. This makes it easier to find the item you want to move in easy-sort mode. You can click an item header to open the item. An "Exit easy-sort mode" button appears at the bottom of the inputfield. Configuration
      In the field settings for Repeater and Repeater Matrix fields you can define a minimum width in pixels for items in easy-sort mode. While in easy-sort mode the items will be sized to neatly fill the available width on any screen size but will never be narrower than the width you set here.
      In the field settings for Repeater Matrix you can define a custom header colour for each matrix type using an HTML "color" type input. The default colour for this type of input is black, so when black is selected in the input it means that no custom colour will be applied to the header.
      Exclusions
      The easy-sort mode is only possible on Repeater/Matrix fields that do not use the "item depth" option.
       
      https://github.com/Toutouwai/RepeaterEasySort
      https://processwire.com/modules/repeater-easy-sort/
×
×
  • Create New...