Get duplicate images array

22 views
Skip to first unread message

Harris

unread,
Oct 3, 2009, 12:06:37 AM10/3/09
to Magic Fields
Sorry, I was making questions at the http://magicfields.org/

Could anyone lead me to the best way to display duplicate fields or
help me tweak my way so I can set the image size correctly?

I am using the following call (which works well) but it is displaying
the original image size. I would like to find a way to set the size
though.

This is the code.

<?php
$total = getFieldDuplicates('tekimg',1);
for($i = 1; $i < $total+1; $i++){
echo "<a href='" .get('tekimg',1,$i). "'rel='lightbox'>";
echo "<img src='" . get("tekimg",1,$i) . "' class='newsImgClass' />";
echo "</a>";
}?>

If you guys know a better way to display duplicate fields and the
ability to set the image size I really appreciate.
Thanks.
Harris

Hunk

unread,
Oct 3, 2009, 1:43:12 AM10/3/09
to Magic Fields
hi Harris

the best form to show repeated fields is with the following code.

get_image creates a thumbnail of the image with the parameters that
were defined for the field (Max Height, Max Width or Custom) and
returns tag of img

<?php
$images = getFieldOrder(tekimg');
foreach($images as $image){
echo "<a href='" .get('tekimg',1,$image). "'rel='lightbox'>";
echo get_image('tekimg',1,$image);
echo "</a>";
}
?>


if your you want to create a thumbnail with other parameters you can
use gen_image. example

$new_params = array("w"=> 100, "h" => 100, "zc" => 1, "q" => 1); //
these are parameters for phpthumb
$add_tag = array("alt" => "one image", "class"=>" class_1
class_2","rel" => "one rel"); // Attributes of the tag image

echo gen_image('tekimg',1,$image,$new_params,$add_tag);
echo gen_image('tekimg',1,$image,NULL,$add_tag);
echo gen_image('tekimg',1,$image,$new_params);


On Oct 2, 11:06 pm, Harris <hhf...@gmail.com> wrote:
> Sorry, I was making questions at thehttp://magicfields.org/

Harris

unread,
Oct 3, 2009, 1:01:13 PM10/3/09
to Magic Fields
Edgar, thanks for the new method. Worked perfectly.

For the second one I am still lost, but I will try figure out how to
work with it.
It seems there are many parameters and short codes that can be used.
But just like flutter, we are pretty much on our own to discover what
to use since there is no documentation about it.
I really appreciate all your help.

Harris
Reply all
Reply to author
Forward
0 new messages