Hello Roman,
Could you specify the functionality of your script a bit please. (How it
works)
I forgot to mention that this part:
<img width="99" height="120" border="0" src="%s" />',
is not always the same. The image properties can vary.
Thanks
-Will
"Roman Neuhauser" <[EMAIL PROTECTED]> kirjoitti
viestissä:[EMAIL PROTECTED]
># [EMAIL PROTECTED] / 2007-01-18 12:34:36 +0200:
>> I need to strip all characters from the following text string exept the
>> image path...
>>
>> "<img width=\"99\" height=\"120\" border=\"0\"
>> src=\"../../images/new/thumps/4123141112007590373240.jpg\" />"...and then
>> store the path to DB. Image path lengh can vary so I guess that I need to
>> extract all characters after scr=\" until next \" or
>> somethig
>> similar.
>
> This passes with 5.2:
>
> class ImgSrcTest extends Tence_TestCase
> {
> private $src, $str, $xml;
> function setUp()
> {
> $this->src = 'fubar.jpg';
> $this->str = sprintf(
> '<img width="99" height="120" border="0" src="%s" />',
> $this->src
> );
> $this->xml = new SimpleXmlElement($this->str);
> }
> function testReturnsAttributeAsSimpleXMLElements()
> {
> return $this->assertEquals('SimpleXMLElement',
> get_class($this->xml['src']));
> }
> function testCastToStringYieldsTheAttributeValue()
> {
> return $this->assertEquals($this->src, strval($this->xml['src']));
> }
> }
>
> --
> How many Vietnam vets does it take to screw in a light bulb?
> You don't know, man. You don't KNOW.
> Cause you weren't THERE. http://bash.org/?255991
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php