FUDforum
Fast Uncompromising Discussions. FUDforum will get your users talking.

Home » Imported messages » comp.lang.php » Reading & Displaying Latex Rendered images
Show: Today's Messages :: Polls :: Message Navigator
Return to the default flat view Create a new topic Submit Reply
Re: Reading & Displaying Latex Rendered images [message #178564 is a reply to message #178556] Mon, 02 July 2012 10:53 Go to previous messageGo to previous message
Jerry Stuckle is currently offline  Jerry Stuckle
Messages: 2598
Registered: September 2010
Karma:
Senior Member
On 7/2/2012 2:42 AM, Fastian wrote:
> On Friday, June 29, 2012 6:20:45 PM UTC+5, Jerry Stuckle wrote:
>> On 6/29/2012 6:24 AM, Fastian wrote:
>>> I am developing an application for the university. One basic
>>> module/ section of this application is Data Entry. The data
>>> is entered using Latex (Latex is a type setting language
>>> and is not a WYSIWYG language). The tex software converts the
>>> latex code into the required image. For better understanding
>>> visit the following link:
>>> http://www.forkosh.com/mathtexpreview.html
>>>
>>> You can see that on entering Latex code, the desired output
>>> is obtained which is actually an image. This image is produced
>>> by the Tex software and is being fetched and displayed on this
>>> page. Another way to get that image is as follows:
>>> <img src="http://www.forkosh.com/mathtex.cgi?$c=a+b$" alt="" border=0 align=middle>
>>>
>>> My issue is that I want to get the image generated due to the
>>> rendering of the Latex code and then display it after re-sizing
>>> and then want store it in the MYSQL database.
>>>
>>> As I dont know the name of the image produced due to rendering
>>> that's why I can not pick the image with its name. Therefore I
>>> tried using function "file_get_contents". Though it returns
>>> some garbage values on echo but what next?
>>>
>>> I need to know that how can I proceed further or suggest some
>>> better way to deal with these issues especially while dealing
>>> with LateX rendering. Thanks!
>>>
>>
>> You don't show the code you're trying to use, so it's all a guess as to
>> what's wrong. There are many possibilities.
>>
>> If you're going to display an image, you need to send it as an image.
>> My guess is that you're displaying it as text.
>>
>> Web pages are sent with a content-type of text/html. But if the web
>> page contains an image, the browser makes a second request to the server
>> for the image. The image will be sent with a content-type of
>> image/jpeg, image/gif, etc. So the first thing you need to do is ensure
>> you are sending the correct header when displaying it (in this case it
>> should be image/gif) (obviously this needs to be done in a separate
>> script from the rest of the page and accessed with an <img= tag).
>>
>> So what you could do is in your test page, put something like:
>>
>> <img src="testimg.php" ....>
>>
>> Then in your testimg.php file, fetch the file with file_get_contents
>> then display it with the correct headers, i.e.
>>
>> header ('Content-type: image/gif');
>>
>> Of course, if this is the only thing on your test page (it's sending
>> NOTHING else), you can skip the <img= ...> tag and just send the correct
>> content-type at the start of your script.
>>
>> --
>> ==================
>> Remove the "x" from my email address
>> Jerry Stuckle
>> JDS Computer Training Corp.
>> jstucklex(at)attglobal(dot)net
>> ==================
>
> Pls have a look on the code:
> As you suggested my testing.php file code is as follows:
>
> <?
> $image = file_get_contents('users.gif');
>
> header('Content-Type: image/gif');
>
> //imagegif($image); // I also tried to display image with imagegif but it also didnt work.
>
> ?>
> The code of getimage.php file is as follows:
> <html>
> <img src="testing.php">
> </html>
>
> But the image is NOT displayed on the browser.Where I am wrong?
> Both php files and image (users.gif) is present in the same directory.
> I have also noticed that <img src= ""> do not work on the page where you have used header('Content-Type: image/gif'); ......... why?
>

Where are you outputting the image? file_get_contents() does not output
anything.

And no, <img src=..."> is an html command, and valid in pages with
content-type of text/html.

I think your first problem is not understanding how html works. A
response has one content-type. A typical web page will have a
content-type of text/html, and will contain html code. <img src=...> is
an html command.

Tags like <img src=...> (and many others) will cause an additional
request to be made to the server. If the content-type of the response
is image/gif, then the browser will only process it as an image. If it
is not a valid image, the browser will ignore it.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex(at)attglobal(dot)net
==================
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Dreamweaver > can this be done?
Next Topic: Simulating a Form Method=Post submission in PHP
Goto Forum:
  

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ]

Current Time: Tue Nov 26 16:50:12 GMT 2024

Total time taken to generate the page: 0.06488 seconds