![]() |
|
How to limit text Output? - Printable Version +- ZenphotoCMS Forum (https://forum.zenphoto.org) +-- Forum: Support (https://forum.zenphoto.org/forum-1.html) +--- Forum: General support (https://forum.zenphoto.org/forum-4.html) +--- Thread: How to limit text Output? (/thread-13723.html) |
How to limit text Output? - kyrd - 2022-05-06 Hi, I'm using How to limit text Output? - acrylian - 2022-05-06 Use this to get the plain desc: Or the object model if there is a current image: Rhen use https://docs.zenphoto.org/1.5.x/function-truncate_string.html to shortend the text. Use this with the "bare" version. To keep formatting of HTML better use this as that try to fix invalid html (to work properly your server PHP needs the the tidy class installed):
The iamge item would be the single image page. Or the object model if there is a current image: The object model version would be If you mean the original full image itself:https://docs.zenphoto.org/1.5.x/function-getFullImageURL.html Or the object model if there is a current image: How to limit text Output? - kyrd - 2022-05-06 Thankyou for your help, I'll try to make it work in my site :-) How to limit text Output? - kyrd - 2022-05-09 I post here what I did, just in case someone else is interested after unsuccesfully trying to insert a dynamic link to the ImageURL by wrapping the above How to limit text Output? - acrylian - 2022-05-09
Yes, "fixing" broken HTML is the main purpose of this. For plain string truncation you can just use native PHP functions.
Rather basic native PHP actually. just check the length of the description to be larger than your expected length using How to limit text Output? - kyrd - 2022-05-09 mmm, yeah, so it would mean that to make it work properly one should scrap away the unwanted HTML before counting... surely someone who knows howto PHP can make it easily. How to limit text Output? - acrylian - 2022-05-09 Stripping html is rather easy using either our |