Welcome Guest, Not a member yet? Register   Sign In
Can’t display image in jpg format
#1

[eluser]Wangringring[/eluser]
I've got a problem about display image in CI.
I don't want to use <img> tab to display image.
Does it have any library in CI?
I just want to display an image. I try to use image_lib() but it didn't work too.

Now I'm trying to use simple code to display image.
My code in View is like this

Code:
header("Cache-control: private");
header("Content-Type: image/jpg");
header("Content-Disposition: inline ;filename=arnon.jpg");
$fn=fopen("images/arnon.jpg","r");
fpassthru($fn);

but It displays not an image. It likes many ramdom-text and special characters like this:
Code:
Oฝฎดs]r๒#๗ฝ=?ถฒณด#๏ฐP% ๋ต˜# ชฒ?๓โมมฌ ‰#JFIF###HHํ Adobe_CM#๎#Adobed€#„ ### # # ### ########## # # # ################

Could anyone suggest me please?
#2

[eluser]deviant[/eluser]
Try replacing the content type with image/jpeg
#3

[eluser]Wangringring[/eluser]
When I use this code Out of the CI.(Normal PHP without any framework) It's work properly !!
Code:
header("Cache-control: private");
header("Content-Type: image/jpg");
header("Content-Disposition: inline ;filename=arnon.jpg");
$fn=fopen("images/arnon.jpg","r");
fpassthru($fn);

I don't know why. It seems "fpassthru" didn't work in my CI.
When I use this code without CI, it returns My photo correctly.
But in CI returns Blank page and No any error occured.
#4

[eluser]Wangringring[/eluser]
I'd like to close this topic. What should I do?
#5

[eluser]arsenalist[/eluser]
Exact same issue. Any solutions?
#6

[eluser]InsiteFX[/eluser]
Edit Post Topic Title add [SOLVED]

InsiteFX
#7

[eluser]arsenalist[/eluser]
Did this thread get spammed?

With every passing day I regret leaving Zend for this.
#8

[eluser]arsenalist[/eluser]
For any poor guy still stuck using CI, here's the solution:

http://groups.google.com/group/google-ch...0330?pli=1




Theme © iAndrew 2016 - Forum software by © MyBB