1

Can anyone please let me know why, when I am trying to access the image URL through the browser, it shows bunch of junk characters with a content type of text/plain.

eg: https://www.domainname.com/client/image-name.jpg shows as like below

    �3�!1AQa"q2‘¡±B#$RÁb34r‚ÑC%’Sðáñcs5¢²ƒ
    &D“TdE£t6ÒUâeò³„ÃÓuãóF'”¤…´•ÄÔäô¥µÅÕåõVfv†–¦¶ÆÖæö
7GWgw‡—§·Ç×ç÷�5�!1AQaq"2‘¡±B#ÁRÑð3$bár‚’CScs4ñ%¢²
ƒ&5ÂÒD“T£dEU6teâò³„ÃÓuãóF”¤…´•ÄÔäô¥µÅÕåõVfv†–¦
¶ÆÖæö'7GWgw‡—§·ÇÿÚ���?�Þé½}ØŸZ:Ãú¦kÛO¨Ë\Æ–Ù]u6šFï~ÍþÚYï
]/MúÅѺ§¨0òCÝKwØ×‡Vàßô›nm£þZäú&o×~¨Üº›{)uö1–
ÍßêW^òÃívÖ=ÿ�Idýd­

Please provide advice about what I have missed in my code.

Brad Werth
  • 17,411
  • 10
  • 63
  • 88
Prabhu M
  • 2,852
  • 8
  • 37
  • 54
  • 2
    Have you set the content type for the image? If it shows it as text/plain, you probably haven't specified what content type it is, or have specified it wrong. You did not tell are you site admin or what you mean by "my code". – eis Sep 06 '12 at 06:23
  • 1
    Do you have any funny htaccess rewrite on your server? – jtheman Sep 06 '12 at 06:24
  • As the problem is probably related to server settings, you should describe this server. – Denys Séguret Sep 06 '12 at 06:26

1 Answers1

2

You probably did not send the proper header while rendering the image to the browser:

<?php
header('Content-Type: image/jpeg');
Lucas Green
  • 3,951
  • 22
  • 27