[Answered] [Solved] how do read the image field slug?

More
14 years 7 months ago - 12 years 5 months ago #5667 by kath
hi there!

i love flexicontent, just can't figute out how i can assemble the url for any of my image sizes?

i do see my printed_r $item with its fields, also it's easy to get my image field's ->display, but i want to get path and most important filename incl. prefix and filetype to build an <img /> tag.

anyone?
thanks a lot in advance guys!
kath :)
Last edit: 12 years 5 months ago by kath.

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

More
14 years 5 months ago #7197 by WebDesignHero
I was actually looking into this the other day.

For some reason, instead of putting the lightbox in the article template its part of the image plugin, and the default flexicontent image plugin is a beast.

So let's look at:
Code:
plugins/flexicontent_fields/image.php

We are interested in the user output so lets look at the function: onDisplayFieldValue()

We are interested in the following variable
Code:
$src = ($view == 'category') ? $srcs : $srcm;

This holds the path to the article image.

The problem is the returned value in the slug has all the other stuff going on like lightbox, so I was only able to do my custom stuff by echoing here. You can change this around so the slug only has the URL.

I haven't quite figured out how I want to go about dealing with this, but I was able to get the changes I made at the plugin level, though I think it would be better to have an object passed and then parsed in the template.

I hope my work helps with what you are trying to do.

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

More
14 years 5 months ago #7427 by kath
thanks a lot WebDesignHero!

i'll have a look later and post back what i did with it :)

kath

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

More
14 years 5 months ago #7532 by kath
^ that really helped - for now... :)

problem was i couldn't read the image slug comfortably, so with webdesignhero's help i added the following to flexicontent's image plugin object:

right before the end of function "onDisplayFieldValue()" (around line 212) i added

// 13:08 10.06.2010 kath added start
$field->{"test"} = array(
"tag" => $field->{$prop}
, "srcs" => $srcs
, "srcm" => $srcm
, "srcb" => $srcb
, "alt" => $alt
, "title" => $tip
/* add anything you want here */
);
// 13:08 10.06.2010 kath added end


works fine for me for the meantime.

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

More
12 years 5 months ago #25667 by kath
hi again,
how are the chances we have a better way of doing ^the above by now? and if we do, how can we update?
thanks a lot everyone for advice! kath :)

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

More
12 years 5 months ago #25668 by ggppdk
in v1.5.6 RC4+ you have inside the image field
Code:
// ADD some extra (display) properties that point to all sizes $field->{"display_small_src"} = JURI::root().$srcs; $field->{"display_medium_src"} = JURI::root().$srcm; $field->{"display_large_src"} = JURI::root().$srcb; $field->{"display_small"} = '<img src="'.JURI::root().$srcs.'" alt ="'.$alt.'"'.$legend.' />'; $field->{"display_medium"} = '<img src="'.JURI::root().$srcm.'" alt ="'.$alt.'"'.$legend.' />'; $field->{"display_large"} = '<img src="'.JURI::root().$srcb.'" alt ="'.$alt.'"'.$legend.' />';

As you see above, you can use:
$field->display_small_src
$field->display_medium_src
$field->display_large_src


to get the URL of the various images


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

Moderators: vistamediajoomlacornerggppdk
Time to create page: 0.490 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