3

PNG base64 画像を含む Fedex Shipping API からの応答を受け取りましたが、画像は垂直に来ています。この画像をディスクに保存せずに 90 度回転させ、さらに印刷するためにブラウザに表示したいと思います。

最初に文字列をデコードしてから、次を使用して回転させてみました

$rotate_image = imagerotate($image, 90, 0);
echo "<img src=\"data:image/PNG;base64,".$image."\" alt=\"Label\" />";

しかし、私は運がありませんでした!!

サンプル画像文字列

$image = "iVBORw0KGgoAAAANSUhEUgAAAyAAAASwAQAAAAAryhMIAAAml0lEQVR42u3d328jyZ0Y8Gr3Qb0HbKZ9yEMoQGDZ2ADzOmsBFw3CY/lg4PJ2+54XSxhHfNVCCY6EaXbTMkQHWIwSzIsETNh/Q+CHPMVDmc7SgwjTAfJwMZy7aS4n7BcD29wOstXYmqp8q7tJkRQpUSSb3p0teqxfS/VHXT++9f0WmyQSG7ghhShEIV8jhNa0MKi6fogE1/yQFEnyH6OAYL9La7gR8T3j5i+f+OEjkxo00BERbp2RINDDYA7i5VHYKnQAsTjyw+I1UjT9VlAw9dkI3PeRQfUhEpitIz30rNlI52n12N0BpEh4tRQWq07yHwch63SunuQ6uwNGPr/xu7zgh7u9aPCFReCvOnN6nTNCen0yG3Ff1Y6dT9rQUITXSmGBpUg3fOs3mqWLfqXLiHsTgfvuhlGUIKbj+w4mbfc25OolII78xcdD5KUfiYcx8jKaj7AY4R8R38cOeTYPcfq1Y8IkchH/4hD5/ZsKLvEnuU8rv4+IcxOx/BEScvcDNySC/ErMRaohYVcJsq8/jNK/OvL2TJ8fFR5UonAGIkxPl4hPABGuFiPhfASliMOr+7o+Qnq5js8CifjkxU2kDkgvRuToyiUIt+YhRlh4/1VJIjAstREiLnyfhoVXErn5BwpPDuERwhKEzUUqIwQm4/YEMvCh4yN3FsJKMBmT5hIjhIp5SDkkV+5DiUBnFgJjDAljpGXeQGBEwSAREWvhEeKQMBLzhnA1dGIE30T8uUg8EkVEh0g8hMNwPgLzxG3IyQhI8dhPER8QN0ZE0ZqHRK4TIwWYjDDM/DmI/7R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bUaYt+OGEtvgY9vqrWGa99UIrEeJBhDzHlIXIcvtxk1vtHpoXSLeyq5G0Ps5RGaBPFgYntQG0MMnj7tdwWEJR3OJrZsrxNu+ARI3FLLPQdlVDoYySdtRqW1HkQOXjN51MGYUWmlCBbiruzuVqSVFlbJp+lKK0aKCaIvjwRoOADEWB9dI+Y6kOH4t7O5gF9dgaMQhShEIQpRiEIUohCFKEQh2SHex1QPCB5QXG+xj1s6J7ot//Xg41nLqxk9+EmAemdU58bOAwN+AvfX6/H9TXkH7wjusIfrlJnyn/7UUIhCFKIQhShEIQpRiEIUohCFKEQhClGIQhSiEIUoRCEKUYhCFKIQhShEIQpRiEIUohCFKEQhClGIQhSiEIUoRCEKUYhCFKIQhShEIQpRiEIUohCFKEQhClGIQpZH1AuIKEQhClGIQhSiEIV845H/D5MJR+NGNjvOAAAAAElFTkSuQmCC";
4

5 に答える 5

4

transformcss3プロパティのおかげで、ブラウザーで回転を行うこともできます。

#yourimage {
   transform: rotate(90deg);
   -ms-transform: rotate(90deg);
   -moz-transform: rotate(90deg);
   -webkit-transform: rotate(90deg);
}

このプロパティのサポートについては、基本的にすべてのブラウザと IE9 以降を参照してください。

于 2012-10-16T00:28:06.347 に答える
2

サーバーに Imagick がインストールされていますか? もしそうなら、以下はうまくいくはずです...

$imagick = new Imagick(); 
$imagick->readImage($file);
$imagick->rotateImage(new ImagickPixel(),90);
header('Content-type: image/jpg'); //or whatever the image file is, set headers...
echo $imagick;
$imagick->clear(); 
$imagick->destroy();
于 2012-10-16T00:24:45.717 に答える
1

画像を保存し、回転させ、ブラウザに表示し、最後に削除するだけでした。

$label = imagecreatefromstring(base64_decode($image));

$rotated_imaged = imagerotate($label, 90, 0);
imagepng($rotated_imaged, '/var/www/vhosts/website.com/httpdocs/labels/fedex-test.png');
unlink('/var/www/vhosts/website.com/httpdocs/labels/fedex-test.png');

皆さんありがとう

于 2012-10-16T01:00:16.530 に答える
0

問題は、生成した PNG をファイルに送信するかimagepng() ブラウザに送信することです。代わりに変数に格納するオプションはありません。したがって、ファイルを保存せずに必要なことを行うには、おそらく base64 でエンコードされた変数から、PHP スクリプトでオンザフライで画像を生成する必要があります。GET

2 つのスクリプトを考えてみましょう。それらwrap.phpを と と呼びましょうrotate.php

wrap.phpは次のようになります。

<?php

  // Pixel Art from Star Wars http://www.pixeljoint.com/pixelart/1423.htm
  $image = "iVBORw0KGgoAAAANSUhEUgAAARgAAAEYCAMAAACwUBm+AAAAAXNSR0IArs4c6QAAAKtQTFRFsAAAvbWSLUUrLEQqY1s8UYJMqJ1vNTEgOiIdIzYhjIFVLhsXZ6lgSEIsP2U8JhcCVzMsSXZEgXdOO145XJdWOl03LzAYMk4vSXNExr+hwcuxRTs1Qmk+RW9Am49eFRANQz4pUoNMQWc+OSMDTz0wLBsCNVMxa2NBOyUDUoNNSnlEWo9VRGxAVzYFl6tXCggHbLNmMUIcHhwTXkk5f3VNRT8wUT8xAAAACQocRBWFFwAAAAF0Uk5TAEDm2GYAAAPCSURBVHja7d3JctNAFIZRMwRCCGEmzPM8z/D+T8bu/ptbXXJFdij5fMt2Wuo+2UgqxVmtttq5WVotLzBgwIABAwYMGDCn0qVqbo69psPqVpWx+1XG5iaavF8wYMCAAQMGDBgwi4DJ6Y6qkxB1HNlcN3a92gbR5P2CAQMGDBgwYMCAWSxMlrU+UY5yu2l9okfV4bAxUVbf7TJnAwMGDBgwYMCAAbMLMHeqbGR82Zy+VR1Ht81nVca6R+UdTLaU24Ruzd3qM/e4yjnAgAEDBgwYMGDA7AJMd1l/3NRdVGcj3eX/2WEhCmDGxnM7yqygu8XIPjJj8iN/MGDAgAEDBgwYMAuDGb8q0RGlLCHLv1t9qDKWn3vdNHVuEI6HPaxO9Jo3GDBgwIABAwYMmIXBdC9ShGgMk+XnkXUeuGcsP/e1+lhNnZsL/G5Vs3OAAQMGDBgwYMCAWSxMR3SzOmraG5atdy9wZKzb+vg16qyqe2FltbnAgAEDBgwYMGDALAxmTJSuN3WA76rnVca6GTnemGN1WoEBAwYMGDBgwIBZGMxUomy4+xO899V4LAg5Xnc2MGDAgAEDBgwYMGA218Wq+2K1LDqvY9xZu8zN8fICdM6btYABAwYMGDBgwIABMzfH0+pGU5afze2tXebmeAfVz+p8BQYMGDBgwIABAwbMPBzZ+oWmfJrln1273FhkbHzee9WWbw7AgAEDBgwYMGDALAKm43hcdctKgblcPamOhuXnXlY5Xs6bsW4FGyQCAwYMGDBgwIABswiYMceZKgvMo+h8mrHLTdn676rj+FEFoTtHd8MwOxEYMGDAgAEDBgyYRcBM5UhXqiymW3R3c9ARhWO/OmjqfjVZy+xEYMCAAQMGDBgwYBYG073OnCV0RFNhMhaOa9WfKmOB6XjHMN1tQmaAAQMGDBgwYMCA2VWY7vXjz1U4croAzgPztwIDBgwYMGDAgAEDZhswh035NBw59Dww3RgYMGDAgAEDBgwYMJuD6f4tXT7NUqfCdBvZLkxXdgQGDBgwYMCAAQNmt2DGj8WzwAfV/w7T/aq7mxwwYMCAAQMGDBgwuwqTOo7uTwTngflSzQ3TdaJvAwEDBgwYMGDAgAED5gSvgbyo5oHZ4Pc+gwEDBgwYMGDAgAEzhOm+5G0qTGaAAQMGDBgwYMCAAXNaMOcnls3tNwWm+zRzp54NDBgwYMCAAQMGDJh5YNL36k1TLuGvVq+qnKMbS5n7tulT9asCAwYMGDBgwIABA2ZumKuztLnjgQEDBgwYMGDAgNl5mH/4/ltKA6vBNAAAAABJRU5ErkJggg==";

  $fmt='%1$s:<img src="rotate.php?angle=%2$d&orig=%3$s" alt="%1$s" /><br/>' . "\n";

  printf( $fmt, "Original",  0, urlencode($image) );
  printf( $fmt, "Rotated",  90, urlencode($image) );

?>

そして、rotate.php :

<?php

  $angle = (int)$_GET['angle'];      // Force this to be an int
  $orig = $_GET['orig'];  // We could do input validation on this, but meh.

  $ih = imagecreatefromstring(base64_decode($orig));

  $rotated = imagerotate($ih, $angle, 0);

  header("Content-Type: image/png");
  imagepng($rotated);

?>

HTML 生成と PNG 生成を 2 つの個別の PHP スクリプトに分離することにより、ディスク上の一時ファイルの生成を回避するという元の要求が実現されます。

于 2012-10-16T02:11:34.950 に答える
0

このようなものかもしれません。画像を出力するためだけにファイルを作成する

<?php // image.php

header('Content-type: image/png');

// get $image string from API or wherever you've stored it

$res = imagecreatefromstring($image);

if ($res === false) exit;

$rotated = imagerotate($res, 90, 0);
imagedestroy($res);


imagepng($rotated);
imagedestroy($rotated);
exit;

次に、それを<img>タグソースとして含めます。

<img src="image.php">

例はこちら - http://codepad.viper-7.com/nMIu7J

于 2012-10-16T00:24:30.043 に答える