franciccio-ITALIANO Posted April 6, 2022 Share 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? Link to comment Share on other sites More sharing options...
3fingers Posted April 6, 2022 Share 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. Link to comment Share on other sites More sharing options...
franciccio-ITALIANO Posted April 6, 2022 Author Share 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"> Link to comment Share on other sites More sharing options...
johndoe Posted April 6, 2022 Share Posted April 6, 2022 @franciccio-ITALIANO , check this out: https://processwire.com/docs/fields/images/ Link to comment Share on other sites More sharing options...
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