Image "alt" tag?

50 views
Skip to first unread message

daniel

unread,
Dec 10, 2009, 9:45:09 AM12/10/09
to Magic Fields
Hey,

Anyone know of a way to add image alt="" tags to images from magic
fields?

Today I am using <?php echo get_image('field_name'); ?> to get the
image.

Thx!

Hunk

unread,
Dec 10, 2009, 1:52:38 PM12/10/09
to Magic Fields
Hello Daniel. you can use something like this
<?php echo echo gen_image("field_name",1,1,NULL, array("alt" => "some
alt")); ?>

David C

unread,
Dec 10, 2009, 10:46:00 PM12/10/09
to Magic Fields
I noticed today that the lack of an alt tag in images causes an error
in W3 validation.

So, having some way of assigning an alt value might be something
useful to add to Magic Fields in the future. I guess using this extra
line of code could fix it for the time being though.

James Gray

unread,
Dec 10, 2009, 10:51:56 PM12/10/09
to magic-...@googlegroups.com
I generally use the images (in groups) for js galleries, having the
abilty to assign text fields such as title, alt & Id would be
invaluable in this application. Either that or the abilty to create
sub groups in groups.

David Valdez

unread,
Dec 10, 2009, 10:59:11 PM12/10/09
to magic-...@googlegroups.com
Edgar gave a example of how  generate your images  with an alt attribute. i will put again his example:


<?php echo  get_image('field_name',1,1,NULL,array('alt'=>'something'));?>

David.

Hunk

unread,
Dec 11, 2009, 2:10:50 AM12/11/09
to Magic Fields
yes, can be used the function gen_image for add attributes to the tag
image

something like:

<?php
$my_attr = array("id" => "one id","class" => "class1 class2 class3",
"alt" => "one alt", "rel" => "my rel");
echo get_image('field_name',1,1,NULL,$my_attr);

?>

more information in http://wiki.magicfields.org/doku.php?id=es:front-end_functions#gen_image
(only spanish for the moment)

depi

unread,
Dec 12, 2009, 3:58:27 PM12/12/09
to Magic Fields
This should be IMHO added to the magic field, this way the pages are
W3C invalidated.

On Dec 11, 8:10 am, Hunk <ing.ed...@gmail.com> wrote:
> yes,  can be used the function gen_image for add attributes to the tag
> image
>
> something like:
>
> <?php
> $my_attr = array("id" => "one id","class" => "class1 class2 class3",
> "alt" => "one alt", "rel" => "my rel");
> echo  get_image('field_name',1,1,NULL,$my_attr);
>
> ?>
>
> more information inhttp://wiki.magicfields.org/doku.php?id=es:front-end_functions#gen_image

David Valdez

unread,
Dec 13, 2009, 1:21:01 AM12/13/09
to magic-...@googlegroups.com
in fact the function called "gen_image" IS PART of magic fields...
Or what you mean with "this should be IMHO added to the magic fields?

David

depi

unread,
Dec 13, 2009, 4:17:20 AM12/13/09
to Magic Fields
Sorry, I meant that the alt="" should be added to the output of that
function. I rather generated the image using get() instead of get_image
() as I wanted to have a valid code.

On Dec 13, 7:21 am, David Valdez <m...@gnuget.org> wrote:
> in fact the function called "gen_image" IS PART of magic fields...
> Or what you mean with "this should be IMHO added to the magic fields?
>
> David
>
Reply all
Reply to author
Forward
0 new messages