Re: [GD-DEVEL] Premature end of JPEG file

[email protected] (Franky Braem)
Newsgroups php.gd.devel
Message-ID <[email protected]>
Pierre wrote:
> Hi Franky,
>
> On 10/16/07, Franky Braem <[email protected]> wrote:
>   
>> Hi,
>>
>> I'm porting GD to javascript in my wxJavaScript program. Everything
>> works fine, except for loading jpeg images. When I load it with
>> gdImageCreateFromJpeg, I get the following error:
>>
>> 21:54:41: wxJS: Running Scriptfile
>> c:\development\wxjs\wxJS2\samples\gd\load.js
>> Premature end of JPEG file
>> gd-jpeg: JPEG library reports unrecoverable error: Invalid JPEG file
>> structure:
>> missing SOS marker
>> 21:54:44: Error: wxJS: c:\development\wxjs\wxJS2\samples\gd\load.js(1) :
>> Class ImageJPEG can't be constructed
>> 21:54:44: Error: Evaluating script failed
>>     
>
> The only possible error I can think about is the mode you use to read
> the file. Do you use the binary mode with fopen?
>
>   
Yes that was the problem. I forgot to use "b" when opening the file.
>> I can open the Jpg-file with IrfanView without any problem. The image is
>> created with gdImageJpeg.
>>     
>
> That's expected, gd creates valid jpeg :)
>   
I didn't forgot to add the "b" when writing the file

Can you add a link to http://www.wxjavascript.net on your binding page?

Franky.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.