perl: correct `content type` formatting for returning `image data uri`

前端 未结 1 1427
一向
一向 2021-01-28 09:18

I have a template in angularjs expecting the image data uri returned by a server call invoked through the src attribute of the img

相关标签:
1条回答
  • 2021-01-28 09:59

    Perl subroutine:

    my $photo = '/9j/4gIcSUNDX....oqOU1MzEFUa8x2MJf5JUjFV3llWW3UVscTLNhd93KFWQUrqHn/ABEc2CfmIASx0nMWLiN5f2hqE//Z';
    my $decoded= MIME::Base64::decode_base64($photo);
    content_type 'image/jpeg';
    $decoded;
    
    0 讨论(0)
提交回复
热议问题