|
|
|
@ -61,17 +61,20 @@ class OpenofficePresentation extends OpenofficeDocument |
|
|
|
|
$slide_name = 'slide'.str_repeat('0', 2 - strlen($i)).$i; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if (!is_file($this->base_work_dir.$this->created_dir.'/'.$file_name) or filesize($this->base_work_dir.$this->created_dir.'/'.$file_name) == 0) { |
|
|
|
|
if (!is_file($this->base_work_dir.$this->created_dir.$file_name) or filesize($this->base_work_dir.$this->created_dir.$file_name) == 0) { |
|
|
|
|
continue; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
$i++; |
|
|
|
|
if (substr($file_name, -1, 1) == '/') { |
|
|
|
|
$file_name = substr($file_name, 0, -1); |
|
|
|
|
} |
|
|
|
|
// Add the png to documents. |
|
|
|
|
$document_id = add_document( |
|
|
|
|
$_course, |
|
|
|
|
$this->created_dir.'/'.urlencode($file_name), |
|
|
|
|
$this->created_dir.urlencode($file_name), |
|
|
|
|
'file', |
|
|
|
|
filesize($this->base_work_dir.$this->created_dir.'/'.$file_name), |
|
|
|
|
filesize($this->base_work_dir.$this->created_dir.$file_name), |
|
|
|
|
$slide_name |
|
|
|
|
); |
|
|
|
|
|
|
|
|
@ -89,7 +92,7 @@ class OpenofficePresentation extends OpenofficeDocument |
|
|
|
|
); |
|
|
|
|
|
|
|
|
|
// Generating the thumbnail. |
|
|
|
|
$image = $this->base_work_dir.$this->created_dir .'/'. $file_name; |
|
|
|
|
$image = $this->base_work_dir.$this->created_dir . $file_name; |
|
|
|
|
|
|
|
|
|
$pattern = '/(\w+)\.png$/'; |
|
|
|
|
$replacement = '${1}_thumb.png'; |
|
|
|
@ -105,14 +108,14 @@ class OpenofficePresentation extends OpenofficeDocument |
|
|
|
|
|
|
|
|
|
$my_new_image = new Image($image); |
|
|
|
|
$my_new_image->resize($thumb_width, $thumb_height); |
|
|
|
|
$my_new_image->send_image($this->base_work_dir.$this->created_dir .'/'. $thumb_name, -1, 'png'); |
|
|
|
|
$my_new_image->send_image($this->base_work_dir.$this->created_dir . $thumb_name, -1, 'png'); |
|
|
|
|
|
|
|
|
|
// Adding the thumbnail to documents. |
|
|
|
|
$document_id_thumb = add_document( |
|
|
|
|
$_course, |
|
|
|
|
$this->created_dir.'/'.urlencode($thumb_name), |
|
|
|
|
$this->created_dir.urlencode($thumb_name), |
|
|
|
|
'file', |
|
|
|
|
filesize($this->base_work_dir.$this->created_dir.'/'.$thumb_name), |
|
|
|
|
filesize($this->base_work_dir.$this->created_dir.$thumb_name), |
|
|
|
|
$slide_name |
|
|
|
|
); |
|
|
|
|
|
|
|
|
@ -120,10 +123,10 @@ class OpenofficePresentation extends OpenofficeDocument |
|
|
|
|
|
|
|
|
|
// Create an html file. |
|
|
|
|
$html_file = $file_name.'.html'; |
|
|
|
|
$fp = fopen($this->base_work_dir.$this->created_dir.'/'.$html_file, 'w+'); |
|
|
|
|
$fp = fopen($this->base_work_dir.$this->created_dir.$html_file, 'w+'); |
|
|
|
|
|
|
|
|
|
$slide_src = api_get_path(REL_COURSE_PATH).$_course['path'].'/document/'.$this->created_dir.'/'.utf8_encode($file_name); |
|
|
|
|
$slide_src = str_replace('//', '/', $slide_src); |
|
|
|
|
$slide_src = api_get_path(REL_COURSE_PATH).$_course['path'].'/document/'.$this->created_dir.utf8_encode($file_name); |
|
|
|
|
$slide_src = str_replace('\/\/', '/', $slide_src); |
|
|
|
|
fwrite($fp, |
|
|
|
|
'<html> |
|
|
|
|
<head> |
|
|
|
@ -136,9 +139,9 @@ class OpenofficePresentation extends OpenofficeDocument |
|
|
|
|
fclose($fp); |
|
|
|
|
$document_id = add_document( |
|
|
|
|
$_course, |
|
|
|
|
$this->created_dir.'/'.urlencode($html_file), |
|
|
|
|
$this->created_dir.urlencode($html_file), |
|
|
|
|
'file', |
|
|
|
|
filesize($this->base_work_dir.$this->created_dir.'/'.$html_file), |
|
|
|
|
filesize($this->base_work_dir.$this->created_dir.$html_file), |
|
|
|
|
$slide_name |
|
|
|
|
); |
|
|
|
|
|
|
|
|
|