franciccio-ITALIANO Posted April 6, 2022 Posted April 6, 2022 Hi, in my template there is a small image that I would like to change from time to time. I created an image field, but it doesn't work. I have used the following code: <img src="<?=$page->my_image_field?>" alt=""> How come it is not working?
3fingers Posted April 6, 2022 Posted April 6, 2022 <img src="<?= $page->my_image_field->url ?>" alt="<?= $page->my_image_field->description ?>"> // never forget to add "alt" attribute here In your example the "url" property was missing.
franciccio-ITALIANO Posted April 6, 2022 Author Posted April 6, 2022 I replaced the code but it doesn't work. Maybe I have to write just the whole url as the address? <img src="<?=$page->note_MDL_my_image_field->url?>" alt="then I change it"> or <img src="<?=$page->note_MDL_my_image_field->urlimageaddress?>" alt="then I change it">
johndoe Posted April 6, 2022 Posted April 6, 2022 @franciccio-ITALIANO , check this out: https://processwire.com/docs/fields/images/
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