[See FAQ] Getting src of image field without html markup

More
9 years 6 months ago #49436 by horsey
I need to output XML for an existing mobile app and I got it so far.

I use
Code:
FlexicontentFields::getFieldDisplay($item, 'fieldname');
to retrieve the fields content.

However, I need just the src of an image field, adding my own markup.
Is there a function for that, or if not, where can I add it?

Please Log in or Create an account to join the conversation.

More
9 years 6 months ago #49439 by horsey
I did it with some regex function for now, if anybody runs into this
Code:
function getAttribute($attrib, $tag){ //get attribute from html tag $re = '/' . preg_quote($attrib) . '=([\'"])?((?(1).+?|[^\s>]+))(?(1)\1)/is'; if (preg_match($re, $tag, $match)) { return urldecode($match[2]); } return false; }

Please Log in or Create an account to join the conversation.

More
9 years 6 months ago #49440 by ggppdk
Hello

you can use:
Code:
$item->fields['imgfieldname']->thumbs_src['backend'][] $item->fields['imgfieldname']->thumbs_src['small'][] $item->fields['imgfieldname']->thumbs_src['medium'][] $item->fields['imgfieldname']->thumbs_src['large'][] $item->fields['imgfieldname']->thumbs_src['original'][]


See more in this FAQ article:
About custom display of image / gallery field


-- Flexicontent is Free but involves a big effort on our part.
Like the our support? (for a bug-free FC, despite having a long list of functions) Like the features? Like the ongoing development and future commitment to FLEXIcontent?
-- Add your voice to the FLEXIcontent JED listing with a 5-star...

Please Log in or Create an account to join the conversation.

More
9 years 6 months ago #49466 by horsey
Amazing, more than I would ever have asked for.

Please Log in or Create an account to join the conversation.

Moderators: vistamediajoomlacornerggppdk
Time to create page: 0.281 seconds
Save
Cookies user preferences
We use cookies to ensure you to get the best experience on our website. If you decline the use of cookies, this website may not function as expected.
Accept all
Decline all
Essential
These cookies are needed to make the website work correctly. You can not disable them.
Display
Accept
Analytics
Tools used to analyze the data to measure the effectiveness of a website and to understand how it works.
Google Analytics
Accept
Decline