Juan Carlos Raña 14 years ago
parent
commit
f6a0e002a5

+ 1 - 6
main/document/edit_paint.php

@@ -166,23 +166,18 @@ $extension= $findext[count($findext)-1];
 $file_crip=$name_crip.'.'.$extension;
 
 //copy file to temp/images directory
-
 $from=$filepath.$file;
 $to=api_get_path(SYS_ARCHIVE_PATH).'temp/images/'.$file_crip;
 copy($from, $to);
+$_SESSION['temp_realpath_image']=$to;
 
 //load image to url
 $to_url=api_get_path(WEB_ARCHIVE_PATH).'temp/images/'.$file_crip;
 $image=urlencode($to_url);
 
 //make frame an send image
-
 echo '<iframe style=\'height: 600px; width: 100%;\' scrolling=\'no\' frameborder=\'0\' src=\'http://pixlr.com/editor/?title='.$title.'&amp;image='.$image.'&amp;loc='.$loc.'&amp;referrer='.$referrer.'&amp;target='.$target.'&amp;exit='.$exit.'&amp;locktarget='.$locktarget.'&amp;locktitle='.$locktitle.'\'>';
 echo '</iframe>';
 
-//delete temporal file after a time
-//TODO:time counter. Can not be deleted immediately. It is necessary to leave a little time for pixlr.com can be loaded
-//unlink($to);
-
 Display::display_footer();
 ?>

+ 10 - 0
main/document/exit_pixlr.php

@@ -13,6 +13,16 @@
 require_once '../inc/global.inc.php';
 api_protect_course_script();
 api_block_anonymous_users();
+	
+//delete temporal file
+unlink($_SESSION['temp_realpath_image']);
+
+//Clean sessions and return to Chamilo file list
+unset($_SESSION['paint_dir']);
+unset($_SESSION['paint_file']);
+unset($_SESSION['whereami']);
+unset($_SESSION['temp_realpath_image']);
+
 if (!isset($_SESSION['exit_pixlr'])){
 	$location=api_get_path(WEB_CODE_PATH).'document/document.php';
 	echo '<script>window.parent.location.href="'.$location.'"</script>';					 

+ 4 - 0
main/document/save_pixlr.php

@@ -122,10 +122,14 @@ if($currentTool=='document/createpaint'){
 }
 
 
+//delete temporal file
+unlink($_SESSION['temp_realpath_image']);
+
 //Clean sessions and return to Chamilo file list
 unset($_SESSION['paint_dir']);
 unset($_SESSION['paint_file']);
 unset($_SESSION['whereami']);
+unset($_SESSION['temp_realpath_image']);
 
 if (!isset($_SESSION['exit_pixlr'])){
 	$location=api_get_path(WEB_CODE_PATH).'document/document.php';

+ 0 - 0
tests/datafiller/data_courses.php