Uploaded image is not display in Moodle - tinymce

I create a block in Moodle, where I can add questions and answer. While add question I upload images to the question. I am using tinymce editor here.
Thats ok.
While login as student. In student section the image is not displaying. But the name/description of the image (in alt parameter) is displayed here.
I inspect the section and it shows :
<img style="max-height:30px;" src="http://mysitedotcom/brokenfile.php#/5/user/draft/103179932/amazon_river.jpg" alt="amazon_river.jpg" width="200" height="100">
How can I make the image display in student section?
In teacher section while I edit the question the image is displayed in tinymce editor. So I am sure that the image is saved, but in student section it is not displaying.
Please help me....
EDIT
In database the question is saved as:
<p>Find this?</p>
<p><img src="http://mysitedotcom/draftfile.php/5/user/draft/52307129/amazon_river.jpg" width="200" height="100" /></p>
My moodle version is 2.9.1

Make sure you've gone through all the steps listed here:
https://docs.moodle.org/dev/Using_the_File_API_in_Moodle_forms#Simple_use
This includes calling file_prepare_standard_editor to copy any files into the draft area before showing the form, file_postupdate_standard_editor to copy files out of the draft area once the form is saved and implementing the block_myblock_pluginfile() function in your lib.php to authenticate all file requests.

Related

How to link to the attachments added from the description of a workitem?

In VSTS attachment can be uploaded for workitems. Those attachments are displayed in a seperate tab.
I found no way to reference those attachments from within the description of the workitems.
So how to do it?
drag and drop the attachment to your browsers URL text field
(optional:) remove the &download=true&api-version=5.0-preview.2 part at the end
use this URL to create a link in your comment
I did not find another way yet and maybe it is not so logical :). But as workaround you may download an attachment from work item. Then you may copy a download link from your browser download page and use it on description field.
A workaround that I found to this which shows a selected text within the comment as clickable and opens the attachment if you click on it is:
find and copy the attachment url from browser Developer Tools,
select the part of the text in Discussion box that you like to link to the attachment to,
paste the attachment url to Address box in Create Link popup. You can get to this by using three dots (...) in Discussion section toolbox (More Tools) and select Create Link which allows you to paste the address.
This is amazing that AzureDevops does not have this ability. It's disappointing and makes working with the product so much more difficult. I really cannot imagine how they use this product internally.
You could inspect the attachment url in chromedev tools, then copy the url, the element will look like
<div class="grid-cell-contents-container">
<span class="attachment-icon bowtie-icon bowtie-file-content"></span>
filename.filetype
Then just remove the &api-version=5.0-preview.2 part at the end
Come on Microsoft! You're better than this.
It is now possible maybe. Goto attachments and click on list view
List view of attachments of a workitem
Then just left-click on the file of your choice and drag it
This would appear to be the least "hacky" way, as it relies entirely on the Azure DevOps UI:
Go to the attachments list of the work item.
While you hover over an attachment, three vertical dots with tooltip "More actions" will be shown:
from where you can open a submenu:
In there, click "Copy attachment link".
If you paste this link to a text-only context, you will get only the attachment filename, but if you paste it into a rich-text editor with support for links, such as the Description field or Discussion comments in the work item, the attachment filename will appear as a clickable link.

TinyMCE / Prestashop - get HTML content

I'm currently working on a website and I have to use Prestashop.
I created a back office interface that allows the user to write, edit and delete articles. So I put a tinyMCE editor in it.
The problem is that when I click on 'save' to store the article in the database, it only stores raw text, without the styling content (html tags, bold text etc)
I would like to know how to get the whole content, including html tags, styling etc.
Thank you.
Ok so all I had to do was to change self::TYPE_STRING to self::TYPE_HTML in my Article.php file.

Custom Form not showing up in magento

I am having difficulty getting a form to show on a magento store I am working on. the site already has a contact form so I've copied the form.phtml file and renamed it brochure.phtml.
I've created a static page on the CMS section and added this line of code based on this qusetion
{{block type="core/template" template="contacts/brochure.phtml"}}
When I view the page though nothing shows up. What am I doing wrong? I've never used magento before so please be as detailed in your answers if you can.
CMS -> Pages ->Select your page -> Select "Content" on the left side navigation
Post this code there
{{block type="core/template" name="contactForm" form_action="/contacts/index/post" template="contacts/brochure.phtml"}}
make sure your brochure.phtml file is in the same folder as the form.phtml file. If your CMS page is coming up with the header, body format and the rest of the website layout but the middle content section is plain white then it is not loading your brochure.phtml. If this is the case I would then try loading the default form, so replace "brochure.phtml" with "form.phtml" and reload the page. If you see the default form then you know your brochure.phtml file is in the wrong location.
Hope this fixes your problem.

cache http://graph.facebook.com/[UID]/picture call?

Thanks to How can I display the users profile pic using the facebook graph api? I found out I can retrieve profile picture via
http://graph.facebook.com/[UID]/picture
but this redirects to an image like for example:
http://profile.ak.fbcdn.net/hprofile-ak-snc4/hs1346.snc4/161671_1096373372_1486835_q.jpg
My first question is when I want to display this image should I do(returned from API)
<img src="http://profile.ak.fbcdn.net/hprofile-ak-snc4/hs1346.snc4/161671_1096373372_1486835_q.jpg" />
or should I call the api:
<img src="http://graph.facebook.com/alfredwesterveld/picture" />
Does http://profile.ak.fbcdn.net/hprofile-ak-snc4/hs1346.snc4/161671_1096373372_1486835_q.jpg show my updated profile picture, if update my profile picture on Facebook or does show my old profile picture. I ask these question because when I could call an absolute URL(which resolves to an image immediately) I could safe myself a redirect(round-trip). I believe this could add up especially when I want to get all profile pictures from the visitors of my website.
When you want to display the picture of a user use the second method, that's the good one:
<img src="https://graph.facebook.com/[UID]/picture" alt="" />
Doing like this you'll be sure that each time you'll receive the updated picture of the user, if it was changed recently.
later edit
Related to the cache issue, if you want to save the direct urls in order to improve caching of the pictures I don't suggest doing so because those urls are changing each time a user changes the profile picture, so you might end up displaying an older picture even though the user actually changed it recently.
hi why you not use fbml tag for this?
<fb:profile-pic uid='UID' width='50' height='50'></fb:profile-pic>
EDIT
hello if you want to get photo uploaded by the user then you can get by this
$photos=json_decode(file_get_contents('https://graph.facebook.com/me/photos?access_token='.$cookie['access_token']));
foreach ($photos->data as $friend)
{
?>
<img src="<?=$friend->source?>" width="50" height="50">
<?php
}
All images uploaded by the user can be easily captured

How does Facebook detect images when adding a link?

When you add a link to your Facebook page, after some processing, Facebook presents you a next/prev button to choose an image linked to the url your are inserting.
Obviously, Facebook reads the html-page and displays the images found on the url you insert.
Does anyone knows what algorithm Facebook uses to decide what images to show ?
If I insert a link to : http://www.staplijst.be/lachende-wandelaars-aalter-aktivia-003.asp, only 11 images are detected. The one I want, the one at the top right corner, is not included in the list.
If I insert a link to http://www.staplijst.be/stichting-kennedymars-rijsbergen-zundert-nederland-knblo-nl-81996.asp, 19 images are displayed (including the one I want (the one at the right top corner of the text area).
Both pages are build using asp code but are functionally the same.
I thought that it has something to do with the image size, but can't find any deciding factor there.
I will investigate some furhter, because if I know what Facebook is looking for, I can make sure that the correct images are included on the page (since they are dynamic pages build with classic asp).
But if anyone has any idea ? Help would be appreciated.
This looks like a duplicate of:
Facebook Post Link Image
Use <link rel="image_src" href="abs_url_of_your_image">
My guess, is that FB hides repeated images - 'couse a repeated image normally indicates a design-element (not content). When you post a link, only images related to that articles content, are relevant.
So; make sure your image only appears once, and see if it helps!
I am not familiar with the way Facebook did it, but I can tell you how I would do it.
Establish web request to desired url
Parse resulted web response with regular expression, that looks for <img src="" />