2

I just created a page to show an image using livecode. I created an the image path first, with this code:

put "localhost/windy.png" into iconPath

And then, show the image with this code:

put url("binfile:" & iconPath)

But, gives blank page..

Need your help..

Lupita Noyra
  • 221
  • 2
  • 3
  • 12
  • Maybe you should try the relative image path like "/var/www/..." instead of the external http path. Might at least give you a hint if it is looking for the image at the right place. Also, I am not sure if you should use specialFolderPath because this usually is for some default path variables. Did you try without it and just with `url`? – Tate83 Jun 04 '14 at 06:40
  • Hi, I've tried using "var/www/..." but still same, give a blank page. By the way, I changed my code to show binary file. any idea? – Lupita Noyra Jun 04 '14 at 06:52
  • And you still get the same error messages? This looks ok to me.. do you know this lesson here: http://lessons.runrev.com/m/15262/l/156710-how-do-i-use-livecode-graphics-features-server-side – Tate83 Jun 04 '14 at 06:56
  • still same, hmm.. what's the problem? – Lupita Noyra Jun 04 '14 at 07:27

1 Answers1

3

here's a working example (url = http://splash21.on-rev.com/test.lc)

Contents of the .lc file as follows ...

<?lc
put header("Content-type:image/png")
put URL("binfile:img/robot.png")

the image is in the 'img' folder relative to the .lc script

splash21
  • 799
  • 4
  • 10
  • what is put header for? I've tried your advice, and it shows ‰PNG IHDRPPŽò­tEXtSoftwareAdobe ImageReadyqÉe – Lupita Noyra Jun 04 '14 at 09:11
  • the header tells the browser that you are specifically sending png binary data. The code above is the exact script in the test file. You should make sure the header appears before any other code that sends output. Also make sure that there are no spaces, blanks lines, etc. above the opening ' – splash21 Jun 04 '14 at 11:10
  • it works.. I created new file and using the code above and it works. And I copy and paste the code from previous file, but it shows ‰PNG IHDRPPŽò­tEXt.. so I thought there is something wrong with previous file. Thanks, sir.. :) – Lupita Noyra Jun 05 '14 at 04:39
  • by the way, it shows The image can't be display because it contains error when the result is not showing the image. How it can happen? – Lupita Noyra Jun 05 '14 at 06:44