ImagePicker Field

Recommended Posts

@MarcoPLY I don't know what it has to do with language.  I can't reproduce your problem. It works here in a multi language setup.

But as it is stated in the README on Github:


Please check for null before using the return value, because ImagePicker also allows exernal image URLs which do not reference an image object.

So always do this anyway:

if ($img!=null) {


Share this post

Link to post
Share on other sites

If I use if ($img!=null) and echo the image not print nothing in the html output.

If I use if ($img == null) in the html I can see the tag img but empty.

This what mean that give me beck an image object, but why do this ? I don't know if you can help me, but where I can check ?

Share this post

Link to post
Share on other sites

I really don't know.

It is working here, so there must be something special in your setup.

If you like, you can investigate what is going on in:

private function getAImage($imgpath) in InputfieldImagePicker.module

Thank you.

  • Like 1

Share this post

Link to post
Share on other sites

I have not been able to understand why in the language change some images return null value while others do not.

So, I inserted the images in this way:

$ima_small = $page->getInputField('image_card')->getImage();
$ima_big = $page->image_card;

if ($ima_small!=null) {
	$ima_small = $ima_small->width(400); // 
	echo '<img class="ima_normal" src="' . $ima_small->url . '">';
   } else {
	echo '<img class="ima_normal" src="' . $ima_big . '">';

Surely it is not the most elegant solution! but maybe this can be used to some one.

  • Like 1

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 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.

      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.
      Install the Template Field Widths module.
      Config options
      You can set the default presentation of the "Field widths" field to collapsed or open. 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.
    • By horst
      Croppable Image 3
      for PW 3.0.20+
      Module Version 1.1.16
      Sponsored by, many thanks Timo & Niko!
      You can get it in the modules directory!
      Please refer to the readme on github for instructions.
      Updating from prior versions:
      Updating from Croppable Image 3 with versions prior to 1.1.7, please do this as a one time step:
      In the PW Admin, go to side -> modules -> new, use "install via ClassName" and use CroppableImage3 for the Module Class Name. This will update your existing CroppableImage3 module sub directory, even if it is called a new install. After that, the module will be recogniced by the PW updater module, what makes it a lot easier on further updates.
      For updating from the legacy Thumbnail / CropImage to CroppableImage3 read on here.
    • By MoritzLost
      UPDATE: I have published a stable version of this module!
      Discussion thread:
      Hello there,
      I'm working on a tiny textformatter module that searches the text for titles of other pages on your site and creates hyperlinks to them. I'm not sure if something like this exists already, but I haven't found anything in the module directory, so I wrote my own solution 🙂
      It's not properly tested yet and is still missing some functionality I would like to implement, so at the moment it should be considered in BETA. Features include limiting the pages that will get searched by template, and adding a custom CSS class to the generated hyperlinks. As I'm writing this I noticed that it will probably include unpublished and hidden pages at the moment, so yeah ... it's still in development alright 😅
      You can download the module from Github:
      There's some more information in the readme as well.
      Anyway, let me know what you think! I'm happy about any feedback, possible improvements or ideas on how to improve the module. Cheers.
    • By blad
      Hi guys!
      I just uploaded a module to explore files based on elFinder. By default it will show the "Files" folder.

      To do:
       More options To fix:
       The function of rotating or scaling an image fails  Image editors V 1.01 (view issue)
      Fixed the bug working with the Multi-Language support ( translation of folders ). Fixed the name of elfinder.en  Github:
      I hope you like it.