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


Groups > comp.lang.php > #6465 > unrolled thread

Reading & Displaying Latex Rendered images

Started byFastian <abdulbasit.fast@gmail.com>
First post2012-06-29 03:24 -0700
Last post2012-07-02 06:46 -0400
Articles 18 — 4 participants

Back to article view | Back to comp.lang.php


Contents

  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

#6465 — Reading & Displaying Latex Rendered images

FromFastian <abdulbasit.fast@gmail.com>
Date2012-06-29 03:24 -0700
SubjectReading & Displaying Latex Rendered images
Message-ID<96a37fe0-2b28-431a-903e-edd416e44169@googlegroups.com>
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!

[toc] | [next] | [standalone]


#6466

FromThe Natural Philosopher <tnp@invalid.invalid>
Date2012-06-29 12:02 +0100
Message-ID<jsk1vf$r1g$1@news.albasani.net>
In reply to#6465
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!


Can you confirm that:

1/. You are not using or wanting to use PHP to actually render latex 
into a bitmap, but that that is being done by this external site and..

2/. the problem therefore is to capture this image and store it and 
process it into  database and

3/. subsequently display it afterwards?

I can answer those questions, but if they are not the right questions.. 
I wont bother.



-- 
To people who know nothing, anything is possible.
To people who know too much, it is a sad fact
that they know how little is really possible -
and how hard it is to achieve it.

[toc] | [prev] | [next] | [standalone]


#6467

FromFastian <abdulbasit.fast@gmail.com>
Date2012-06-29 04:34 -0700
Message-ID<96a62f03-4791-4d9c-a589-4876b09433de@googlegroups.com>
In reply to#6466
On Friday, June 29, 2012 4:02:07 PM UTC+5, The Natural Philosopher wrote:
> 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!
> 
> 
> Can you confirm that:
> 
> 1/. You are not using or wanting to use PHP to actually render latex 
> into a bitmap, but that that is being done by this external site and..

 Yes. The rendering is being done by mathtex which is actually a cgi script. The mathtex can be installed on the server and is also available as a web-service on  http://www.forkosh.com.
> 
> 2/. the problem therefore is to capture this image and store it and 
> process it into  database and
 Yes.
> 
> 3/. subsequently display it afterwards?
> Yes.
> I can answer those questions, but if they are not the right questions.. 
> I wont bother.
> 
> 
> 
> -- 
> To people who know nothing, anything is possible.
> To people who know too much, it is a sad fact
> that they know how little is really possible -
> and how hard it is to achieve it.

[toc] | [prev] | [next] | [standalone]


#6468

FromThe Natural Philosopher <tnp@invalid.invalid>
Date2012-06-29 13:09 +0100
Message-ID<jsk5tf$3g6$2@news.albasani.net>
In reply to#6467
Fastian wrote:
> On Friday, June 29, 2012 4:02:07 PM UTC+5, The Natural Philosopher wrote:
>> 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!
>>
>> Can you confirm that:
>>
>> 1/. You are not using or wanting to use PHP to actually render latex 
>> into a bitmap, but that that is being done by this external site and..
> 
>  Yes. The rendering is being done by mathtex which is actually a cgi script. The mathtex can be installed on the server and is also available as a web-service on  http://www.forkosh.com.
>> 2/. the problem therefore is to capture this image and store it and 
>> process it into  database and
>  Yes.

well, use CURL to get the data, strip the headers from it and then store 
the image in a database..


>> 3/. subsequently display it afterwards?
>> Yes.

That is simply a matter of building a php script that will output 
minimal headers and the actual image data.

I've got code that does that and resizes too, if needs be.


-- 
To people who know nothing, anything is possible.
To people who know too much, it is a sad fact
that they know how little is really possible -
and how hard it is to achieve it.

[toc] | [prev] | [next] | [standalone]


#6472

FromJerry Stuckle <jstucklex@attglobal.net>
Date2012-06-29 09:20 -0400
Message-ID<jska3g$c5b$1@dont-email.me>
In reply to#6465
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
==================

[toc] | [prev] | [next] | [standalone]


#6481

FromFastian <abdulbasit.fast@gmail.com>
Date2012-07-01 23:42 -0700
Message-ID<81700f04-5a66-44a5-b115-0e6c415370e9@googlegroups.com>
In reply to#6472
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? 

[toc] | [prev] | [next] | [standalone]


#6482

From"Álvaro G. Vicario" <alvaro.NOSPAMTHANX@demogracia.com.invalid>
Date2012-07-02 09:34 +0200
Message-ID<jsriu8$890$1@dont-email.me>
In reply to#6481
El 02/07/2012 8:42, Fastian escribió/wrote:
> <?
> $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 imagegif() function [1] expects «An image resource, returned by one 
of the image creation functions, such as imagecreatetruecolor()». I 
don't know how you reached the conclusion that you need such functions, 
given that are not even using PHP to generate the image :-?

Probably, readfile() is all you need.


[1] http://php.net/imagegif
[1] http://php.net/readfile

> But the image is NOT displayed on the browser.Where I am wrong?

Browsers are basically designed to ignore invalid stuff and your 
"testing.php" script is possibly printing an error message rather than a 
valid GIF file. I suggest you remove the last layer and debug 
"testing.php" directly.




-- 
-- http://alvaro.es - Álvaro G. Vicario - Burgos, Spain
-- Mi sitio sobre programación web: http://borrame.com
-- Mi web de humor satinado: http://www.demogracia.com
--

[toc] | [prev] | [next] | [standalone]


#6485

FromFastian <abdulbasit.fast@gmail.com>
Date2012-07-02 01:10 -0700
Message-ID<a9ceb500-26e5-4f7b-8155-9396c5942ec1@googlegroups.com>
In reply to#6482
On Monday, July 2, 2012 12:34:33 PM UTC+5, Álvaro G. Vicario wrote:
> El 02/07/2012 8:42, Fastian escribió/wrote:
> > <?
> > $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 imagegif() function [1] expects «An image resource, returned by one 
> of the image creation functions, such as imagecreatetruecolor()». I 
> don't know how you reached the conclusion that you need such functions, 
> given that are not even using PHP to generate the image :-?
> 
> Probably, readfile() is all you need.
> 
> 
> [1] http://php.net/imagegif
> [1] http://php.net/readfile
> 
> > But the image is NOT displayed on the browser.Where I am wrong?
> 
> Browsers are basically designed to ignore invalid stuff and your 
> "testing.php" script is possibly printing an error message rather than a 
> valid GIF file. I suggest you remove the last layer and debug 
> "testing.php" directly.
> 
> 
> 
> 
> -- 
> -- http://alvaro.es - Álvaro G. Vicario - Burgos, Spain
> -- Mi sitio sobre programación web: http://borrame.com
> -- Mi web de humor satinado: http://www.demogracia.com
> --



On Monday, July 2, 2012 12:34:33 PM UTC+5, Álvaro G. Vicario wrote:
> El 02/07/2012 8:42, Fastian escribió/wrote:
> > <?
> > $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 imagegif() function [1] expects «An image resource, returned by one 
> of the image creation functions, such as imagecreatetruecolor()». I 
> don't know how you reached the conclusion that you need such functions, 
> given that are not even using PHP to generate the image :-?
> 
> Probably, readfile() is all you need.
> 
> 
> [1] http://php.net/imagegif
> [1] http://php.net/readfile
> 
> > But the image is NOT displayed on the browser.Where I am wrong?
> 
> Browsers are basically designed to ignore invalid stuff and your 
> "testing.php" script is possibly printing an error message rather than a 
> valid GIF file. I suggest you remove the last layer and debug 
> "testing.php" directly.
> 
> 
> 
> 
> -- 
> -- http://alvaro.es - Álvaro G. Vicario - Burgos, Spain
> -- Mi sitio sobre programación web: http://borrame.com
> -- Mi web de humor satinado: http://www.demogracia.com
> --



On Monday, July 2, 2012 12:34:33 PM UTC+5, Álvaro G. Vicario wrote:
> El 02/07/2012 8:42, Fastian escribió/wrote:
> > <?
> > $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 imagegif() function [1] expects «An image resource, returned by one 
> of the image creation functions, such as imagecreatetruecolor()». I 
> don't know how you reached the conclusion that you need such functions, 
> given that are not even using PHP to generate the image :-?
> 
> Probably, readfile() is all you need.
> 
> 
> [1] http://php.net/imagegif
> [1] http://php.net/readfile
> 
> > But the image is NOT displayed on the browser.Where I am wrong?
> 
> Browsers are basically designed to ignore invalid stuff and your 
> "testing.php" script is possibly printing an error message rather than a 
> valid GIF file. I suggest you remove the last layer and debug 
> "testing.php" directly.
> 
> 
> 
> 
> -- 
> -- http://alvaro.es - Álvaro G. Vicario - Burgos, Spain
> -- Mi sitio sobre programación web: http://borrame.com
> -- Mi web de humor satinado: http://www.demogracia.com
> --



On Monday, July 2, 2012 12:34:33 PM UTC+5, Álvaro G. Vicario wrote:
> El 02/07/2012 8:42, Fastian escribió/wrote:
> > <?
> > $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 imagegif() function [1] expects «An image resource, returned by one 
> of the image creation functions, such as imagecreatetruecolor()». I 
> don't know how you reached the conclusion that you need such functions, 
> given that are not even using PHP to generate the image :-?
> 
> Probably, readfile() is all you need.
> 
> 
> [1] http://php.net/imagegif
> [1] http://php.net/readfile
> 
> > But the image is NOT displayed on the browser.Where I am wrong?
> 
> Browsers are basically designed to ignore invalid stuff and your 
> "testing.php" script is possibly printing an error message rather than a 
> valid GIF file. I suggest you remove the last layer and debug 
> "testing.php" directly.
> 
> 
> 
> 
> -- 
> -- http://alvaro.es - Álvaro G. Vicario - Burgos, Spain
> -- Mi sitio sobre programación web: http://borrame.com
> -- Mi web de humor satinado: http://www.demogracia.com
> --

I think readfile is useful when you know the name of the image so that you can access it with its name. In my case the I am trying to use file_get_contents function only because I am not aware of the name of the image file that will result from rendering. Have a look here: http://www.forkosh.com/mathtex.html OR view source of http://www.forkosh.com/mathtexpreview.html.
I thought that without knowing the name of the image you can still get the image output using file_get_contents function. Tell me if it possible to use readfile or with anyother function.

[toc] | [prev] | [next] | [standalone]


#6489

FromJerry Stuckle <jstucklex@attglobal.net>
Date2012-07-02 06:53 -0400
Message-ID<jsruit$302$1@dont-email.me>
In reply to#6481
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
==================

[toc] | [prev] | [next] | [standalone]


#6490

FromFastian <abdulbasit.fast@gmail.com>
Date2012-07-02 04:24 -0700
Message-ID<51518fe7-f075-415b-94bc-e397008449f6@googlegroups.com>
In reply to#6489
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.
> 
> -- 
> ==================
> Remove the "x" from my email address
> Jerry Stuckle
> JDS Computer Training Corp.
> jstucklex@attglobal.net
> ==================

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?

[toc] | [prev] | [next] | [standalone]


#6492

FromJerry Stuckle <jstucklex@attglobal.net>
Date2012-07-02 09:35 -0400
Message-ID<jss82e$nvt$1@dont-email.me>
In reply to#6490
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.

-- 
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex@attglobal.net
==================

[toc] | [prev] | [next] | [standalone]


#6494

FromJerry Stuckle <jstucklex@attglobal.net>
Date2012-07-02 09:41 -0400
Message-ID<jss8dh$nvt$3@dont-email.me>
In reply to#6492
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
==================

[toc] | [prev] | [next] | [standalone]


#6497

FromFastian <abdulbasit.fast@gmail.com>
Date2012-07-02 10:00 -0700
Message-ID<f914b302-88eb-457f-8e95-476a023423e7@googlegroups.com>
In reply to#6494
On Monday, July 2, 2012 6:41:03 PM UTC+5, Jerry Stuckle wrote:
> 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
> ==================

:)
Actually the application I am going to develop as a web app was developed by someone else as a desktop app. That application has several issues and most of the issues are on the side of data entry. Moreover due to some other reasons  now there is a need to develop a web based app for Question entry. The test generation which is the other part of the app is very much stable. The previous developer has kept the whole question as one image in the DB just for the sake of view while pick and choose of the question during the process of test generation. He was of the view that just for the sake of preview why should he pull the raw latex code and render it every time and then display. He thought it is better to keep the whole question as one image because it is just for preview purpose. Hope you got the logic now.

I know that there are other alternatives to solve this very scenario but as I said that test generation part of the app is stable and secondly I am short of time therefore I decided to restrict myself with the old design so that nothing else be disturbed. And yes the latex text is stored in separate fields and eventually used for  the generation of test.

[toc] | [prev] | [next] | [standalone]


#6498

FromJerry Stuckle <jstucklex@attglobal.net>
Date2012-07-02 16:54 -0400
Message-ID<jst1pt$uga$1@dont-email.me>
In reply to#6497
On 7/2/2012 1:00 PM, Fastian wrote:
> On Monday, July 2, 2012 6:41:03 PM UTC+5, Jerry Stuckle wrote:
>> 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.
>>
>
> :)
> Actually the application I am going to develop as a web app was developed
 > by someone else as a desktop app. That application has several issues
 > and most of the issues are on the side of data entry. Moreover due to
 > some  other reasons  now there is a need to develop a web based app
 > for Question entry. The test generation which is the other part of
 > the app is very much stable. The previous developer has kept the whole
 > question as one image in the DB just for the sake of view while pick
 > and choose of the question during the process of test generation. He
 > was of the view that just for the sake of preview why should he pull
 > the raw latex code and render it every time and then display. He
 > thought it is better to keep the whole question as one image because
 > it is just for preview purpose. Hope you got the logic now.
>
> I know that there are other alternatives to solve this very scenario
 > but as I said that test generation part of the app is stable and
 > secondly I am short of time therefore I decided to restrict myself
 > with the old design so that nothing else be disturbed. And yes
 > the latex text is stored in separate fields and eventually used
 > for  the generation of test.
>

Yes, developers are not necessarily smart.  However, it sounds like you 
aren't going to be able to use much of the previous code anyway, and 
doing it right shouldn't take longer than trying to muscle what you have 
into a bad design.  It will also be more flexible and maintainable.

-- 
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex@attglobal.net
==================

[toc] | [prev] | [next] | [standalone]


#6484

FromFastian <abdulbasit.fast@gmail.com>
Date2012-07-02 00:28 -0700
Message-ID<32400a37-6aa0-4429-bb2d-e6306dce1f12@googlegroups.com>
In reply to#6465
On Friday, June 29, 2012 3:24:13 PM UTC+5, 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!

________________________________________________________________________________I am writing this post to explain my project so that you may give me more relevant suggestions:

I have to develop an application that will help us develop a database of questions. These questions will be used for developing tests/ exams. Latex is required to enter scientific and mathematical text. As Latex is not WYSIWYG therefore the data entry person will like to see the output for the latex text. For that my latex code will be rendered and then I will be able to get the 
desired output. As my application is web based therefore I think I can use MathTeX. (suggest me anyother better option if you know especially if available in Windows platform) So first thing to deal with is to get the rendered images and display them in desired format. The required format is a question with multiple options (MCQ). In short I need a preview of my question and answer options. 
The second issue is that I need to get ONE image which should have question with its options and both should be transformed/ merged in such a way that ultimately one image is obtained from the input(question and options). The requirement of my application is that this complete question should then be saved in the database.

I can get the input for question and options in textarea. Now I need to show the preview as well as transform  them into one image so as to store in the database. 

Guide me which PHP functions will help me in reading and displaying the images as well as merging the images etc. Any suggestion that can help me in this project will highly be appreciated. Thanks!

[toc] | [prev] | [next] | [standalone]


#6486

From"Álvaro G. Vicario" <alvaro.NOSPAMTHANX@demogracia.com.invalid>
Date2012-07-02 10:44 +0200
Message-ID<jsrn1a$s0u$1@dont-email.me>
In reply to#6484
El 02/07/2012 9:28, Fastian escribió/wrote:
> ________________________________________________________________________________I
> am writing this post to explain my project so that you may give me
> more relevant suggestions:
>
> I have to develop an application that will help us develop a database
> of questions. These questions will be used for developing tests/
> exams. Latex is required to enter scientific and mathematical text.
[...]
> Guide me which PHP functions will help me in reading and displaying
> the images as well as merging the images etc. Any suggestion that can
> help me in this project will highly be appreciated. Thanks!

Alright, I think I finally got what your problem is. Your picture's URL 
is by no means unknown. The URL is always this:

http://www.forkosh.com/mathtex.cgi?formdata=blah

... where formadata is a GET parameter that contains the raw LaTeX code. 
You can compose the actual URL with rawurlencode(). E.g.:

$latex = '\Large f(x)=\int_{-\infty}^x e^{-t^2}dt';
$url = 'http://www.forkosh.com/mathtex.cgi?formdata=' .
	rawurlencode($latex);

Once you have the URL, you could download it with many PHP functions, 
including the ones you've been evaluating, but you don't really need to. 
You just have to use the <img> tag in an HTML document and the browser 
will download it for you:

<img src="<?php echo htmlspecialchars($url); ?>">


-- 
-- http://alvaro.es - Álvaro G. Vicario - Burgos, Spain
-- Mi sitio sobre programación web: http://borrame.com
-- Mi web de humor satinado: http://www.demogracia.com
--

[toc] | [prev] | [next] | [standalone]


#6487

FromFastian <abdulbasit.fast@gmail.com>
Date2012-07-02 02:54 -0700
Message-ID<d9383913-803d-4d66-a139-882d34911a48@googlegroups.com>
In reply to#6486
On Monday, July 2, 2012 1:44:28 PM UTC+5, Álvaro G. Vicario wrote:
> El 02/07/2012 9:28, Fastian escribió/wrote:
> > ________________________________________________________________________________I
> > am writing this post to explain my project so that you may give me
> > more relevant suggestions:
> >
> > I have to develop an application that will help us develop a database
> > of questions. These questions will be used for developing tests/
> > exams. Latex is required to enter scientific and mathematical text.
> [...]
> > Guide me which PHP functions will help me in reading and displaying
> > the images as well as merging the images etc. Any suggestion that can
> > help me in this project will highly be appreciated. Thanks!
> 
> Alright, I think I finally got what your problem is. Your picture's URL 
> is by no means unknown. The URL is always this:
> 
> http://www.forkosh.com/mathtex.cgi?formdata=blah
> 
> ... where formadata is a GET parameter that contains the raw LaTeX code. 
> You can compose the actual URL with rawurlencode(). E.g.:
> 
> $latex = '\Large f(x)=\int_{-\infty}^x e^{-t^2}dt';
> $url = 'http://www.forkosh.com/mathtex.cgi?formdata=' .
> 	rawurlencode($latex);
> 
> Once you have the URL, you could download it with many PHP functions, 
> including the ones you've been evaluating, but you don't really need to. 
> You just have to use the <img> tag in an HTML document and the browser 
> will download it for you:
> 
> <img src="<?php echo htmlspecialchars($url); ?>">
> 
> 
> -- 
> -- http://alvaro.es - Álvaro G. Vicario - Burgos, Spain
> -- Mi sitio sobre programación web: http://borrame.com
> -- Mi web de humor satinado: http://www.demogracia.com
> --

Done! Thanks for help.
Now I come to the second step of my project that I explained in my second last post in detail that I need to take the question and different options from the user. Then I need to combine/ merge them together in a format of a Multiple Choice Question(MCQ) and display this MCQ on the webpage. As well as I need to store the complete image(MCQ) in the database.
What do you suggest, should I utilize all the input in one go(question + options) and try to bring them in one variable (using some formatting commands/ operators of Latex) and send them for rendering. In this way I hope to get one image for the complete question. (will it be possible and whether Latex help me to format the input to get the desired formatted output)
OR should i take all the inputs as images separately; question separately and all other options separately. Then I merge them to get the desired format of question.
Also mention the appropriate functions or examples if possible. 

[toc] | [prev] | [next] | [standalone]


#6488

FromJerry Stuckle <jstucklex@attglobal.net>
Date2012-07-02 06:46 -0400
Message-ID<jsru74$ne$1@dont-email.me>
In reply to#6487
On 7/2/2012 5:54 AM, Fastian wrote:
> On Monday, July 2, 2012 1:44:28 PM UTC+5, Álvaro G. Vicario wrote:
>> El 02/07/2012 9:28, Fastian escribió/wrote:
>>> ________________________________________________________________________________I
>>> am writing this post to explain my project so that you may give me
>>> more relevant suggestions:
>>>
>>> I have to develop an application that will help us develop a database
>>> of questions. These questions will be used for developing tests/
>>> exams. Latex is required to enter scientific and mathematical text.
>> [...]
>>> Guide me which PHP functions will help me in reading and displaying
>>> the images as well as merging the images etc. Any suggestion that can
>>> help me in this project will highly be appreciated. Thanks!
>>
>> Alright, I think I finally got what your problem is. Your picture's URL
>> is by no means unknown. The URL is always this:
>>
>> http://www.forkosh.com/mathtex.cgi?formdata=blah
>>
>> ... where formadata is a GET parameter that contains the raw LaTeX code.
>> You can compose the actual URL with rawurlencode(). E.g.:
>>
>> $latex = '\Large f(x)=\int_{-\infty}^x e^{-t^2}dt';
>> $url = 'http://www.forkosh.com/mathtex.cgi?formdata=' .
>> 	rawurlencode($latex);
>>
>> Once you have the URL, you could download it with many PHP functions,
>> including the ones you've been evaluating, but you don't really need to.
>> You just have to use the <img> tag in an HTML document and the browser
>> will download it for you:
>>
>> <img src="<?php echo htmlspecialchars($url); ?>">
>>
>>
>> --
>> -- http://alvaro.es - Álvaro G. Vicario - Burgos, Spain
>> -- Mi sitio sobre programación web: http://borrame.com
>> -- Mi web de humor satinado: http://www.demogracia.com
>> --
>
> Done! Thanks for help.
> Now I come to the second step of my project that I explained in my second last post in detail that I need to take the question and different options from the user. Then I need to combine/ merge them together in a format of a Multiple Choice Question(MCQ) and display this MCQ on the webpage. As well as I need to store the complete image(MCQ) in the database.
> What do you suggest, should I utilize all the input in one go(question + options) and try to bring them in one variable (using some formatting commands/ operators of Latex) and send them for rendering. In this way I hope to get one image for the complete question. (will it be possible and whether Latex help me to format the input to get the desired formatted output)
> OR should i take all the inputs as images separately; question separately and all other options separately. Then I merge them to get the desired format of question.
> Also mention the appropriate functions or examples if possible.
>

I would not put everything in one image.  Rather, have the question, 
followed by a list of radio buttons, one answer per radio button.  If 
the question or result needs to be an image, then make it an image. 
Otherwise, use plain text (images are much bigger than characters for 
the same text).

-- 
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex@attglobal.net
==================

[toc] | [prev] | [standalone]


Back to top | Article view | comp.lang.php


csiph-web