Re: 2 gifs side by side -- with hyperlinks
- To: mathgroup at smc.vnet.net
- Subject: [mg36490] Re: [mg36469] 2 gifs side by side -- with hyperlinks
- From: "P.J. Hinton" <paulh at wolfram.com>
- Date: Mon, 9 Sep 2002 00:29:29 -0400 (EDT)
- Organization: "Wolfram Research, Inc."
- Sender: owner-wri-mathgroup at wolfram.com
On Sun, 8 Sep 2002, Murray Eisenberg wrote: > (1) Is there a way in Mathematica 4.2 to put two separate gifs into a > single, cell side by side (with some intervening space), without > having to combine them in some graphics program first? > > In particular, I'd like to do that within a text cell. > > Even in a new Input cell, if I first create a GridBox (via Inut>Create > Table/Matrix/Palette) and then try to insert the first gif (via > Edit>Insert Object>Create from File ....), Mathematica promptly > crashes. (Mathematica 4.2 under Windows 2000.) You could do something like this: grlist = Map[Import[#, "GIF"]&, {<first file>, <second file>}] celist = Map[Cell[GraphicsData["PostScript", DisplayString[#]]]&, grlist] CellPrint[Cell[BoxData[GridBox[{celist}]], "Text"]] This embeds the PostScript versions of these graphics each as inline cells in a GridBox[] structure. > (2) Is there a way to cause a gif imported into a Mathematica 4.2 > notebook to become a hyperlink -- so that when the user clicks on the > gif the hyperlink's target is summoned? Again, we embed the PostScript graphic within an inline cell. Here is a function that does what you describe: createGIFHyperlink[gifImage_String, url_String] := NotebookWrite[EvaluationNotebook[], Cell[BoxData[ ButtonBox[ Cell[GraphicsData["PostScript", DisplayString[Import[gifImage, "GIF"]]]], ButtonStyle -> "Hyperlink", ButtonData :> {URL[url], None}]], "Text"]] -- P.J. Hinton User Interface Programmer paulh at wolfram.com Wolfram Research, Inc. Disclaimer: Opinions expressed herein are those of the author alone.