Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.php > #6489

Re: Reading & Displaying Latex Rendered images

From Jerry Stuckle <jstucklex@attglobal.net>
Newsgroups comp.lang.php
Subject Re: Reading & Displaying Latex Rendered images
Date 2012-07-02 06:53 -0400
Organization A noiseless patient Spider
Message-ID <jsruit$302$1@dont-email.me> (permalink)
References <96a37fe0-2b28-431a-903e-edd416e44169@googlegroups.com> <jska3g$c5b$1@dont-email.me> <81700f04-5a66-44a5-b115-0e6c415370e9@googlegroups.com>

Show all headers | View raw


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@attglobal.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@attglobal.net
==================

Back to comp.lang.php | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

Reading & Displaying Latex Rendered images Fastian <abdulbasit.fast@gmail.com> - 2012-06-29 03:24 -0700
  Re: Reading & Displaying Latex Rendered images The Natural Philosopher <tnp@invalid.invalid> - 2012-06-29 12:02 +0100
    Re: Reading & Displaying Latex Rendered images Fastian <abdulbasit.fast@gmail.com> - 2012-06-29 04:34 -0700
      Re: Reading & Displaying Latex Rendered images The Natural Philosopher <tnp@invalid.invalid> - 2012-06-29 13:09 +0100
  Re: Reading & Displaying Latex Rendered images Jerry Stuckle <jstucklex@attglobal.net> - 2012-06-29 09:20 -0400
    Re: Reading & Displaying Latex Rendered images Fastian <abdulbasit.fast@gmail.com> - 2012-07-01 23:42 -0700
      Re: Reading & Displaying Latex Rendered images "Álvaro G. Vicario" <alvaro.NOSPAMTHANX@demogracia.com.invalid> - 2012-07-02 09:34 +0200
        Re: Reading & Displaying Latex Rendered images Fastian <abdulbasit.fast@gmail.com> - 2012-07-02 01:10 -0700
      Re: Reading & Displaying Latex Rendered images Jerry Stuckle <jstucklex@attglobal.net> - 2012-07-02 06:53 -0400
        Re: Reading & Displaying Latex Rendered images Fastian <abdulbasit.fast@gmail.com> - 2012-07-02 04:24 -0700
          Re: Reading & Displaying Latex Rendered images Jerry Stuckle <jstucklex@attglobal.net> - 2012-07-02 09:35 -0400
            Re: Reading & Displaying Latex Rendered images Jerry Stuckle <jstucklex@attglobal.net> - 2012-07-02 09:41 -0400
              Re: Reading & Displaying Latex Rendered images Fastian <abdulbasit.fast@gmail.com> - 2012-07-02 10:00 -0700
                Re: Reading & Displaying Latex Rendered images Jerry Stuckle <jstucklex@attglobal.net> - 2012-07-02 16:54 -0400
  Re: Reading & Displaying Latex Rendered images Fastian <abdulbasit.fast@gmail.com> - 2012-07-02 00:28 -0700
    Re: Reading & Displaying Latex Rendered images "Álvaro G. Vicario" <alvaro.NOSPAMTHANX@demogracia.com.invalid> - 2012-07-02 10:44 +0200
      Re: Reading & Displaying Latex Rendered images Fastian <abdulbasit.fast@gmail.com> - 2012-07-02 02:54 -0700
        Re: Reading & Displaying Latex Rendered images Jerry Stuckle <jstucklex@attglobal.net> - 2012-07-02 06:46 -0400

csiph-web