theo Posted June 28, 2018 Author Posted June 28, 2018 @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) { ... }
Marco Ro Posted June 28, 2018 Posted June 28, 2018 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 ?
theo Posted June 28, 2018 Author Posted June 28, 2018 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. 1
Marco Ro Posted August 2, 2018 Posted August 2, 2018 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. 1
webdecker Posted September 11, 2020 Posted September 11, 2020 @theo: I just installed it and made a quick test. Great!
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now