Jump to content
justb3a

Module: Image Extra

Recommended Posts

Some time ago I developed a module (FieldtypeImageExtra) which extends Fieldtype Image with the ability to add custom fields to an image. This worked well but it had a somehow restricted applicability and did not meet all of our needs. There of course are other useful image modules like CroppableImage or ImageFocusArea, but up to now there was no possibility to combine image cropping with custom fields support. So you had to decide whether to add image cropping or the possibility to add custom fields because each of those modules sets up their own field type (and input type) which cannot be combined.


 


The new module ImageExtra allows you to have both functionalities.


 


You can get the module from GitHubFor more informations have a look at this blog post.


 


If you notice any problems or unexpected behaviour please let me know.


  • Like 22

Share this post


Link to post
Share on other sites

oh, I didn't notice that topic, I would have responded as well. 

Maybe it's a good idea to add an external url field. What do you think?

  • Like 2

Share this post


Link to post
Share on other sites

oh, I didn't notice that topic, I would have responded as well. 

Maybe it's a good idea to add an external url field. What do you think?

If it will be able to handle a URL field well, then maybe there is no need. On the other hand, since you already a internal links feature, maybe good to add an external one too...Anyway, its a 50/50 thing...so your call :-)

Share this post


Link to post
Share on other sites

Thanks for this module, justb3a, it comes right just in time for me :-)

However, I think there is a problem: I noticed that values for "caption", orientation or custom fields are saved in database (that part works). But if I edit the same image again, the values have disappeared. The fields are empty. If the image is saved again, the values in the database get lost.

UPDATE: I tried to debug it. If I change line 1045:

$value = $this->wire('sanitizer')->entities($pagefile->{$current}($language));

to

$value = $this->wire('sanitizer')->entities($pagefile->{$current});

the problem disappears. I guess this fix does not work if you have more than one language defined.

Share this post


Link to post
Share on other sites

@titanium: First of all thanks for testing and feedback  :)

I cannot reproduce this behavior. Could you please provide me more informations:

  • ProcessWire Version
  • Number of max allowed files
  • Overwrite existing files?
  • Do you just change meta informations or upload a new image?
  • Do you use ImageExtra in combination with any other Image Module? (Please tell me which one)

I installed a fresh ProcessWire installation, Beginner Package (just one language), and it works without any problems.

EDIT: I still cannot reproduce this behavior but I changed this line to:

$value = $this->wire('sanitizer')->entities($language ? $pagefile->{$current}($language) : $pagefile->{$current});

I hope it works now.

Share this post


Link to post
Share on other sites

On one of my PW sites it works fine, but on another one, if I try to edit a page with an image, I get this error:

Error: Using $this when not in object context (line 213 of /home/path/site/modules/ImageExtra/ImageExtra.module) 

Both site are using the same versions of Image Extra and PW (both the very latest).

Share this post


Link to post
Share on other sites

In line :213 the method for the image link is added. The other methods seems to work because the method for the link is called as the last one.

Did you check the  Add internal link field box? Uploading an image wasn't a problem? Did you add an image link? Does this error occurs on every page which contain this field?

Share this post


Link to post
Share on other sites

Yep, I checked add internal link field box. The image uploads fine, and i can add a link, but it doesn't matter whether I actually add the link or not, I still get that error and the only way to get it to go away is to remove the field from the template, or uncheck internal link field box for the field. It seems to occur with every page containing the field.

The only thing I can think of that might be making it work on one server vs the other is php version: 5.6.4 works, but 5.4.33 5.3.29 doesn't.

Share this post


Link to post
Share on other sites

That sounds reasonable and could explain other issues I couldn't reproduce. I've tested only with PHP version 5.5.18.  I try to take some time next week to install version 5.3.8 (ProcessWire requires at least this version) and test all again. jeah...  :mellow:

  • Like 1

Share this post


Link to post
Share on other sites

Sorry for the confusion - I was looking at the wrong server. The server in question is running 5.3.29 so it's simply an issue with using $this in the anonymous functions (not allowed in 5.3) you are using, so should be an easy fix.

  • Like 1

Share this post


Link to post
Share on other sites

Feel free to provide a solution here oder create a pull request.  ^_^

Otherwise I will look at this next week...

  • Like 1

Share this post


Link to post
Share on other sites

Feel free to provide a solution here oder create a pull request.  ^_^

Otherwise I will look at this next week...

PR has been submitted to fix those fatal errors in PHP 5.3.

The other relatively minor (but niggly) thing is that the description field is not getting the InputfieldMaxWidth class applied to it and as a result, the input is very narrow. I took a quick look at the regex stuff you have going on in regard to this, but figured it was easier for you to figure out the issue with this because I haven't really figured out why you are replacing the label class and label for description, although I am sure there is good reason :)

  • Like 2

Share this post


Link to post
Share on other sites

Thanks for the pull request. 

The other relatively minor (but niggly) thing is that the description field is not getting the InputfieldMaxWidth class applied to it and as a result, the input is very narrow. I took a quick look at the regex stuff you have going on in regard to this, but figured it was easier for you to figure out the issue with this because I haven't really figured out why you are replacing the label class and label for description, although I am sure there is good reason :)

If you have multi language support activated there is no label for the description field (but I want to have one) and I want to add some padding.

So I check whether it's a multi language installation - but one line didn't make it into the right area. It's corrected :)

post-2759-0-30608500-1424558036_thumb.pn

Default: missing label and padding for description

  • Like 2

Share this post


Link to post
Share on other sites

Hi,

I have built a gallery site and use ImageExtra to add some additional informations to the images. Everything works fine if I visit the page as a logged-in user, but if I have a look at the site as a (normal) guest, none of the extra fields are displayed.

I think this is a problem of missing access rights, but I did not find any point where to change it. The rights of the files on the server seem to be OK.

Any ideas?

Thanks

Günter

Edited by LostKobrakai
Merged with module support topic

Share this post


Link to post
Share on other sites

Hi!

A great module, but I am wondering if it is possible to use html (or markdown) in the extra fields?

I tried this, but without luck. But I might have missed something. :)

/Jasper

Share this post


Link to post
Share on other sites

@biber

Hi,

just to make sure: you visit the page in the frontend? That means you do not see the text output if you are not logged in. Strange. Do you see the images? Or is everything missing? Could you (temporary) try to disable the module and use the built-in functionality including description. Just to make sure it depends on the module. 

Edited by LostKobrakai
Added @… to make the response clear after merging topics

Share this post


Link to post
Share on other sites

@formmailer: You do not missed something. It's not possible at the moment. I could imagine to add a checkbox in the module setting to enable markdown. Could you open an issue on github or send me a pull request? I've no time at the moment to implement this. Thanks.

Share this post


Link to post
Share on other sites

Hi,

thanks for your reply. Yes, it's right: I visit the page in the frontend. If nobody is logged in I can see the image and the 'description'-field, if I log in I can see the rest of the fields. I had a look at my database with phpMyAdmin, where I can find the table 'field_images' with all the fields and it looks OK.

btw.  Is there a possibility to change the order of the fields of the admin page (caption before description) and/or change the label of the fields at the admin page in dependence of the page. For example: page 'Menschen':  field_1 labelled 'Vorname', field_2 labelled 'Nachname' - page 'Pflanzen': field_1 labelled 'deutscher Name', field_2 labelled 'botanischer Name'. This should make it easier for users to add new pictures.

Share this post


Link to post
Share on other sites

@formmailer: You do not missed something. It's not possible at the moment. I could imagine to add a checkbox in the module setting to enable markdown. Could you open an issue on github or send me a pull request? I've no time at the moment to implement this. Thanks.

Hi!

Thank you for your reply!

I'll open en issue on Github. If I have time to fix it myself, I'll send you a pull request.

//Jasper

Share this post


Link to post
Share on other sites

Hi,

thanks for your reply. Yes, it's right: I visit the page in the frontend. If nobody is logged in I can see the image and the 'description'-field, if I log in I can see the rest of the fields. I had a look at my database with phpMyAdmin, where I can find the table 'field_images' with all the fields and it looks OK.

btw.  Is there a possibility to change the order of the fields of the admin page (caption before description) and/or change the label of the fields at the admin page in dependence of the page. For example: page 'Menschen':  field_1 labelled 'Vorname', field_2 labelled 'Nachname' - page 'Pflanzen': field_1 labelled 'deutscher Name', field_2 labelled 'botanischer Name'. This should make it easier for users to add new pictures.

Hi,

I found the solution for my problem by myself: I filled out the german sections of the fields and didn't realize that guests see the default (english) version. A simple click on >Admin >Access >Users >guest >Language >deutsch brought back my vanished items. :rolleyes:

Still remains my whish to change the order of the fields and to rename them at the admin page.

Thanks

Günter

Share this post


Link to post
Share on other sites

Sorry I don't have time at the moment to implement this. For translating the strings there is already an issue opened on github.

For me it isn't necessary to change the order of the fields. Try to leave the checkboxes blank and add caption (for example) in other fields. I know there is a hint Do not use `orientation`, `link` or `caption` in this list. I just tested it and it seems to work. I know this solves not the problem to rearrange link and orientation field. You can also open an issue on github  :) (or solve it on your own and send me a pull request ^_^ ).

Share this post


Link to post
Share on other sites

@ justb3a:

Thanks for your reply.

After I have found my mistake your module works fine for me. The other wishes are luxury problems and I have a lot to learn before I try to solve it on my own.

Günter

Share this post


Link to post
Share on other sites

hi thats awesome module. good job.

i want to know how i print the images orientation values?

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 Mike Rockett
      Jumplinks for ProcessWire
      Release: 1.5.56
      Composer: rockett/jumplinks
      Jumplinks is an enhanced version of the original ProcessRedirects by Antti Peisa.
      The Process module manages your permanent and temporary redirects (we'll call these "jumplinks" from now on, unless in reference to redirects from another module), useful for when you're migrating over to ProcessWire from another system/platform. Each jumplink supports wildcards, shortening the time needed to create them.
      Unlike similar modules for other platforms, wildcards in Jumplinks are much easier to work with, as Regular Expressions are not fully exposed. Instead, parameters wrapped in curly braces are used - these are described in the documentation.
      Under Development: 2.0, to be powered by FastRoute
      As of version 1.5.0, Jumplinks requires at least ProcessWire 2.6.1 to run.
      View on GitLab
      Download via the Modules Directory
      Read the docs
      Features
      The most prominent features include:
      Basic jumplinks (from one fixed route to another) Parameter-based wildcards with "Smart" equivalents Mapping Collections (for converting ID-based routes to their named-equivalents without the need to create multiple jumplinks) Destination Selectors (for finding and redirecting to pages containing legacy location information) Timed Activation (activate and/or deactivate jumplinks at specific times) 404-Monitor (for creating jumplinks based on 404 hits) Additionally, the following features may come in handy:
      Stale jumplink management Legacy domain support for slow migrations An importer (from CSV or ProcessRedirects) Feedback & Feature Requests
      I’d love to know what you think of this module. Please provide some feedback on the module as a whole, or even regarding smaller things that make it whole. Also, please feel free to submit feature requests and their use-cases.
      Note: Features requested so far have been added to the to-do list, and will be added to 2.0, and not the current dev/master branches.
      Open Source

      Jumplinks is an open-source project, and is free to use. In fact, Jumplinks will always be open-source, and will always remain free to use. Forever. If you would like to support the development of Jumplinks, please consider making a small donation via PayPal.
      Enjoy! :)
    • By BitPoet
      As threatened in Ryan's announcement for 3.0.139, I built a little module for sliding toggles as a replacement for checkboxes. Styling of the input is CSS3 only (with all the usual caveats about older browsers), no JS necessary, and may still be a bit "rough around the edges", so to speak, since I didn't have much time for testing on different devices or brushing things up enough so I'd feel comfortable pushing it to the module directory. But here's the link to the GitHub repo for now:
      InputfieldSlideToggle
      Fieldtype and Inputfield that implements smartphone-style toggles as replacement for checkbox inputs. The visualization is CSS-only, no additional JS necessary.
      Status
      Still very alpha, use with caution!
      Features / Field Settings
      Size
      You can render the toggles in four different sizes: small, medium, large and extra large.
      Off Color
      Currently, "unchecked" toggles can be displayed either in grey (default) or red.
      On Color
      "Checked" toggles can be rendered in one of these colors: blue (default), black, green, grey, orange or red.
      Screenshots

      Some examples with checkbox label


      View all Size and Color Combinations
      Small toggles Medium toggles Big toggles Extra big toggles  









    • By Orkun
      Hi Guys
      I needed to add extended functionalities for the InputfieldDatetime Module (module is from processwire version 2.7.3) because of a Request of Customer.
      So I duplicated the module and placed it under /site/modules/.
      I have added 3 new Settings to the InputfieldDatetime Module.
      1. Day Restriction - Restrict different days based on weekdays selection (e.g. saturday, sunday) - WORKING

       
      2. Time Slots - Define Time slots based on custom Integer Value (max is 60 for 1 hour) - WORKING

       
      3. Time Range Rules per Weekday - Define a minTime and MaxTime per Weekday (e.g. Opening Hours of a Restaurant) - NOT WORKING PROPERLY

       
      The Problem
      Time Slots and Day Restriction working fine so far. But the Time Range Rules per Weekday doesn't work right.
      What should happen is, that when you click on a date, it should update the minTime and maxTime of the Time Select.
      But the change on the select only happens if you select a date 2 times or when you select a date 1 time and then close the datepicker and reopen it again.
      The time select doesn't get change when you select a date 1 time and don't close the picker.
      Here is the whole extended InputfieldDatetime Module.
      The Files that I have changed:
      InputfieldDatetime.module InputfieldDatetime.js jquery-ui-timepicker-addon.js (https://trentrichardson.com/examples/timepicker/) - updated it to the newest version, because minTime and maxTime Option was only available in the new version  
      Thats the Part of the JS that is not working correctly:
      if(datetimerules && datetimerules.length){ options.onSelect = function(date, inst) { var day = $(this).datetimepicker("getDate").getDay(); day = day.toString(); var mintime = $(this).attr('data-weekday'+day+'-mintime'); var maxtime = $(this).attr('data-weekday'+day+'-maxtime'); console.log("weekday: "+day); console.log("minTime: "+mintime); console.log("maxTime: "+maxtime); var optionsAll = $(this).datetimepicker( "option", "all" ); optionsAll.minTime = mintime; optionsAll.maxTime = maxtime; $(this).datetimepicker('destroy'); $(this).datetimepicker(optionsAll); $(this).datetimepicker('refresh'); //$.datepicker._selectDate($(this).attr("id"),date); //$.datepicker._base_getDateDatepicker(); // var inst = $.datepicker._getInst($(this)); // $.datepicker._updateDatepicker(inst); /*$(this).datetimepicker('destroy'); InputfieldDatetimeDatepicker($(this), mintime, maxtime); $(this).datetimepicker('refresh'); */ // $(this).datetimepicker('option', {minTime: mintime, maxTime: maxtime}); } } Can you have a look and find out what the Problem is?
      InputfieldDatetime.zip
       
      Kind Regards
      Orkun
    • By teppo
      This module tracks changes, additions, removals etc. of public (as in "not under admin") pages of your site. Like it's name says, it doesn't attempt to be a version control system or anything like that - just a log of what's happened.
      At the moment it's still a work in progress and will most likely be a victim of many ruthless this-won't-work-let's-try-that-instead cycles, but I believe I've nailed basic functionality well enough to post it here.. so, once again, I'll be happy to hear any comments you folks can provide
      https://modules.processwire.com/modules/process-changelog/
      https://github.com/teppokoivula/ProcessChangelog
      How does it work?
      Exactly like it's (sort of) predecessor, Process Changelog actually consists of two modules: Process Changelog and Process Changelog Hooks. Hooks module exists only to serve main module by hooking into various functions within Pages class, collecting data of performed operations, refining it and keeping up a log of events in it's own custom database table (process_changelog.) Visible part is managed by Process Changelog, which provides users a (relatively) pretty view of the contents of said log table.
      How do you use it?
      When installed this module adds new page called Changelog under Admin > Setup which provides you with a table view of collected data and basic filtering tools See attached screenshots to get a general idea about what that page should look like after a while.
      For detailed installation instructions etc. see README.md.
       


    • By Gadgetto
      Status update links (inside this thread) for SnipWire development will be always posted here:
      2019-08-08
      2019-06-15
      2019-06-02
      2019-05-25
      If you are interested, you can test the current state of development:
      https://github.com/gadgetto/SnipWire
      Please note that the software is not yet intended for use in a production system (alpha version).
      If you like, you can also submit feature requests and suggestions for improvement. I also accept pull requests.
      ---- INITIAL POST FROM 2019-05-25 ----
      I wanted to let you know that I am currently working on a new ProcessWire module that fully integrates the Snipcart Shopping Cart System into ProcessWire. (this is a customer project, so I had to postpone the development of my other module GroupMailer).
      The new module SnipWire offers full integration of the Snipcart Shopping Cart System into ProcessWire.
      Here are some highlights:
      simple setup with (optional) pre-installed templates, product fields, sample products (quasi a complete shop system to get started immediately) store dashboard with all data from the snipcart system (no change to the snipcart dashboard itself required) Integrated REST API for controlling and querying snipcart data webhooks to trigger events from Snipcart (new order, new customer, etc.) multi currency support self-defined/configurable tax rates etc. Development is already well advanced and I plan to release the module in the next 2-3 months.
      I'm not sure yet if this will be a "Pro" module or if it will be made available for free.
      I would be grateful for suggestions and hints!
      (please have a look at the screenshots to get an idea what I'm talking about)
       




×
×
  • Create New...