Created
June 10, 2009 14:05
-
-
Save klederson/127230 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
//Lendo o conteúdo oriundo do Banco de Dados | |
$data = $orderProduct->content; | |
//Criando uma imagem baseada em uma string | |
$dataImage = imagecreatefromstring($data); | |
//Se ocorreu tudo bem executar o processo de exibição da imagem | |
//Lembrar sempre que isso deve ser uma chamada a parte por ex: http://localhost/minhaImagem.php ou http://localhost/os/verImagem/1 | |
if ($dataImage !== false) { | |
//Definindo o tamanho da imagem | |
$size = strlen($orderProduct->content); | |
//Configurando o header para exibir uma imagem do tipo correto | |
header("Content-length: $size"); | |
header('Content-Type: '. $tipoDeImagem); //Tipo de imagem vinda do banco ( devera ser armazenado o mime type ) | |
//Exibir a imagem na tela | |
imagejpeg($dataImage); | |
} else { | |
echo 'An error occurred.'; | |
} | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment