Jump to content
justb3a

Module: Image Extra

Recommended Posts

@tekno: Like any other value: $image->orientation
 
For example:

$sidebar = "<img src='$image->url' alt='$image->description' class='$image->orientation' />";

outputs:

<img src="/site/assets/files/1/bigger-terminal.400x0.jpg" alt="We're gonna need a bigger terminal." class="left">

Share this post


Link to post
Share on other sites

i tried ->orientation , ->orientationField , ->orientationValues but it did not print. i try it again

thanks for your reply

Share this post


Link to post
Share on other sites

It also works for just one image. If you allow more than one image in field settings you have to get the first image, iterate over or get one randomly. 

// $image = $page->images->getRandom();
// foreach ($page->images as $image) { ... }
$image = $page->images->first();

$sidebar = "<img src='$image->url' alt='$image->description' class='$image->orientation' />";
  • Like 1

Share this post


Link to post
Share on other sites

thank you it works great

how can i translate image standart fields (orientation, description, caption)? i look ImageExtra.module but i can not dare to change anything :)

Share this post


Link to post
Share on other sites

There is already an issue on github. I'll get back to this as soon as I've resolved some other issues...

Share this post


Link to post
Share on other sites

Thanks very much @justb3a for this module, a valuable addition to PW and looks ideal for solving a usability + presentation requirement I have :)

I can see from your blog page how to access the additional attributes via the API and have that working AOK in a template but for an image inserted in a textarea field that uses CkEditor do you know how I can get CkEditor or PW to output the extra attribute I have added? Thanks in advance for any pointers or help :)

Share this post


Link to post
Share on other sites

This is just what I was looking for! 

I have a question, though: How might I go about changing one of the custom fields to a textarea, or even enabling CKEditor?

Share this post


Link to post
Share on other sites

@alan: Sorry I never want to output extra attributes in CkEditor or similar. If you find a solution, please let me know.  :)

@statestreet: This is not possible at the moment, but I've planned to allow markdown in the fields.

Share this post


Link to post
Share on other sites

@justb3a

Sorry I never want to output extra attributes in CkEditor or similar. If you find a solution, please let me know.   :)

Thanks, I'm glad to know this facility is not something I missed :)

I will certainly let you know if I find a solution.

Share this post


Link to post
Share on other sites

Great module, worked fine for me! But since a couple of days, for any reason, it doubles my costum image fields. Updated it to Version 0.0.3 but still the same problem. I dont know what happened. Maybe i did anything wrong? I didn't install any other module in the past days, as far as I know :D.

Here are some screenshots to show you what I mean:

http://www.directupload.net/file/d/4071/vtafnu3t_jpg.htm
http://www.directupload.net/file/d/4071/n592lj7s_jpg.htm  

        

Any ideas what could be wrong?

Thank you!

  • Like 1

Share this post


Link to post
Share on other sites

Great module, worked fine for me! But since a couple of days, for any reason, it doubles my costum image fields. Updated it to Version 0.0.3 but still the same problem. I dont know what happened. Maybe i did anything wrong? I didn't install any other module in the past days, as far as I know :D.

Here are some screenshots to show you what I mean:

http://www.directupload.net/file/d/4071/vtafnu3t_jpg.htm

http://www.directupload.net/file/d/4071/n592lj7s_jpg.htm  

        

Any ideas what could be wrong?

Thank you!

Okay, somehow there seems to be a problem with LanguageSupport and the german package, I uninstalled it and its working perfectly now. Could be a bug or I did anything wrong.

Share this post


Link to post
Share on other sites

This is just a JavaScript/CSS issue. Go to Modules > Core and install the Languages Support - Tabs module.  ;) 

  • Like 1

Share this post


Link to post
Share on other sites

Hi @justb3a,

Just noticed a bit of a critical bug. If you remove one of the "Add other text input fields" the field/column is not removed from the DB. This results in a fatal error and the images uploaded to the field are lost. You have to manually edit the DB table to remove the fields to get things working again.

As a wishlist item, I'd love to see the ability to add select, radio, and checkbox fields as well as plain text :)

Share this post


Link to post
Share on other sites

Hi @adrian,

initially I decided to keep the fields/columns after removing so if you need them again your data/entries are still available. I tested it again right now without any problems. 

Scenario: image field containing 4 image extra text fields, adding some images, removing one text field, editing/adding/deleting images... everything works as expected. Any ideas? (ProcessWire 2.6.22, PHP 5.6.14)

Share this post


Link to post
Share on other sites

Sorry for the delay in getting back to you regarding the error - I still need to look at this again, but for now I have a new problem for you :)

It looks like the Page Link option isn't working properly - it just shows a text input with "0" as the value.

post-985-0-74699000-1447329625_thumb.png

If I load "InputfieldPageListSelect.min.js" in the module, then it works as expected.

post-985-0-28869900-1447329642_thumb.png

Share this post


Link to post
Share on other sites

Another critical issue - when using an image extra field within a PageTable, the extra fields show up under the image and appear to be editable. You can make changes to the content of these fields, but of course they don't get saved when saving the main page which is very confusing for the user.

post-985-0-68439200-1447627272_thumb.png

  • Like 1

Share this post


Link to post
Share on other sites

Hi @adrian,

initially I decided to keep the fields/columns after removing so if you need them again your data/entries are still available. I tested it again right now without any problems. 

Scenario: image field containing 4 image extra text fields, adding some images, removing one text field, editing/adding/deleting images... everything works as expected. Any ideas? (ProcessWire 2.6.22, PHP 5.6.14)

Some more info on that error:

post-985-0-72466900-1447628132_thumb.png

The error is coming from PW itself because it looks like every DB field needs a value for the entry to be successfully saved. You should be able to replicate by removing one of the fields from the comma separated list of extra fields, or by simply uninstalling image extra and then trying to upload an image.

Share this post


Link to post
Share on other sites

Some more info on that error:

attachicon.gifScreen Shot 2015-11-16 at 8.54.52 AM.png

The error is coming from PW itself because it looks like every DB field needs a value for the entry to be successfully saved. You should be able to replicate by removing one of the fields from the comma separated list of extra fields, or by simply uninstalling image extra and then trying to upload an image.

I'm not able to reproduce this behaviour, I'll let the pictures speak for themselves:

  1. added 5 Image Extra fields, added images, filled content, saved
  2. removed 2 Image Extra fields
  3. added one more image
  4. saved page
  5. deinstalled module Image Extra
  6. edit page
  7. added another image, fill description
  8. save page

post-2759-0-64981300-1448018514_thumb.pn

Share this post


Link to post
Share on other sites

:) But I'm able to reproduce the PageLink issue:

post-2759-0-97446400-1448019794_thumb.pn

I'll fix that.

Regarding the PageTable issue: I never used an image field containing extra fields inside a PageTable. I'll test this later.

Share this post


Link to post
Share on other sites

I don't know what to say about the issue with removing extra fields - I am continuing to get that error on different PW installs.
 
But now I have another issue for you. With ImageExtra installed and Maximum Files Allowed set to "1" when I go to upload a second image, the editor actually shows both images. After save, the first one disappears, but without ImageExtra, the second one instantly overwrites the first one. This has been confusing for our users - they think a second image has been uploaded rather than overwriting the first one. I hope you can reproduce at your end.
 
I wonder if it's a simple matter of incorporating some of the new code in: 
https://github.com/ryancramerdesign/ProcessWire/blob/980ce4f0be2054dfbad4a7b334d35bdca42da7da/wire/modules/Inputfield/InputfieldFile/InputfieldFile.module#L438

into your module at:

https://github.com/justonestep/processwire-imageextra/blob/master/ImageExtra.module#L540

 
Thanks!

Share this post


Link to post
Share on other sites

Sorry, I am on a bit of a roll - I really do love this module :)

I don't really understand the "Select the inputfields where the extra fields should be attached." option in the config settings. It lists all the different inputfield types, but the module only works with image field types. I actually tried to see if it works with InputfieldFile, but it didn't even work there. Am I missing something about this setting?

I think a more useful setting would be to control which image fields (the actual fields, not field types) that imageextra is attached to. At the moment the "Image Extra Fields" fieldset is added to the Input tab of all image fields, which I expect most developers don't need - they probably only want them for certain image fields. Does that make sense and sound like a good idea?

Thanks again :)

Share this post


Link to post
Share on other sites

@adrian: Could you please open an issue for each topic on Github?

The select field in module settings allows you to add these extra fields to other ImageFields (for example CroppableImage). I've never tested it with InputfieldFile but I think this should be supported as well.

There could be an additional select list to choose the fields (only list the fields with FieldTypes selected above) but I don't know if this is really necessary. Imagine you add another image field where you want to add extra fields, you had to go to module settings again and select the newly added field. If you don't need it for an image field, just don't touch the settings.  

  • Like 1

Share this post


Link to post
Share on other sites

Hello,

How do you add "InputfieldPageListSelect.min.js" to the module to fix the 0 issue with the link field? 

Ive tried hooking into the "InputfieldPageListSelect::render" but couldnt get it to work.

  • Like 1

Share this post


Link to post
Share on other sites

Hello,

How do you add "InputfieldPageListSelect.min.js" to the module to fix the 0 issue with the link field? 

Ive tried hooking into the "InputfieldPageListSelect::render" but couldnt get it to work.

I think I just modified the ImageExtra module to add it there. Have a go and if you are still having trouble I'll take a closer look.

  • Like 1

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 eelkenet
      Hi! I've created a small Inputfield module called InputfieldFloatRange which allows you to use an HTML5 <input type="range" ../> slider as an InputField. I needed something like this for a project where the client needs to be able to tweak this value more based on 'a feeling' than just entering a boring old number. Maybe more people can use this so I'm hereby releasing it into the wild. 
      EDIT: You can now install it directly from the Modules directory: http://modules.processwire.com/modules/inputfield-float-range/
       
      What is it?
      The missing range slider Inputfield for Processwire. 
      What does it do?
      This module extends InputfieldFloat and allows you to use HTML5 range sliders for number fields in your templates.
      It includes a visible and editable value field, to override/tweak the value if required.  
      Features
      Min/max values Precision (number of decimals) Optional step value (Read more) Optional manual override of the selected value (will still adhere to the rules above) Configurable rounding of manually entered values (floor, round, ceil, disable) Usage
      Clone / zip repo Install FieldtypeFloatRange, this automatically installs the Inputfield Create new field of type `Float (range)` or convert an existing `Float`, `Integer` or `Text` field. To render the field's value simply echo `$page->field` Demo
      A field with Min=0, Max=1, Step=0.2, Precision=2

      Field with settings Min=0, Max=200, Step=0.25, Precision=2

       
      Todo
      Make the display-field's size configurable (will use the Input Size field setting)  Hopefully become redundant  
      Changelog
      004 (current version)
      - Make rounding of manually entered values configurable (floor, round, ceil or disable)
      - Fix small JS bug when the value-display field was not displayed
      - Update README
      003
      - Code cleanup, add some ModuleInfo data & LICENSE
      - Submit to PW Modules directory (http://modules.processwire.com/modules/inputfield-float-range/)
      002
      - Fix issue where setting the step value to an empty value created problem with validation
      - Make the display-field optional
      001
      - Initial release
       
      Thanks!
       
       
    • By Gadgetto
      Status update links (inside this thread) for SnipWire development will be always posted here:
      2019-10-18
      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)
       




    • By Robin S
      Another little admin helper module...
      Template Field Widths
      Adds a "Field widths" field to Edit Template that allows you to quickly set the widths of inputfields in the template.

      Why?
      When setting up a new template or trying out different field layouts I find it a bit slow and tedious to have to open each field individually in a modal just to set the width. This module speeds up the process.
      Installation
      Install the Template Field Widths module.
      Config options
      You can set the default presentation of the "Field widths" field to collapsed or open. Field widths entered into the Template Field Widths inputfield are only applied if the Edit Template form is submitted with the Template Field Widths inputfield in an opened state. "Collapsed" is the recommended setting if you think you might also use core inputs for setting field widths in a template context. You can choose Name or Label as the primary identifier shown for the field. The unchosen alternative will become the title attribute shown on hover. You can choose to show the original field width next to the template context field width.  
      https://github.com/Toutouwai/TemplateFieldWidths
      https://modules.processwire.com/modules/template-field-widths/
    • By adrian
      Tracy Debugger for ProcessWire
      The ultimate “swiss army knife” debugging and development tool for the ProcessWire CMF/CMS

       
      Integrates and extends Nette's Tracy debugging tool and adds 35+ custom tools designed for effective ProcessWire debugging and lightning fast development
      The most comprehensive set of instructions and examples is available at: https://adrianbj.github.io/TracyDebugger
      Modules Directory: http://modules.processwire.com/modules/tracy-debugger/
      Github: https://github.com/adrianbj/TracyDebugger
      A big thanks to @tpr for introducing me to Tracy and for the idea for this module and for significant feedback, testing, and feature suggestions.
×
×
  • Create New...