>
> On Jan 2, 2008, at 7:21 AM, Alexandru Stanoi wrote:
>
>> Dave Fischetti wrote:
>>> Hey Derick and all...
>>> I just thought I would follow up on this again and see if anyone
>>> can shed any light on this. It just happened again and I'm
>>> stumped as to how to prevent the script from dying when it tries
>>> to parse an email that has an image path that is incorrect in the
>>> header. As mentioned, this is the Warning i'm receiving
>>> (below)... any help is REALLY appreciated!
>>> Will just ignoring all warnings allow this to right right? not
>>> the right solution, but its something? Don't think it will help
>>> though.
>>> Error below.... Thanks again
>>> <br />
>>> <b>Warning</b>: fopen(/tmp/13420-1/cam_data/photo093.jpg) [<a
>>> href='function.fopen'>function.fopen</a>]: failed to open stream:
>>> No such file or directory in <b>/usr/include/php/
>>> ezcomponents-2007.1.1/ Mail/src/parser/parts/file_parser.php</b>
>>> on line <b>131</b><br />
>>> <br />
>>> <b>Warning</b>: stream_filter_append() expects parameter 1 to be
>>> resource, boolean given in <b>/usr/include/php/
>>> ezcomponents-2007.1.1/ Mail/src/parser/parts/file_parser.php</b>
>>> on line <b>173</b><br />
>>> <br />
>>> <b>Fatal error</b>: Uncaught exception
>>> 'ezcBaseFileNotFoundException' with message 'The file '/tmp/
>>> 13420-1/cam_data/photo093.jpg' could not be found.' in /usr/
>>> include/php/ezcomponents-2007.1.1/Mail/src/parts/ fileparts/
>>> disk_file.php:86
>>> Stack trace:
>>> #0 /usr/include/php/ezcomponents-2007.1.1/Mail/src/parts/
>>> file.php(93): ezcMailFile->__set('fileName', '/tmp/13420-1/
>>> ca...')
>>> #1 /usr/include/php/ezcomponents-2007.1.1/Mail/src/parts/
>>> fileparts/ disk_file.php(32): ezcMailFilePart->__construct('/
>>> tmp/13420-1/ca...')
>>> #2 /usr/include/php/ezcomponents-2007.1.1/Mail/src/parser/parts/
>>> file_parser.php(246): ezcMailFile->__construct('/tmp/13420-1/
>>> ca...')
>>> #3 /usr/include/php/ezcomponents-2007.1.1/Mail/src/parser/parts/
>>> multipart_parser.php(146): ezcMailFileParser->finish()
>>> #4 /usr/include/php/ezcomponents-2007.1.1/Mail/src/parser/parts/
>>> multipart_parser.php(180): ezcMailMultipartParser-
>>> >parseBody('------ =_Part_84...')
>>> #5 /usr/include/php/ezcomponents-2007.1.1/Mail/src/parser/parts/
>>> rfc822_parser.php(111): ezcMailMultipartParser-
>>> >parseBody('------ =_Part_ in <b>/usr/include/php/
>>> ezcomponents-2007.1.1/Mail/src/parts/ fileparts/disk_file.php</b>
>>> on line <b>86</b><br />
>>
>> Hi Dave,
>>
>> I opened an issue for this (http://issues.ez.no/12318) and I added
>> a fix for it. The slashes (and other unsafe characters) are
>> converted to underscores. This should prevent the warnings you get.
>>
>> The fix is in SVN for now, and it will be available in Mail 1.4.1
>> release which will come out soon (later this month probably).
>>
>> Hope this fixes your problem.
>>
>> Cheers,
>
>
> Alex, Thanks for this. Its really appreciated.
>
> If you don't mind I do have one quick question about something
> different. The parser has been working great for me. All users who
> submit images from their phones are parsed and added to their
> account. This works great for all users accept those sending emails
> from a specific mobile carrier.
>
> I check if there is an image with:
>
> if ( get_class( $part ) === 'ezcMailFile' ) {
>
> and when I get here, this is where I have the problem
>
> $my_image = array_values(getimagesize($part->fileName));
>
> For this specific carrier, I get this error every time an image is
> attached:
> <b>Warning</b>: array_values() [<a href='function.array-
> values'>function.array-values</a>]: The argument should be an array
> in <b>/var/www/vhosts/broadtexter.com/httpdocs/_maintenance/phpcgi/
> inboxManager.php5</b> on line <b>671</b><br />
>
> I realize this is probably not a EZ issue. But perhaps there's
> something I should be doing differently for messages from this source.
>
> Below is an example of the source of a message like this. I'm not
> sure whats different here when compared to the other users who get
> parsed no problem.
>
> Thanks again:
>
> Dave
>
> Message Source below
> ------------------------------
>
> MIME-Version: 1.0
> Content-Type: multipart/related; type="text/html";
> boundary="----=_Part_659415_20850935.1199378668689"
> Importance: Normal
> X-MMS-Message-Type: MM4_forward.REQ
> X-Priority: 3
>
> ------=_Part_659415_20850935.1199378668689
> Content-Type: text/html
> Content-Transfer-Encoding: quoted-printable
> Content-ID: <0000>
> Content-Disposition: inline
>
> <html>
>
> [snip]
>
> </html>
>
> ------=_Part_659415_20850935.1199378668689
> Content-Type: text/plain; charset=utf-8;
> name=smiltextpartfilename0.txt
> Content-Transfer-Encoding: 7bit
> Content-Location: smiltextpartfilename0.txt
> Content-ID: <155>
> Content-Disposition: inline
>
> msg
> ------=_Part_659415_20850935.1199378668689
> Content-Type: image/jpeg; name=1231071650a.jpg
> Content-Transfer-Encoding: base64
> Content-Location:1231071650a.jpg
> Content-ID: <156>
>
> /9j/4AAQSkZJRgABAQAAAQABAAD/
> 2wBDAAEBAQEBAQEBAQECAQEBAgICAQECAgICAgICAgIDAgMD
> AwMCAwMEBAQEBAMFBQUFBQUHBwcHBwgICAgICAgICAj/
> 2wBDAQEBAQICAgUDAwUHBQQFBwgICAgI
> CAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAj/
> xAGiAAAABgIDAQAA
> AAAAAAAAAAAHCAYFBAkDCgIBAAsQAAIBAgUCAwQGBgUFAQMGbwECAwQRBQYhEgAHMUETCFEiYRRx
> gTKRCaEj8M
Just following up on my message above regarding warnings I'm getting
from emails from specific users phones.
I solved the Warning problem by changing my code to check if its an
array, before using array_values(), but I'm still unsure why the image
was missed. All images are missed when they come from this one phone
carrier.
I parsing the mail as follows. Not sure why its being missed. unless
the $type value is not 2 even though its a jpg. I'll look into that
more.
foreach ( $parts as $part )
{
if ( get_class( $part ) === 'ezcMailText' && $part->subType ===
'plain' && $bodySet != true )
{
$bodyFull = trim($part->text);
$bodySet = true;
}
////// MANAGE INCOMING IMAGE FROM FAN //////
if ( get_class( $part ) === 'ezcMailFile' && $imageSet != true) {
$getImage = getimagesize($part->fileName);
if (is_array($getImage) && $getImage !== false) {
$my_image = array_values($getImage);
list($width, $height, $type, $attr) = $my_image;
if ($type == 2 && basename($part->fileName)) {
if (filesize($part->fileName) < 4194304) { //
only accept images <
4MB
$imageErr = false;
$imageSet = true;
break;
} else {
$imageErr = 1;
break;
}
}
} else {
$imageErr = 2;
}
}
}
Also, in some cases with this carrier, the content-type "name" does
not match the Content-Location. In all my successful parsings so far,
it did match. I'm wondering if the parser is looking at Content-
Location when it should be looking at the "name" field, or at least
using the name field when the 2 don't match.
Content-Type: image/jpeg; name=me.jpg
Content-Transfer-Encoding: base64
Content-Location:media1.jpeg
Content-ID: <268>
However
This seems to be the case with this message, but then again, my
message below has the same "name" and Content-Location value. So I'm
not sure why its being missed there.
Thanks again,
Dave
--
Components mailing list
[email protected]
http://lists.ez.no/mailman/listinfo/components