On Tue, Oct 27, 2009 at 00:41, Niel <spam-f...@blueyonder.co.uk> wrote:
>> Shouldnt it fall back on getimagesize() if these options arent provided?
>>
>> This mail was sent from my HTC MAGIC. Sorry for any and all typos that may
>> have been in this mail.
>>
>> On Oct 26, 2009 10:38 a.m., "Richard Quadling" <rquadl...@php.net> wrote:
>>
>> rquadling                                Mon, 26 Oct 2009 14:38:21 +0000
>>
>> Revision: http://svn.php.net/viewvc?view=revision&revision=289941
>>
>> Log:
>> Fix bug#49925 : imagedata now supports width and/or depth (becomes width
>> and/or height)
>>
>> Bug: http://bugs.php.net/49925 (Open) PhD does not support width and depth
>> attributes for the <imagedata> element
>>
>> Changed paths:
>>    U   phd/trunk/package_generic.xml
>>    U   phd/trunk/phpdotnet/phd/Package/Generic/XHTML.php
>>
>> Modified: phd/trunk/package_generic.xml
>> ===================================================================
>> --- phd/trunk/package_generic.xml       2009-10-26 14:14:58 UTC (rev 289940)
>> +++ phd/trunk/package_generic.xml       2009-10-26 14:38:21 UTC (rev 289941)
>> @@ -1,4 +1,4 @@
>> -<?xml version="1.0" encoding="UTF-8"?>
>> +?<?xml version="1.0" encoding="UTF-8"?>
>>  <package xmlns="http://pear.php.net/dtd/package-2.0";
>>   xmlns:tasks="http://pear.php.net/dtd/tasks-1.0";
>>   xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
>> @@ -47,6 +47,7 @@
>>   <license uri="http://www.opensource.org/licenses/bsd-license.php";>BSD
>> Style</license>
>>   <notes>
>>     - Implemented PEAR request #2390: RSS feeds for PEAR Dcumentation Index
>> (Christian)
>> +    - Fixed bug #49925 - imagedata now supports width and/or depth (becomes
>> width and/or height) (Richard Quadling)
>>   </notes>
>>
>>   <contents>
>>
>> Modified: phd/trunk/phpdotnet/phd/Package/Generic/XHTML.php
>> ===================================================================
>> --- phd/trunk/phpdotnet/phd/Package/Generic/XHTML.php   2009-10-26 14:14:58
>> UTC (rev 289940)
>> +++ phd/trunk/phpdotnet/phd/Package/Generic/XHTML.php   2009-10-26 14:38:21
>> UTC (rev 289941)
>> @@ -1299,10 +1299,11 @@
>>     public function format_imagedata($open, $name, $attrs) {
>>         $file    = $attrs[Reader::XMLNS_DOCBOOK]["fileref"];
>>         $newpath = $this->mediamanager->handleFile($file);
>> -        if ($this->cchunk["mediaobject"]["alt"] !== false) {
>> -            return '<img src="' . $newpath . '" alt="'
>> .$this->cchunk["mediaobject"]["alt"]. '" />';
>> -        }
>> -        return '<img src="' . $newpath . '" />';
>> +       $width   = isset($attrs[Reader::XMLNS_DOCBOOK]["width"]) ? '
>> width="' . $attrs[Reader::XMLNS_DOCBOOK]["width"] . '"' : '';
>> +       $height  = isset($attrs[Reader::XMLNS_DOCBOOK]["depth"]) ? '
>> height="' . $attrs[Reader::XMLNS_DOCBOOK]["depth"] . '"' : '';
>> +       $alt     = ($this->cchunk["mediaobject"]["alt"] !== false) ? ' ' .
>> $this->cchunk["mediaobject"]["alt"] : '';
>> +
>> +        return '<img src="' . $newpath . '"' . $alt . $width . $height . '
>> />';
>>     }
>>
>>     public function format_table($open, $name, $attrs, $props) {
>>
>>
>> --
>> PHP Documentation Commits Mailing List (http://www.php.net/)
>> To unsubscribe, visit: http://www.php.net/unsub.php
>
> The alt attribute is required, so should not be omitted for the xhtml;
> even if the DocBook source does not supply a value.  Default value if
> not supplied should be the filename, unless someone has a better idea?

Good point, the media object should always produce a alt attribute for <img>s.



> Although not required, adding the width and height values if not
> supplied seems a good idea.

I consider it to be "best practice" to provide these values...

-Hannes

Reply via email to