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

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

I use
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.

3 years 7 months ago #49439 by horsey
I did it with some regex function for now, if anybody runs into this
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.

3 years 7 months ago #49440 by ggppdk
Hello

you can use:
$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 review. Thanks!

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

3 years 7 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
© 2018 Flexicontent. All Rights Reserved.