Skip Navigation

[Resolved] types_render_termmeta does not recognize size attribute when output is raw

This support ticket is created 7 years, 7 months ago. There's a good chance that you are reading advice that it now obsolete.

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

Our next available supporter will start replying to tickets in about 1.84 hours from now. Thank you for your understanding.

Sun Mon Tue Wed Thu Fri Sat
- 7:00 – 14:00 7:00 – 14:00 7:00 – 14:00 7:00 – 14:00 7:00 – 14:00 -
- 15:00 – 16:00 15:00 – 16:00 15:00 – 16:00 15:00 – 16:00 15:00 – 16:00 -

Supporter timezone: Europe/London (GMT+01:00)

This topic contains 2 replies, has 2 voices.

Last updated by karex 7 years, 7 months ago.

Assisted by: Nigel.

Author
Posts
#441716

I am trying to use a term meta image in a specific size, but types_render_termmeta does not recognize size attribute when output is raw. If the raw attribute is not set, the specified resized images is returned, however, when the output is set to raw, the original file is returned always.

E.g. this returns the correct, resized image, but obviously inside the img tag:

types_render_termmeta("background", array( "term_id" => $term_id, "size" => "thumbnail" ) );

E.g. this return the original image instead of the resized image:

types_render_termmeta("background", array( "term_id" => $term_id, "output" => "raw", "size" => "thumbnail" ) );

PS: Is this the place to report these kinds of bugs or is there a real bug reporting system somewhere what I was not able to find?

#441896

Nigel
Supporter

Languages: English (English ) Spanish (Español )

Timezone: Europe/London (GMT+01:00)

Here is the reference documentation for the Types image field:
https://toolset.com/documentation/customizing-sites-using-php/functions/#image

Note this text:
If output=”raw”, url of the image will be returned.

If url=”true”, the url of the resized image will be returned.

My reading of that is that you need to set output to raw and url to true for the resized image url to be returned.

I haven't tested it, but I note that you don't specify the url parameter in your example.

This is the right place to report suspected bugs. Our public forums are where we interact with clients, and we have an internal bug-reporting system where we escalate confirmed issues to developers.

#442961

Thanks Nigel.

It seems output takes precedence over url.

So if you set output to raw, url will not be taken into account.

So the solution is not to use output, but use the url.

This ticket is now closed. If you're a WPML client and need related help, please open a new support ticket.