displaying images in random glossary block

displaying images in random glossary block

by Mary Cooch -
Number of replies: 17
Picture of Documentation writers Picture of Moodle HQ Picture of Particularly helpful Moodlers Picture of Testers Picture of Translators

I hope this is a really obvious thing I have missed but I can't get a random glossary block to display images - I haven't used one in ages but I thought if you attached an image as an attachment then the glossary block would display that image - but I have tried on my own Moodle and the demo moodle and I just get the definition and description but no embedded image - is there a filter I should have set or something? I know that in the glossary itself you set it to "encyclopedia" if you want images inline but there is no setting in the block itself. I am using 2.0.3 and the demo 2.1 - I know also that you can add images via the html editor icon but I want to do it with the "add "button. I saw this: http://tracker.moodle.org/browse/MDL-24959 I don't know if it is anything to do with it but it says it is fixed

Average of ratings: -
In reply to Mary Cooch

Re: displaying images in random glossary block

by Mary Cooch -
Picture of Documentation writers Picture of Moodle HQ Picture of Particularly helpful Moodlers Picture of Testers Picture of Translators

well if other people can "up" their posts, why shouldn't I? smile Any takers?

In reply to Mary Cooch

Re: displaying images in random glossary block

by Joseph Rézeau -
Picture of Core developers Picture of Particularly helpful Moodlers Picture of Plugin developers Picture of Testers Picture of Translators

Mary " I know also that you can add images via the html editor icon but I want to do it with the "add "button. "

Why not use the HTML editor Insert/Edit image button? and your problem is solved immediately...

Joseph

In reply to Joseph Rézeau

Re: displaying images in random glossary block

by Mary Cooch -
Picture of Documentation writers Picture of Moodle HQ Picture of Particularly helpful Moodlers Picture of Testers Picture of Translators

Because I am trying to keep it simple for simple peoplesmile But I suppose I shall have to do it that way after allsmile

In reply to Mary Cooch

Re: displaying images in random glossary block

by Joseph Rézeau -
Picture of Core developers Picture of Particularly helpful Moodlers Picture of Plugin developers Picture of Testers Picture of Translators

Mary,

I may have found a way to display picture attachments in the random glossary block. Will keep you posted here and post the patch in the bug tracker (for moodle 2.1).

Joseph

In reply to Joseph Rézeau

Re: displaying images in random glossary block

by Mary Cooch -
Picture of Documentation writers Picture of Moodle HQ Picture of Particularly helpful Moodlers Picture of Testers Picture of Translators

oh thankyou!

In reply to Mary Cooch

Re: displaying images in random glossary block

by Itamar Tzadok -

I guess the "keep it simple for simple people" could not be overstated and my stuff seems to keep getting more and more complex. wide eyes So I'd really appreciate your opinion Mary and Joseph. I've just finished an initial implementation of a Dataform block. That's basically a block which displays a selected dataform view on the course main page (or anywhere blocks may be displayed). So suppose I have a glossary view, that is, a view which does what the glossary does (plus the random stuff that the random glossary block does). I can add a Dataform block and set it to display a random entry from that dataform. But I can also set the view to display more then one entry, or even display a paging bar and all that will appear in the block. Does that get too confusing? smile

 

Here is an illustration of the dataform block, set to display one of the chart views of the activity:

In reply to Mary Cooch

Re: displaying images in random glossary block

by Joseph Rézeau -
Picture of Core developers Picture of Particularly helpful Moodlers Picture of Plugin developers Picture of Testers Picture of Translators

@Mary, please specify how you would like glossary entry attachments to be displayed in the Random glossary entry block.

  1. Display ALL attached files as links (to e.g. text, audio, etc. files) AND picture attachments as images
    OR only display images (as images)
  2. I can add an option in the settings of the random glossary entry block to switch the display of images ON / OFF? Is that OK?

Joseph

In reply to Joseph Rézeau

Re: displaying images in random glossary block

by Mary Cooch -
Picture of Documentation writers Picture of Moodle HQ Picture of Particularly helpful Moodlers Picture of Testers Picture of Translators

Hi Joseph - actually, I would like to be able to display attached files as embedded media such as a picture attachment as inside the block and an mp3 file in its player or a video in a video player - or is that asking too much ? Otherwise, I am happy to have option 2 if it means we can choose between images being displayed as attachments or as embedded in the block. (if that makes sense)

In reply to Mary Cooch

Re: displaying images in random glossary block

by Joseph Rézeau -
Picture of Core developers Picture of Particularly helpful Moodlers Picture of Plugin developers Picture of Testers Picture of Translators

Hi Mary,

I'm making good progress on this problem. Please contact me directly (see my private messages) re this matter.

One problem with displaying images and videos in a side block in a moodle course is that the width of the left and right columns is limited by the theme you are using. Very few themes have a configurable column width.

I have found a solution to resize (actually downsize to the width of the column) attached images, but not for videos.

Joseph

In reply to Joseph Rézeau

Re: displaying images in random glossary block

by Itamar Tzadok -

Joseph, could you post your solution here? It may be useful for my plugin, even though I use a different approach (from the glossarie's) for populating content to the block. smile

In reply to Itamar Tzadok

Re: displaying images in random glossary block

by Joseph Rézeau -
Picture of Core developers Picture of Particularly helpful Moodlers Picture of Plugin developers Picture of Testers Picture of Translators

@ Itamar,

Yes of course I will post a link to my solution ASAP (I will place a hacked glossary_random block on my github repository). This is just getting delayed because I am in the process of "refining" my solution. Just be patient!

Joseph

In reply to Joseph Rézeau

Re: displaying images in random glossary block

by Itamar Tzadok -

Thanks Joseph! In the meantime image size in the block seems to be resolved by setting the displayed image width and height to 100%. The same technique seems to be at least partially applicable to some media plugins. So for instance the width of the youtube plugin object could be set to 100% but the height should still be an actual number of pixels (in the illustration below I twicked the height and width of the youtube object with firebug). The problem with the media filters is that whether or not the width and height are hardcoded (true for youtube filter, but other filters accept custom width and height through the url) the width and height are coded as element properties rather than styles, which makes them much less user customizable, if at all. But I'm looking at the 1.9 media filters and perhaps things are different in 2.0. smile

 

 

In reply to Itamar Tzadok

Re: displaying images in random glossary block

by Joseph Rézeau -
Picture of Core developers Picture of Particularly helpful Moodlers Picture of Plugin developers Picture of Testers Picture of Translators

See my hacked glossary_random block to display attached media on my github here:

https://github.com/rezeau/moodle/tree/glossary_random_jr/blocks/glossary_random

Looking forward to testing reports.

Joseph

In reply to Joseph Rézeau

Re: displaying images in random glossary block

by Itamar Tzadok -

Thanks for that Joseph! Looked at the code but can't test it yet. The approach of getting the block width can't work in my block because in my case it is not the block which displays the content but rather the dataform view (the block merely asks the dataform view to do its thing). So I must set the width of the media objects to 100% for downsizing them to the block's width. The problem is that the reg exps in filter_mediaplugin are set to parse from the dimension clause of the url only digits whereas I need them to parse also %. But this should be fairly easy to fix and when I get there I will generate the patch. smile

In reply to Joseph Rézeau

Re: displaying images in random glossary block

by Joseph Rézeau -
Picture of Core developers Picture of Particularly helpful Moodlers Picture of Plugin developers Picture of Testers Picture of Translators

I've now filed an "improvement" ticket in the bug tracker (with the correct new URL for my github hack). Please see MDL-28413.

Joseph

In reply to Joseph Rézeau

Re: displaying images in random glossary block

by Mary Cooch -
Picture of Documentation writers Picture of Moodle HQ Picture of Particularly helpful Moodlers Picture of Testers Picture of Translators

Joseph- thankyou for this-I am on Heathrow airport's paid for wifi feeding my addicition at the moment - en route to Sydney for #mootau11. I will respond toyour message when I can get to it and when I get to Sydney- I apologise for the delay..

In reply to Mary Cooch

Re: displaying images in random glossary block

by Joseph Rézeau -
Picture of Core developers Picture of Particularly helpful Moodlers Picture of Plugin developers Picture of Testers Picture of Translators

Hi Mary,

I hope you thoroughly enjoy the Australian MoodleMoot. You certainly deserve it.approve

ATB

Joseph