Uploaded image for project: 'Moodle'
  1. Moodle
  2. MDL-18970

editing a course repository's graphic files using an online editor (pixlr.com / aviary.com services)



    • Type: New Feature
    • Status: Closed
    • Priority: Minor
    • Resolution: Inactive
    • Affects Version/s: 1.9.4, 2.0
    • Fix Version/s: None
    • Component/s: Files API
    • Labels:
    • Environment:
      php 5, mysql 5, apache 2, moodle 1.9.x (2.0 too)


      a little patch for editing (exporting) a graphic file from the course's repository to
      a remote (online) "Graphic Editing Service" like pixlr.com or aviary.com.

      this little patch adds a new link "edit" to the right of the graphic filename
      inside the list of files in the course's file repository.
      clicking on the link, uploads the current file to the remote service (temporarily)
      and opens up the graphic file inside an online graphic editor.
      (saving the file can upload it back to Moodle. not working, yet)

      after line 926 (file : /files/index.php) add the following lines:

      if ($icon == "image.gif" ) {
      $edittext .= "<a href=\"http://www.pixlr.com/editor/?image=".$CFG->wwwroot."/sendfile.php/".$id.$wdir.$file\">[$stredit]</a>";
      //$edittext .= "<a href=\"http://aviary.com/flash/aviary/index.aspx?tid=1&phoenix&userhash=123456&loadurl=".$CFG->wwwroot."/sendfile.php/".$id.$wdir.$file\">[$stredit]</a>";

      because of course security over course's file repository, i had to trim down some of the security
      restrictions inside the original file.php and made a special sendfile.php file for this purpose ONLY !
      i will appreciate a better idea for implementing this or some code review to make this process safer.
      i am attaching the sendfile.php (that should go into the root folder of your Moodle site)

      both Pixlr.com and Aviary.com provide APIs for their services:
      (pixlr.com looks more promising, but aviary.com have a better editor)

      i tried uploading (initially) the resulting images back to the server that is hosting Moodle
      but could not because of my Hoster's php security issue that was blocking some of the functions i was trying to use.
      i am attaching a mixed remarked upload.php file for anyone that has a less strict server at hand
      and for further development.

      an a working sample url (so you can see before you try)




            • Assignee:
              nadavkav Nadav Kavalerchik
              Component watchers:
              Matteo Scaramuccia, Jake Dallimore, Jun Pataleta
            • Votes:
              0 Vote for this issue
              1 Start watching this issue


              • Created: