Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW
 
PerlMonks  

Re: Images from - Android

by BrowserUk (Pope)
on Dec 18, 2012 at 12:33 UTC ( #1009354=note: print w/ replies, xml ) Need Help??


in reply to Images from - Android

when i dump the binary code to .txt and change it to .jpeg image is not shown.

JFIF is the correct internal identifier for .jpg's; changing it to .JPG doesn't make any sense at all.

If your image tools aren't recognising the file format, it probably means that it is getting corrupted in some (other) way.

I suspect, based upon your (very limited) code snippet, that you are probably forgetting to binmode the socket you are reading from, and/or using readline (or <$fh>) to read from that socket, without having changed the input separator.

To get a proper answer, you'd need to show the full code -- or at the very least, the code where you open the socket and read from it -- but the full code would save you and us time.


With the rise and rise of 'Social' network sites: 'Computers are making people easier to use everyday'
Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
"Science is about questioning the status quo. Questioning authority".
In the absence of evidence, opinion is indistinguishable from prejudice.

RIP Neil Armstrong


Comment on Re: Images from - Android
Re^2: Images from - Android
by clanrbr (Novice) on Dec 18, 2012 at 12:46 UTC
    This app is posting the image to perl script.
    my $req = new CGI; $contentpic=$req->param("pic") if ($req->param("pic") ); if ( open ( PICTF,">somepath/image.jpeg" ) ) { binmode PICTF; print PICTF $contentpic; close (PICTF); my ($x, $y, $info) = imgsize("somepath/image.jpeg"); $info=lc($info); $info=~s/jpg/jpeg/; if ( $info eq "jpeg" ) { my $logo=Imager->new(); $logo->read(file =>"somepath/mylogo.png", type => 'png'); my $imgorg=Imager->new(); $imgorg->read(file => "somepath/image.jpeg", type => $info); my $img=$imgorg->scale(xpixels=>280); my ($tx,$ty)=((280-$logosize[0]-$logooffs),(int(280*$y/$x)-$log +osize[1]-$logooffs)); $img->rubthrough( src=>$logo, tx=>$tx,ty=>$ty ); $img->write(file => "somepath/image.jpeg", type => $info); $result=1; }
      This app is posting the image to perl script.

      You're missing the point. Where and how do you obtain the data held in $contentpic?


      With the rise and rise of 'Social' network sites: 'Computers are making people easier to use everyday'
      Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
      "Science is about questioning the status quo. Questioning authority".
      In the absence of evidence, opinion is indistinguishable from prejudice.

      RIP Neil Armstrong

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1009354]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others romping around the Monastery: (6)
As of 2014-08-02 05:53 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    Who would be the most fun to work for?















    Results (55 votes), past polls