Hi, thanks for all your help so far.
Could you please tell me how to insert an .eps image into a problem?
I've looked at the marco lists but they're really not that helpful in explaining what I need to do and seem to concentrate mostly on showing or creating plots whereas I just want to upload an image to Webwork (which I've done and added it to the 'templates' folder) and then display it in a question.
I'm also wondering, is it possible to create an image that students can interact with? For example, on an image of charges, can they drag and drop arrows to show where force vectors should be? If yes, can those arrows be made to rotate after being dragged and dropped so that the vector can point in any arbitrary direction?
It seems unlikely that this should be possible but I thought I'd just ask anyway to see if it is or not.
Hi Clinton,
I think you'll end up having to convert the EPS image into a web-compatible one like a PNG or GIF. This is a bit funny, in that WeBWorK converts the latter back to EPS to generate the hardcopy, but I don't think there's any auto EPS to PNG converter built into the graphic macros. (If I'm wrong, I'm sure someone will correct me...)
As for inserting the image, once it's in the templates directory of the course, you should be able to just use the image() macro in your problem text to insert it. For example,
BEGIN_TEXT
\{ image( imagename.png ) \}
END_TEXT
You might also want to include tex_size and/or other options in this, too; for example, to insert a 250x100 pixel image, I'd use something like
BEGIN_TEXT
\{ image( imagename.png, tex_size=>250, height=>100, width=>250, extra_html_tags=>'alt="text describing image"' ) \}
END_TEXT
Specifying the size means that the image doesn't get stretched when it shows up in the problem. I like to include an alt tag for screen readers, too.
Re: interactive images, I think at that point we're trying to do something with Flash or Java. I believe the hooks exist to do this, but I don't think it's documented or well tested.
I hope this helps,
Gavin
I think you'll end up having to convert the EPS image into a web-compatible one like a PNG or GIF. This is a bit funny, in that WeBWorK converts the latter back to EPS to generate the hardcopy, but I don't think there's any auto EPS to PNG converter built into the graphic macros. (If I'm wrong, I'm sure someone will correct me...)
As for inserting the image, once it's in the templates directory of the course, you should be able to just use the image() macro in your problem text to insert it. For example,
BEGIN_TEXT
\{ image( imagename.png ) \}
END_TEXT
You might also want to include tex_size and/or other options in this, too; for example, to insert a 250x100 pixel image, I'd use something like
BEGIN_TEXT
\{ image( imagename.png, tex_size=>250, height=>100, width=>250, extra_html_tags=>'alt="text describing image"' ) \}
END_TEXT
Specifying the size means that the image doesn't get stretched when it shows up in the problem. I like to include an alt tag for screen readers, too.
Re: interactive images, I think at that point we're trying to do something with Flash or Java. I believe the hooks exist to do this, but I don't think it's documented or well tested.
I hope this helps,
Gavin
Hi Gavin,
I did as you suggested but it didn't work. Webwork goes as far as creating a 'sliver' of a box where the image is supposed to be displayed but without actually displaying the image. The little box is live but when I click on it I get a little window containing this message:
The requested URL /webwork2_course_files/Testing_Admin_Only/tmp/gif/test-prob2-arber_6apng.gif was not found on this server.
I've uploaded the image to all kinds of folders on webwork but with no luck. Are you sure it's just the /templates folder the image must go into? Are you sure you gave the code correctly? Maybe there's a macro I'm supposed to include here that I haven't? Would the underscore in the name of the image cause a problem?
I'm not sure of how to fix the problem.
Clinton
I did as you suggested but it didn't work. Webwork goes as far as creating a 'sliver' of a box where the image is supposed to be displayed but without actually displaying the image. The little box is live but when I click on it I get a little window containing this message:
The requested URL /webwork2_course_files/Testing_Admin_Only/tmp/gif/test-prob2-arber_6apng.gif was not found on this server.
I've uploaded the image to all kinds of folders on webwork but with no luck. Are you sure it's just the /templates folder the image must go into? Are you sure you gave the code correctly? Maybe there's a macro I'm supposed to include here that I haven't? Would the underscore in the name of the image cause a problem?
I'm not sure of how to fix the problem.
Clinton
Hi,
Never mind, I've fixed the problem. I took out the .png extension and now it loads properly.
Thanks for your help.
Clinton
Never mind, I've fixed the problem. I took out the .png extension and now it loads properly.
Thanks for your help.
Clinton
Hi Clinton,
Interesting. I wonder if it's a quoting issue. Looking back at my problems I find that where I've done this before I have something like
BEGIN_TEXT
\{ image("filename.png") \}
END_TEXT
(that is, I quoted the filename, which I didn't do in the sample I pasted in before). But I did include the ".png" extension.
In any event, glad to hear it's working now.
Cheers,
Gavin
Interesting. I wonder if it's a quoting issue. Looking back at my problems I find that where I've done this before I have something like
BEGIN_TEXT
\{ image("filename.png") \}
END_TEXT
(that is, I quoted the filename, which I didn't do in the sample I pasted in before). But I did include the ".png" extension.
In any event, glad to hear it's working now.
Cheers,
Gavin
I think Gavin is right. Without the quotes
fileName.png will be interpreted by perl (grudgingly -- there is a warning, but
it is probably only placed in the apache error log) as the string
"fileName" concatenated with the string "png" so you
get fileNamepng and then WeBWorK will try to attach a .png or .gif
extension onto that name (since it doesn't have an extension).
Your reported error message seems consistent with that scenario (notice how the filename was mangled).
My guess at any rate --- predicting perl's reaction to
unusual expressions is an amusing by challenging pastime.
-- Mike
fileName.png will be interpreted by perl (grudgingly -- there is a warning, but
it is probably only placed in the apache error log) as the string
"fileName" concatenated with the string "png" so you
get fileNamepng and then WeBWorK will try to attach a .png or .gif
extension onto that name (since it doesn't have an extension).
Your reported error message seems consistent with that scenario (notice how the filename was mangled).
My guess at any rate --- predicting perl's reaction to
unusual expressions is an amusing by challenging pastime.
-- Mike