CGI, stdin, image handling
Mark Smith
mark at maseurope.net
Wed Jan 23 20:34:18 EST 2008
One thing that might be useful is that jpeg files have 'magic bytes'
at the start and end.
For jpegs, they are (enclosed in angle brackets)
<ÿØ> at the start
<ÿÙ> at the end
(hope these come through email encoding ok)
More info here:
http://en.wikipedia.org/wiki/Magic_number_(programming)
Best,
Mark
On 23 Jan 2008, at 23:30, Richard Miller wrote:
> Brian,
>
> This is the header:
>
> -----------------------------22007350812635
> Content-Disposition: form-data; name="upfile"; filename="we10_1.jpg"
> Content-Type: image/jpeg
>
>
> I used "binfile" and have been using a Rev script to discard the
> header and end data. I am reading directly from the .jpg file into
> a variable in Rev and doing all the processing in that variable
> before writing it to a new .jpg file. Still, there are some "funky"
> characters appearing throughout the file.. something on the order
> of 30 bytes in a 12k file (and they are there before I do anything
> in Rev).
>
> Thanks.
> Richard
>
>
> On Jan 23, 2008, at 6:10 PM, Brian Yennie wrote:
>
>> Richard,
>>
>> Can you post the exact headers that you are getting? For example:
>>
>> Content-Type: image/jpeg
>> Content-Transfer-Encoding: binary
>>
>> You may have to focus on the encoding portion to make sure you are
>> decoding the data properly. A couple other notes:
>>
>> * Once you have the correct data in a variable, you should be able
>> to just write it to a file using "binfile:". Be sure NOT to use
>> the ordinary "file:" URL since you definitely have binary image
>> data and not text.
>>
>> * When you remove the MIME headers (the funky numbers and Content-
>> headers), are you doing it manually with a text editor? If so, you
>> might be introducing the funny characters yourself by accident.
>> Better to make sure these are removed by script if possible.
>>
>> Hope that helps a bit.
>>
>> - Brian
>>
>>
>> _______________________________________________
>> use-revolution mailing list
>> use-revolution at lists.runrev.com
>> Please visit this url to subscribe, unsubscribe and manage your
>> subscription preferences:
>> http://lists.runrev.com/mailman/listinfo/use-revolution
>
> _______________________________________________
> use-revolution mailing list
> use-revolution at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your
> subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-revolution
More information about the use-livecode
mailing list