Jump to content
gebeer

FieldtypeImageFromPage pick an image from various sources

Recommended Posts

cool! Image picking has been an issue with SettingsFactory... so this will be great 😀. I'll check it out and do some testing asap!

  • Like 2

Share this post


Link to post
Share on other sites

@gebeer - that all sounds brilliant - thanks again so much for this - it's going to be an awesome solution!

Share this post


Link to post
Share on other sites
11 hours ago, Macrura said:

cool! Image picking has been an issue with SettingsFactory... so this will be great 😀. I'll check it out and do some testing asap!

If you want to test it, you will have to use the branch jsonvalue from github.

  • Like 2

Share this post


Link to post
Share on other sites

I have made good progress and have a working version now, that allows to pick an image from a predefined page (and optionally its children), a folder inside site/templates or the page that is being edited.

The version is available in the branch 'allinone' on github
Install from URL https://github.com/gebeer/FieldtypeImageFromPage/archive/allinone.zip
If you find the time, please do some testing and report your findings. Thank you. If you test, please uninstall previous versions and install this one.
EDIT: Also uninstall InputfieldImagePicker if you happened to install it.
My code does not cater fully for DB update, yet. And since I switched field value storage to json, atm this has to be installed from scratch.

The module is still on that repository. But eventually I will publish it on the ImagePicker repository when I feel it is ready.

One thing I still have to solve: ATM the field returns 2 different objects for rendering in templates, depending on where the image comes from. If it comes from a page, you will get a Pageimage object. If it comes from a folder inside site/templates, you will get a custom ImagePickerFile object. The latter one cannot be manipulated (resizing/cropping) like a Pageimage but has some similar properties.
I still have to find a way how to turn images from a folder that is not connected to a page into Pagimage objects. This is quite tricky. I wonder if anyone who is reading this has evr tried to accomplish something similar.
I really always want to provide a Pageimage object, no matter where the real image file lives so that it can be manipulated. Still scratching my head on that but hope I will find a solution.

  • Like 3

Share this post


Link to post
Share on other sites

Really short on time, but wanted to take a quick look. So far looks really great - thank you!

I noticed this error - only occurs if the child page doesn't have images available.

image.png.c2c6e93be7b599aa5a3c65c11ed7fd51.png

Also, I am wondering about the radio buttons as a way to choose the fields that images can come from. I would have thought checkboxes were better to allow for multiple fields. This may be for multiple fields on the one page/template, but I can see it also being useful for different pages with different templates that have different image fields. Does that make sense?

 

  • Like 1

Share this post


Link to post
Share on other sites
21 minutes ago, adrian said:

I noticed this error - only occurs if the child page doesn't have images available.

Thanks for reporting.

21 minutes ago, adrian said:

Also, I am wondering about the radio buttons as a way to choose the fields that images can come from. I would have thought checkboxes were better to allow for multiple fields.

I was thinking about that one, too. But then I decided to allow only one images field because it might confuse users. But then, if I allowed multiple fields, the user could upload to any images field and have them available for the picker. Think, finally I will add this.

  • Like 1

Share this post


Link to post
Share on other sites

 

28 minutes ago, adrian said:

I noticed this error - only occurs if the child page doesn't have images available.

regarding that error. Do you also have my module ImagePicker installed on that site?

Share this post


Link to post
Share on other sites
31 minutes ago, gebeer said:

 

regarding that error. Do you also have my module ImagePicker installed on that site?

Yeah, I did. I just uninstalled it and that error is now gone, but I am now seeing: 
image.png.79b5d789777719cecb0d72ec0474fb0c.png

and having real problems getting rid of it.

Share this post


Link to post
Share on other sites
3 minutes ago, adrian said:

Yeah, I did. I just uninstalled it and that error is now gone, but I am now seeing: 
image.png.79b5d789777719cecb0d72ec0474fb0c.png

and having real problems getting rid of it.

Sorry for that one. InputfieldImagePicker did not manipulate any other image fields. Was your field 'image' created from InputfieldImagePicker? If so, you need to remove it and the error should be gone

Share this post


Link to post
Share on other sites

It wasn't created that way - just a regular image field. Even after deleting it I am still seeing the error - will have to dive deeper to see where it's originating.

Share this post


Link to post
Share on other sites
3 minutes ago, adrian said:

It wasn't created that way - just a regular image field. Even after deleting it I am still seeing the error - will have to dive deeper to see where it's originating.

Really sorry for the trouble. Maybe caching issue? The 2 modules were never supposed to be installed alongside each other and I didn't take that into account since it is planned to replace the 'old' ImagePicker module with this one. Added a warning to my post above so others won't fall into that pit.

  • Like 1

Share this post


Link to post
Share on other sites

Not your fault at all - took me a while, but turns out it was my definition of a field in SettingsFactory that was causing the problem 🙂

All sorted now and the new version works great for Settings Factory as well - really cool - I especially love the ability to upload directly via that field and it automatically reloads the available images after closing the modal. 

Share this post


Link to post
Share on other sites

One small thing - note the wrapping of the filename which I think should be fixed.

image.png.be45e6c854415fb1e2d8c80d14660c0e.png

Share this post


Link to post
Share on other sites
3 minutes ago, adrian said:

All sorted now

Glad you sorted it!

1 minute ago, adrian said:

One small thing - note the wrapping of the filename which I think should be fixed

This is on purpose. Otherwise the filename would overflow the background area, especially on not so wide previews. Doesn't look very nice as it is, I know. In the CSS I had  hyphens: auto; before but that would break the filename to the next line too soon. So I decided to go for word-wrap: break-word; instead.

  • Like 1

Share this post


Link to post
Share on other sites

One minor thing: when I choose to use "from-folder" as image-source, then it is not possible to upload new images into the folder within ImagePicker. Is this planned behavior, or can it be solved? Thanks.

billede
This upload-icon is missing, when picking image from folder.

Share this post


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

I finally tested the branch version, and it works great!

Thank you for testing!

2 hours ago, eydun said:

One minor thing: when I choose to use "from-folder" as image-source, then it is not possible to upload new images into the folder within ImagePicker. Is this planned behavior, or can it be solved? Thanks.

This is intended behaviour at the moment. But I am planning on incorporating an upload widget for the folder images, too. For uploading the page images the module uses the standard PW page edit feature. But since folder images are not linked to a page (at least not yet in the current version), I need to use a different solution here. I like https://uppy.io/ a lot and think I will implement it for managing images in the folder.

I have merged all the features of this module into my ImagePicker module and will release a new version of that this week.

  • Like 2

Share this post


Link to post
Share on other sites

Thank you! It makes a great Christmas present for the community!

I haven't had time to do further testings but I will surely try out the new module during this holiday season.

  • Like 2

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 MoritzLost
      TrelloWire
      This is a module that allows you to automatically create Trello cards for ProcessWire pages and update them when the pages are updated. This allows you to setup connected workflows. Card properties and change handling behaviour can be customized through the extensive module configuration. Every action the module performs is hookable, so you can modify when and how cards are created as much as you need to. The module also contains an API-component that makes it easy to make requests to the Trello API and build your own connected ProcessWire-Trello workflows.
      Features
      All the things the module can do for you without any custom code: Create a new card on Trello whenever a page is added or published (you can select applicable templates). Configure the target board, target list, name and description for new cards. Add default labels and checklists to the card. Update the card whenever the page is updated (optional). When the status of the card changes (published / unpublished, hidden / unhidden, trashed / restored or deleted), move the card to a different list or archive or delete it (configurable). You can extend this through hooks in many ways: Modifiy when and how cards are created. Modify the card properties (Target board & list, title, description, et c.) before they are sent to Trello. Create your own workflows by utilizing an API helper class with many convenient utility methods to access the Trello API directly. Feedback & Future Plans
      Let me know what you think! In particular:
      If you find any bugs report them here or on Github, I'll try to fix them. This module was born out of a use-case for a client project where we manage new form submissions through Trello. I'm not sure how many use-cases there are for this module. If you do use it, tell me about it! The Trello API is pretty extensive, I'll try to add some more helper methods to the TrelloWireApi class (let me know if you need anything in particular). I'll think about how the module can support different workflows that include Twig – talk to me if you have a use-case! Next steps could be a dashboard to manage pages that are connected to a Trello card, or a new section in the settings tab to manage the Trello connection. But it depends on whether there is any interest in this 🙂 Links
      Repository on Github Complete module documentation (getting started, configuration & API documentation) [Module directory pending approval] Module configuration

    • By MoritzLost
      Process Cache Control
      This module provides a simple solution to clearing all your cache layers at once, and an extensible interface to perform various cache-related actions.
      The simple motivation behind this module was that I was tired of manually clearing caches in several places after deploying a change on a live site. The basic purpose of this module is a simple Clear all caches link in the Setup menu which clears out all caches, no matter where they hide. You can customize what exactly the module does through it's configuration menu:
      Expire or delete all cache entries in the database, or selectively clear caches by namespace ($cache API) Clear the the template render cache. Clear out specific folders inside your site's cache directory (/site/assets/cache) Clear the ProCache page render cache (if your site is using ProCache) Refresh version strings for static assets to bust client-side browser caches (this requires some setup, see the full documentation for details). This is the basic function of the module. However, you can also add different cache management action through the API and execute them through the module's interface. For this advanced usage, the module provides:
      An interface to see all available cache actions and execute them. A system log and logging output on the module page to see verify what the module is doing. A CacheControlTools class with utility functions to clear out different caches. An API to add cache actions, execute them programmatically and even modify the default action. Permission management, allowing you granular control over which user roles can execute which actions. The complete documentation can be found in the module's README.
      Plans for improvements
      If there is some interest in this, I plan to expand this to a more general cache management solution. I particular, I would like to add additional cache actions. Some ideas that came to mind:
      Warming up the template render cache for publicly accessible pages. Removing all active user sessions. Let me know if you have more suggestions!
      Links
      https://github.com/MoritzLost/ProcessCacheControl ProcessCacheControl in the Module directory CHANGELOG in the repository Screenshots


    • By Macrura
      PrevNextTabs Module
      Github: https://github.com/outflux3/PrevNextTabs
      Processwire helper modules for adding page navigation within the editor.
      Overview
      This is a very simple module that adds Previous and Next links inline with the tabs on the page editor. Hovering over the tab shows the title of the previous or next page (using the admin's built in jqueryUI tooltips.)
      Usage
      This module is typically used during development where you or your editors need to traverse through pages for the purpose of proofing, flagging and/or commenting. Rather than returning to the page tree or lister, they can navigate with these links.
      Warnings
      If you are using PW version 2.6.1 or later, the system will prevent you from leaving the page if you have unsaved edits.
      For earlier versions, to avoid accidentally losing changes made to a page that might occur if a user accidentally clicks on one of these, make sure to have the Form Save Reminder module installed.
      http://modules.processwire.com/modules/prev-next-tabs/
    • By EyeDentify
      Hello Dear PW Gurus.

      Hope you fair well in these Corona Crisis times.

      Anyhow, i have a problem with a Cryptic error message that shows up when i am trying to Delete images out of a Images field.
      The Error message does say a little but it does not make sense to me why i can´t delete the images because of it.

      Is it some permission issue perhaps?

      I will attach screenshots of it and what i did prior to it.
      I am from sweden so ignore the funny words here and there.

      Hope you all can send me on the right track.
      i am running PW 3.0.139 on this install.

      Step1:

      Step 2: Select the images with the trashcan symbol

       
      Step 3: Cryptic Error message

      I am scratching my head on this one, have not seen this before.

      Thankfull for all help.
      /EyeDentify
×
×
  • Create New...