> How about these lines instead:
>
> if (strpos($attrs, 'height=') === false && strpos($attrs, 'width=') === 
> false) {
>      list($realwidth,$realheight) = getimagesize($fieldURL.$location);
>      $attr .= " width='$realwidth' height='$realheight'";
>      }
>
> It should solve the first problem plus help with performance as it
> only runs the getimagesize function when needed.  (No idea how fast
> that function may be)...

Good idea. Yes, it's simpler and faster. But we can make it even
simpler:

if (strpos($attrs, 'height=') === false && strpos($attrs, 'width=')
=== false) {
        $size = getimagesize($fieldURL.$location);
        $attr .= $size[3];
        }

The fourth element of the array returned by getimagesize is the whole
string (height="xxx" width="xxx"). I didn't use before because I
wanted to substitute the missing dimensions separately.

In fact it could be simpler with only one command:
        $attr .= getimagesize($fieldURL.$location)[3];
But it seems it's not allowed in PHP [:-(].

By the way, I've just seen a little detail in the upload function. In
this line:

$attr .= " $f='$v' ";

the leader space could be removed:

$attr .= "$f='$v' ";

It creates unnecessary doble spaces between attributes; and there's a
space before $attr in the final return.

I think the same line exists in other functions that compile XHTML
attrs.


Cheers
Marcos

--
http://alinome.net

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"BoltWire" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/boltwire?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to