About 215,000 results
- Viewed 158k times150answered Dec 5, 2009 at 10:46$file = '../image.jpg';$type = 'image/jpeg';header('Content-Type:'.$type);header('Content-Length: ' . filesize($file));readfile($file);Content Under CC-BY-SA license
Output an Image in PHP - Stack Overflow
WEBApr 13, 2015 · $file = '../image.jpg'; $type = 'image/jpeg'; header('Content-Type:'.$type); header('Content-Length: ' . filesize($file)); $img = file_get_contents($file); echo $img; This is works for me! I have test it on code igniter. if i use readfile, the image won't display.
PHP: readfile - Manual
WEBFilesystem Functions. Change language: readfile. (PHP 4, PHP 5, PHP 7, PHP 8) readfile — Outputs a file. Description ¶. readfile ( string $filename, bool $use_include_path = false, ? resource $context = null ): int | false. Reads a file and writes it to the output buffer. Parameters ¶. filename. …
- People also ask
Return the contents of an image in php file? - Stack Overflow
Output an Image in PHP - W3docs
PHP readfile() Function - W3Schools
PHP: file_get_contents - Manual
readfile() - W3docs
PHPで画像を表示する3つの方法を現役エンジニアが解説【初心 ...