Jump to content

Cannot display image descriptions


alanxptm
 Share

Recommended Posts

Hi

Even when it was very intuitive I have read the docs at: https://processwire.com/docs/fields/images/

But still I've been unable to display image descriptions from my testImg field, here's my code:

<?php
	if(count($page->testImg)){
		foreach($page->testImg as $image) {
			echo "<img src='{$image->url}'  alt='{$image->description}'  />";
			echo $image->description;
		} 
	}
?>

This is the output:

<img src='/old/site/assets/files/1122/02.gif' alt='' /><img src='/old/site/assets/files/1122/03.gif' alt='' />

And the field in use, don't know if maybe Im not using the correct field for description, but it's the only one I see when clicking an image

field.PNG

Edit:

I thought that maybe it was because of the second language "Spanish" But I have deleted it, set to language default and still having the same result.

Link to comment
Share on other sites

Well it seems after I've deleted spanish language, the field is unable to save its description field in the page.

Already tried to:

- delete images, re-add them, write descriptions, save.. Didn't save the descriptions field

- delete field from template, delete field from PW, re-create field, add to template, add images with descriptions.. Didn't save the descriptions field

Don't know what have I broke or how to fix it.. Do I need to reinstall PW?

Link to comment
Share on other sites

4 minutes ago, Ivan Gretsky said:

Hey, @alanxptm!

I am just guessing, but maybe you got your description filled only in one language, but output the value of some other (probably default) language. And it is blank.

You're right. I was thinking on that too, but got confused because there isn't a description field for each language and the single one didn't save its text.

I have checked the box for "disable multilanguage descriptions" at edit field->input and now is working fine.

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...