1
$\begingroup$
Cell[TextData[{ "(16) ", ButtonBox["[images]",  BaseStyle->"Hyperlink",  ButtonData->{"https://i.sstatic.net/gHWby.png", None}]}], "Text"]

After click the link, then open one notebook, however it's in bad encoding?

enter image description here

My $CharacterEncoding is CP936, I'm not sure whether this is related, I'm on Windows, maybe someone's environment will show the linked image good?

$\endgroup$
6
  • 1
    $\begingroup$ This occurs because you are opening the PNG file directly in the front end. Try importing it as an image instead. $\endgroup$ Commented Jul 8, 2013 at 4:06
  • $\begingroup$ @OleksandrR. I encountered with this by accident. So I'm not sure whether this is one feature of Mathematica. Because sometimes when we add links of web images, then click just comes out the System Internet Explorer. $\endgroup$ Commented Jul 8, 2013 at 4:10
  • 1
    $\begingroup$ I don't know why that happens. If that's what you want, though, you can use SystemOpen. $\endgroup$ Commented Jul 8, 2013 at 4:13
  • $\begingroup$ @OleksandrR. SystemOpen is ok, but in this case, I just wanna image show in Mathematica's new open notebook, something like Latex's formula preview or MathML window in SE, I just think it maybe developed by some setting about encoding that makes this action like as expected. Also something like a button on the image link, and then Import and show the image(or image's codes) in one New open Notebook. $\endgroup$ Commented Jul 8, 2013 at 6:05
  • $\begingroup$ I don't know if I understand what you want, but does this help at all? CellPrint@Cell[ TextData[{ "(16) ", ButtonBox["[images]", Evaluator -> Automatic, BaseStyle -> "Hyperlink", ButtonFunction -> (Print @ Import @ # &), ButtonData -> "https://i.sstatic.net/gHWby.png"]}], "Text"] $\endgroup$
    – Mr.Wizard
    Commented Jul 8, 2013 at 17:20

1 Answer 1

2
$\begingroup$

I assume that you are finding a way to open images in a new notebook, so this might be of help:

nb = CreateDocument[];
NotebookWrite[nb, 
Cell[BoxData[ToBoxes[
          Import["https://i.sstatic.net/gHWby.png"]
    ]]]]
$\endgroup$
1
  • 1
    $\begingroup$ Yes, this is one possible way, but I'm more curious to know whether there would be possible to set some options, and make the example I figured works well. $\endgroup$ Commented Jul 8, 2013 at 7:34

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.