Welcome, Guest
Username: Password: Remember me

TOPIC: [SOLVED] alt and title for images

alt and title for images 03 Aug 2014 12:45 #12566

  • VentoStudio
  • VentoStudio's Avatar
  • Offline
  • New Member
  • Posts: 11
  • Thank you received: 2
  • Karma: 0
in my component i've an image called "logo"
in component builder I selected to use Item title (field "Nazwa firmy") as an image title and image alt



but unfortunately in may component frontend an alt and title attribut are missing,

code generatet in frontend
<div class="controls">
    <div style="width:px;height:px; overflow:hidden;display:inline-block;" class="img-zone">
        <img style="" src="/sandbox/cms25/index.php?option=com_demo11407&amp;task=file&amp;size=195x145&amp;attrs=center,format:png&amp;path=[DIR_FIRMY_LOGO]/alf-2.png">
    </div>	
</div>

and the size of img-zone div i empty - the inline style

How can I solve this problem?

I use Joomla 2.5
Last Edit: 03 Aug 2014 12:54 by VentoStudio.
The administrator has disabled public write access.

alt and title for images 05 Aug 2014 14:27 #12573

  • admin
  • admin's Avatar
  • Offline
  • Administrator
  • Chef
  • Posts: 3711
  • Thank you received: 987
  • Karma: 140
I have fixed this.
But for the moment it is not in the builder.
You might upgrade manually JDom in your libraries folder
libraries/jdom/html/fly/file/image.php

Here is the fixed file of JDom :
github.com/Cook-Self-Service/JDom/blob/m...l/fly/file/image.php

Hope it helps...
Coding is now a piece of cake
The administrator has disabled public write access.

alt and title for images 05 Aug 2014 17:06 #12576

  • VentoStudio
  • VentoStudio's Avatar
  • Offline
  • New Member
  • Posts: 11
  • Thank you received: 2
  • Karma: 0
I managed to solve it in another way,

This is the original code from the generator:
<?php echo JDom::_('html.fly.file', array(
	'altKey' => 'alias',
	'attrs' => array('center','format:png'),
	'dataKey' => 'logo',
	'dataObject' => $row,
	'height' => 145,
	'indirect' => true,
	'root' => '[DIR_FIRMY_LOGO]',
	'route' => array('view' => 'firma','layout' => 'wizytowka','cid[]' => $row->id),
	'titleKey' => 'nazwa_firmy',
	'tooltip' => true,
	'width' => 195
));?>


and after modification:
<?php echo JDom::_('html.fly.file', array(
	'alt' => 'alias',
	'attrs' => array('center','format:png'),
	'dataKey' => 'logo',
	'dataObject' => $row,
	'height' => 145,
	'indirect' => true,
	'root' => '[DIR_FIRMY_LOGO]',
	'route' => array('view' => 'firma','layout' => 'wizytowka','cid[]' => $row->id),
	'title' => 'nazwa_firmy',
	'tooltip' => true,
	'width' => 195
));?>

Here is what has been modified:

'altKey' => 'alias',
to
'alt' => 'alias',

and
'titleKey' => 'nazwa_firmy',
to
'title' => 'nazwa_firmy',

and it also works :-)
Last Edit: 05 Aug 2014 17:06 by VentoStudio.
The administrator has disabled public write access.

alt and title for images 05 Aug 2014 19:59 #12577

  • admin
  • admin's Avatar
  • Offline
  • Administrator
  • Chef
  • Posts: 3711
  • Thank you received: 987
  • Karma: 140
This is strange.

You should eventualy can use :
<?php echo JDom::_('html.fly.file', array(
	'alt' => $row->alias,
	'title' => $row->nazwa_firmy,
));?>

But it is strange that it works as you say...

Note that the extra feature using the key, is that you can concat easily. For instance:
<?php echo JDom::_('html.fly.file', array(
	'altKey' => '{nazwa_firmy} - {alias}',
	'titleKey' => '{nazwa_firmy} - {alias}',
));?>
Coding is now a piece of cake
The administrator has disabled public write access.
Time to create page: 0.145 seconds

Get Started