•  
      CommentAuthorSpode
    • CommentTimeDec 2nd 2009 edited
     

    I've been having intermittent issues with JournoTwit and TwitPic support - and honestly, just assumed it was their service being flakey. But today, I came across the problem.

    So if your using cURL in PHP to upload your pictures - you might have some code like this:

    $params = array( "source"=>"journotwt", "media"=>"@$filename", "username"=>"$username", "password"=>"$password", "message"=> $_POST['StatusText'] );

    This works. However, when doing an @reply with a picture it in - the text starts with an "@". PHP considers this to be a file pointer - so instead of sending the text, attempts to send a file. The solution/work around to this, is to prepend a space to the beginning of the tweet, like so:

    $params = array( "source"=>"journotwt", "media"=>"@$filename", "username"=>"$username", "password"=>"$password", "message"=> " " . $_POST['StatusText'] );

    I'm not sure if it's PHP, cURL or the TwitPic servers - but one of them trims out the leading white space and nobody is any the wiser...

    • CommentAuthorGuest
    • CommentTimeDec 2nd 2009
     

    You use double quotes for strings? I know the performance impact is minimal but I still have a habit of only using double quotes when actually needed.

    •  
      CommentAuthorSpode
    • CommentTimeDec 2nd 2009
     

    Actually, I usually don't! But I must admit, I'm not overly strict about it. I'll bare that in mind - especially in multi-pass loops!

    •  
      CommentAuthorHuddy
    • CommentTimeDec 3rd 2009
     

    I have to say that the title of this topic sounds like the title of a reeeeally boring book (perhaps a detective story)! :D

    •  
      CommentAuthorSpode
    • CommentTimeDec 9th 2009
     

    I'd buy that book. Or the ever more popular - "Harry Potter and the Tale of the Mistaken At Symbol"

 
Copyright Andrew Miller (Spode), 2008