Jump to content

Recommended Posts

Posted

@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:

Quote

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:
 

$img=$page->getInputField('imagepicker')->getImage();
if ($img!=null) {
   ...
}

 

Posted

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 ?

Posted

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
  • 1 month later...
Posted

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
  • 2 years later...
  • 6 years later...
Posted

Hi, @theo

I tried this module. It turns out that calling Image Picker List throws an error on File: ...\site\modules\ImagePickerField\ImagePickerList.module:33

"Deprecated: urlencode(): Passing null to parameter #1 ($string) of type string is deprecated"

I suppose this is due to the fact that I'm using PHP 8.3 - I have to adopt that version, in order to use some other modules.

Are you still maintaining this module? Is it possible to rephrase the code, so that it complies with PHP 8.3? In fact, I suspect some other lines of code have the same problem.
I'm not a programmer, so I can't fix it.

Thanks

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
×
×
  • Create New...