> 2009/10/28 Hannes Magnusson <hannes.magnus...@gmail.com>: > > 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 > > > > OK, so PhD would need to work out the aspect ratio and handle the > conversion to a fixed size rather than allowing the user agent. handle > the sizing natively when only the width _or_ depth are supplied.
> I've no problem with that, but it is redundant. HTML doesn't require > them. That's it. Best practise would be to follow the spec surely? > > [1] shows that height and width are implied and [2] specifically says > "When specified, the width and height attributes tell user agents to > override the natural image or object size in favor of these values.", > but that can certainly be countered by [2] "The height and width > attributes give user agents an idea of the size of an image or object > so that they may reserve space for it and continue rendering the > document while waiting for the image data." > > Ho hum. I always knew that the spec was vague but those 2 statements > really do muddy things - are they required or not (no but it sure > helps seems to be the answer). > > So do we do more work in PhD or just let the user agent do its job? > > If I had free rein, I'd make all images fit to a thumbnail size and > add lightbox or something similar. We are already using jQuery for > some user enhancements, so ... > > Richard. > [1] > http://www.w3.org/TR/1999/REC-html401-19991224/struct/objects.html#edef-IMG > [2] http://www.w3.org/TR/1999/REC-html401-19991224/struct/objects.html#visual > > shows that the height and width are implied. I would suggest adding the values only if the DocBook markup does not supply both of the values. In this case it will help the UA by supplying values to reserve space.. If the author has supplied one (but not both) of the values, then they have either made a conscious choice to omit one, or a mistake. In either case PhD should respect the supplied data and leave it to the UA to decide how to handle the missing item. Can PhD give warnings? If so, informing the user of missing width/height values (where one is supplied but not the other), and of missing alt values would be useful. > -- > ----- > Richard Quadling > "Standing on the shoulders of some very clever giants!" > EE : http://www.experts-exchange.com/M_248814.html > Zend Certified Engineer : http://zend.com/zce.php?c=ZEND002498&r=213474731 > ZOPA : http://uk.zopa.com/member/RQuadling