[dev-context] Including gif images from the web

Aditya Mahajan adityam at umich.edu
Sun May 27 07:32:46 CEST 2012


Hi,

Inclusion of gif images from the web does not work. For example:

\starttext
\externalfigure[http://upload.wikimedia.org/wikipedia/commons/a/a0/Sunflower_as_gif_websafe.gif]
\stoptext

It is a rather strange bug. In grph-inc.lua we have

     local newbase = file.addsuffix(newbase,newformat)
     local newname = file.join(newpath,newbase)

Now, since the webaddress has a dot, newbase has a dot. file.addsuffix does not
change the suffix if a file already has a suffix (and does not give any warning
about it!). So, newname does not end with .pdf, and therefore

gm convert long-path.gif long-path

does not convert to pdf--the resultant file is a gif file. Hence, direct 
inclusion of that file fails.

A simple fix is to change the addsuffix line to:

    newbase = newbase .. "." .. newformat

Aditya


More information about the dev-context mailing list