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


Groups > comp.lang.php > #6494

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 09:41 -0400
Organization A noiseless patient Spider
Message-ID <jss8dh$nvt$3@dont-email.me> (permalink)
References (1 earlier) <jska3g$c5b$1@dont-email.me> <81700f04-5a66-44a5-b115-0e6c415370e9@googlegroups.com> <jsruit$302$1@dont-email.me> <51518fe7-f075-415b-94bc-e397008449f6@googlegroups.com> <jss82e$nvt$1@dont-email.me>

Show all headers | View raw


On 7/2/2012 9:35 AM, Jerry Stuckle wrote:
> On 7/2/2012 7:24 AM, Fastian wrote:
>> On Monday, July 2, 2012 3:53:13 PM UTC+5, Jerry Stuckle wrote:
>>> 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.
>>>
>>
>> Ok. I got your point. But as it is the requirement of my project to store
>  > the complete question as an image in addition to storing latex text.
>  > Therefore I need to process the images (both question + options) and
>  > have to make them transform into a complete question.
>> Therefore I thought that file_get_contents() may be helpful in this
>  > case as it then  enable me to use imagecopy () and other functions.
>  > what you say?
>>
>
> Why would a customer care whether the question is stored as a single
> image or separate entries?  In over 40 years of programming I've never
> had such a requirement in a project.  I admit I've had some stupid
> requirements in the past - but I've always been able to convince the
> customer why it should not be done that way.  All part of being a
> successful consultant.
>
> I would go back to the customer and explaining why it is a bad idea and
> convince the customer to change the requirement.
>

To clarify: by stupid requirement I mean having to put the question and 
all the answers together into one image.

-- 
==================
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