Re: Reading & Displaying Latex Rendered images [message #178556 is a reply to message #178547] |
Mon, 02 July 2012 06:42 |
Fastian
Messages: 20 Registered: June 2012
Karma:
|
Junior Member |
|
|
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?
|
|
|