|
@@ -64,7 +64,7 @@ discard block |
|
|
block discarded – undo |
|
64
|
64
|
if ($slide_id != 'all') { |
|
65
|
65
|
$image = null; |
|
66
|
66
|
if (isset($image_files_only[$slide])) { |
|
67
|
|
- $image = $sys_course_path . $_course['path'] . '/document' . $folder . $image_files_only[$slide]; |
|
|
67
|
+ $image = $sys_course_path.$_course['path'].'/document'.$folder.$image_files_only[$slide]; |
|
68
|
68
|
} |
|
69
|
69
|
if (file_exists($image)) { |
|
70
|
70
|
echo '<div class="actions-pagination">'; |
|
@@ -103,7 +103,7 @@ discard block |
|
|
block discarded – undo |
|
103
|
103
|
$last = '<img src="'.api_get_path(WEB_IMG_PATH).'action_last_na.png" title="'.get_lang('LastSlide').'" alt="'.get_lang('LastSlide').'">'; |
|
104
|
104
|
} else { |
|
105
|
105
|
$imgn = 'action_next.png'; |
|
106
|
|
- $last = '<a href="slideshow.php?slide_id='.($total_slides-1).'&curdirpath='.$pathurl.'"><img src="'.api_get_path(WEB_IMG_PATH).'action_last.png" title="'.get_lang('LastSlide').'" alt="'.get_lang('LastSlide').'"></a>'; |
|
|
106
|
+ $last = '<a href="slideshow.php?slide_id='.($total_slides - 1).'&curdirpath='.$pathurl.'"><img src="'.api_get_path(WEB_IMG_PATH).'action_last.png" title="'.get_lang('LastSlide').'" alt="'.get_lang('LastSlide').'"></a>'; |
|
107
|
107
|
} |
|
108
|
108
|
echo '<img src="'.api_get_path(WEB_IMG_PATH).$imgn.'" title="'.get_lang('Next').'" alt="'.get_lang('Next').'">'; |
|
109
|
109
|
if ($slide > 0) { |
|
@@ -118,18 +118,18 @@ discard block |
|
|
block discarded – undo |
|
118
|
118
|
|
|
119
|
119
|
// Exit the slideshow |
|
120
|
120
|
echo '<a href="document.php?action=exit_slideshow&curdirpath='.$pathurl.'&'.api_get_cidreq().'">'. |
|
121
|
|
- Display::return_icon('back.png',get_lang('BackTo').' '.get_lang('DocumentsOverview'),'',ICON_SIZE_MEDIUM).'</a>'; |
|
|
121
|
+ Display::return_icon('back.png', get_lang('BackTo').' '.get_lang('DocumentsOverview'), '', ICON_SIZE_MEDIUM).'</a>'; |
|
122
|
122
|
|
|
123
|
123
|
// Show thumbnails |
|
124
|
124
|
if ($slide_id != 'all') { |
|
125
|
125
|
echo '<a href="slideshow.php?slide_id=all&curdirpath='.$pathurl.'&'.api_get_cidreq().'">'. |
|
126
|
|
- Display::return_icon('thumbnails.png',get_lang('ShowThumbnails'),'',ICON_SIZE_MEDIUM).'</a>'; |
|
|
126
|
+ Display::return_icon('thumbnails.png', get_lang('ShowThumbnails'), '', ICON_SIZE_MEDIUM).'</a>'; |
|
127
|
127
|
} else { |
|
128
|
|
- echo Display::return_icon('thumbnails_na.png',get_lang('ShowThumbnails'),'',ICON_SIZE_MEDIUM); |
|
|
128
|
+ echo Display::return_icon('thumbnails_na.png', get_lang('ShowThumbnails'), '', ICON_SIZE_MEDIUM); |
|
129
|
129
|
} |
|
130
|
130
|
// Slideshow options |
|
131
|
131
|
echo '<a href="slideshowoptions.php?curdirpath='.$pathurl.'&'.api_get_cidreq().'">'. |
|
132
|
|
- Display::return_icon('settings.png',get_lang('SetSlideshowOptions'),'',ICON_SIZE_MEDIUM).'</a>'; |
|
|
132
|
+ Display::return_icon('settings.png', get_lang('SetSlideshowOptions'), '', ICON_SIZE_MEDIUM).'</a>'; |
|
133
|
133
|
|
|
134
|
134
|
?> |
|
135
|
135
|
</div> |
|
@@ -156,7 +156,7 @@ discard block |
|
|
block discarded – undo |
|
156
|
156
|
} |
|
157
|
157
|
$target_width = $target_height = null; |
|
158
|
158
|
// The target height and width depends if we choose resizing or no resizing |
|
159
|
|
-if (isset($_SESSION["image_resizing"]) && $_SESSION["image_resizing"] == "resizing") { |
|
|
159
|
+if (isset($_SESSION["image_resizing"]) && $_SESSION["image_resizing"] == "resizing") { |
|
160
|
160
|
$target_width = $_SESSION["image_resizing_width"]; |
|
161
|
161
|
$target_height = $_SESSION["image_resizing_height"]; |
|
162
|
162
|
} |
|
@@ -164,7 +164,7 @@ discard block |
|
|
block discarded – undo |
|
164
|
164
|
/* THUMBNAIL VIEW */ |
|
165
|
165
|
|
|
166
|
166
|
// This is for viewing all the images in the slideshow as thumbnails. |
|
167
|
|
-$image_tag = array (); |
|
|
167
|
+$image_tag = array(); |
|
168
|
168
|
$html = ''; |
|
169
|
169
|
if ($slide_id == 'all') { |
|
170
|
170
|
|
|
@@ -173,14 +173,14 @@ discard block |
|
|
block discarded – undo |
|
173
|
173
|
$max_thumbnail_width = 250; |
|
174
|
174
|
$max_thumbnail_height = 250; |
|
175
|
175
|
$png_compression = 0; // 0(none)-9 |
|
176
|
|
- $jpg_quality = 75; // from 0 to 100 (default is 75). More quality less compression |
|
|
176
|
+ $jpg_quality = 75; // from 0 to 100 (default is 75). More quality less compression |
|
177
|
177
|
|
|
178
|
178
|
$directory_thumbnails = $sys_course_path.$_course['path'].'/document'.$folder.'.thumbs/'; |
|
179
|
179
|
|
|
180
|
180
|
//Other parameters only for show tumbnails |
|
181
|
|
- $row_items = 4;//only in slideshow.php |
|
182
|
|
- $number_image = 7;//num icons cols to show |
|
183
|
|
- $thumbnail_width_frame = $max_thumbnail_width;//optional $max_thumbnail_width+x |
|
|
181
|
+ $row_items = 4; //only in slideshow.php |
|
|
182
|
+ $number_image = 7; //num icons cols to show |
|
|
183
|
+ $thumbnail_width_frame = $max_thumbnail_width; //optional $max_thumbnail_width+x |
|
184
|
184
|
$thumbnail_height_frame = $max_thumbnail_height; |
|
185
|
185
|
|
|
186
|
186
|
// Create the template_thumbnails folder (if no exist) |
|
@@ -194,20 +194,20 @@ discard block |
|
|
block discarded – undo |
|
194
|
194
|
|
|
195
|
195
|
foreach ($image_files_only as $one_image_file) { |
|
196
|
196
|
$image = $sys_course_path.$_course['path'].'/document'.$folder.$one_image_file; |
|
197
|
|
- $image_thumbnail= $directory_thumbnails.'.'.$one_image_file; |
|
|
197
|
+ $image_thumbnail = $directory_thumbnails.'.'.$one_image_file; |
|
198
|
198
|
|
|
199
|
199
|
if (file_exists($image)) { |
|
200
|
200
|
//check thumbnail |
|
201
|
201
|
$imagetype = explode(".", $image); |
|
202
|
202
|
//or check $imagetype = image_type_to_extension(exif_imagetype($image), false); |
|
203
|
|
- $imagetype = strtolower($imagetype[count($imagetype)-1]); |
|
|
203
|
+ $imagetype = strtolower($imagetype[count($imagetype) - 1]); |
|
204
|
204
|
|
|
205
|
|
- if (in_array($imagetype,$allowed_thumbnail_types)) { |
|
206
|
|
- if (!file_exists($image_thumbnail)){ |
|
|
205
|
+ if (in_array($imagetype, $allowed_thumbnail_types)) { |
|
|
206
|
+ if (!file_exists($image_thumbnail)) { |
|
207
|
207
|
//run each once we view thumbnails is too heavy, then need move into !file_exists($image_thumbnail, and only run when haven't the thumbnail |
|
208
|
208
|
$original_image_size = api_getimagesize($image); |
|
209
|
209
|
|
|
210
|
|
- switch($imagetype) { |
|
|
210
|
+ switch ($imagetype) { |
|
211
|
211
|
case 'gif': |
|
212
|
212
|
$source_img = imagecreatefromgif($image); |
|
213
|
213
|
break; |
|
@@ -228,17 +228,17 @@ discard block |
|
|
block discarded – undo |
|
228
|
228
|
$max_thumbnail_width, |
|
229
|
229
|
$max_thumbnail_height |
|
230
|
230
|
); |
|
231
|
|
- if ($max_thumbnail_width>$original_image_size['width'] && $max_thumbnail_height>$original_image_size['height']){ |
|
232
|
|
- $new_thumbnail_size['width']=$original_image_size['width']; |
|
233
|
|
- $new_thumbnail_size['height']=$original_image_size['height']; |
|
|
231
|
+ if ($max_thumbnail_width > $original_image_size['width'] && $max_thumbnail_height > $original_image_size['height']) { |
|
|
232
|
+ $new_thumbnail_size['width'] = $original_image_size['width']; |
|
|
233
|
+ $new_thumbnail_size['height'] = $original_image_size['height']; |
|
234
|
234
|
} |
|
235
|
235
|
|
|
236
|
236
|
$crop = imagecreatetruecolor($new_thumbnail_size['width'], $new_thumbnail_size['height']); |
|
237
|
237
|
|
|
238
|
238
|
// preserve transparency |
|
239
|
|
- if ($imagetype == "png"){ |
|
|
239
|
+ if ($imagetype == "png") { |
|
240
|
240
|
imagesavealpha($crop, true); |
|
241
|
|
- $color = imagecolorallocatealpha($crop,0x00,0x00,0x00,127); |
|
|
241
|
+ $color = imagecolorallocatealpha($crop, 0x00, 0x00, 0x00, 127); |
|
242
|
242
|
imagefill($crop, 0, 0, $color); |
|
243
|
243
|
} |
|
244
|
244
|
|
|
@@ -246,7 +246,7 @@ discard block |
|
|
block discarded – undo |
|
246
|
246
|
$transindex = imagecolortransparent($source_img); |
|
247
|
247
|
$palletsize = imagecolorstotal($source_img); |
|
248
|
248
|
//GIF89a for transparent and anim (first clip), either GIF87a |
|
249
|
|
- if ($transindex >= 0 && $transindex < $palletsize){ |
|
|
249
|
+ if ($transindex >= 0 && $transindex < $palletsize) { |
|
250
|
250
|
$transcol = imagecolorsforindex($source_img, $transindex); |
|
251
|
251
|
$transindex = imagecolorallocatealpha($crop, $transcol['red'], $transcol['green'], $transcol['blue'], 127); |
|
252
|
252
|
imagefill($crop, 0, 0, $transindex); |
|
@@ -270,16 +270,16 @@ discard block |
|
|
block discarded – undo |
|
270
|
270
|
|
|
271
|
271
|
switch ($imagetype) { |
|
272
|
272
|
case 'gif': |
|
273
|
|
- imagegif($crop,$image_thumbnail); |
|
|
273
|
+ imagegif($crop, $image_thumbnail); |
|
274
|
274
|
break; |
|
275
|
275
|
case 'jpg': |
|
276
|
|
- imagejpeg($crop,$image_thumbnail,$jpg_quality); |
|
|
276
|
+ imagejpeg($crop, $image_thumbnail, $jpg_quality); |
|
277
|
277
|
break; |
|
278
|
278
|
case 'jpeg': |
|
279
|
|
- imagejpeg($crop,$image_thumbnail,$jpg_quality); |
|
|
279
|
+ imagejpeg($crop, $image_thumbnail, $jpg_quality); |
|
280
|
280
|
break; |
|
281
|
281
|
case 'png': |
|
282
|
|
- imagepng($crop,$image_thumbnail,$png_compression); |
|
|
282
|
+ imagepng($crop, $image_thumbnail, $png_compression); |
|
283
|
283
|
break; |
|
284
|
284
|
} |
|
285
|
285
|
|
|
@@ -289,26 +289,26 @@ discard block |
|
|
block discarded – undo |
|
289
|
289
|
|
|
290
|
290
|
//show thumbnail and link |
|
291
|
291
|
|
|
292
|
|
- $one_image_thumbnail_file='.thumbs/.'.$one_image_file;//get path thumbnail |
|
|
292
|
+ $one_image_thumbnail_file = '.thumbs/.'.$one_image_file; //get path thumbnail |
|
293
|
293
|
$doc_url = ($path && $path !== '/') ? $path.'/'.$one_image_thumbnail_file : $path.$one_image_thumbnail_file; |
|
294
|
294
|
$image_tag[] = '<img class="img-gallery" src="download.php?doc_url='.$doc_url.'" border="0" title="'.$one_image_file.'">'; |
|
295
|
295
|
} else { |
|
296
|
296
|
//if images aren't support by gd (not gif, jpg, jpeg, png) |
|
297
|
|
- if ($imagetype=="bmp") { |
|
|
297
|
+ if ($imagetype == "bmp") { |
|
298
|
298
|
// use getimagesize instead api_getimagesize($image); becasuse api_getimagesize doesn't support bmp files. Put here for each show, only for a few bmp files isn't heavy |
|
299
|
299
|
$original_image_size = getimagesize($image); |
|
300
|
|
- if ($max_thumbnail_width<$original_image_size[0] || $max_thumbnail_height<$original_image_size[1]){ |
|
301
|
|
- $thumbnail_size=api_calculate_image_size($original_image_size[0], $original_image_size[1], $max_thumbnail_width, $max_thumbnail_height);//don't use resize_image because doesn't run with bmp files |
|
|
300
|
+ if ($max_thumbnail_width < $original_image_size[0] || $max_thumbnail_height < $original_image_size[1]) { |
|
|
301
|
+ $thumbnail_size = api_calculate_image_size($original_image_size[0], $original_image_size[1], $max_thumbnail_width, $max_thumbnail_height); //don't use resize_image because doesn't run with bmp files |
|
302
|
302
|
$image_height = $thumbnail_size['height']; |
|
303
|
303
|
$image_width = $thumbnail_size['width']; |
|
304
|
304
|
} else { |
|
305
|
|
- $image_height=$original_image_size[0]; |
|
306
|
|
- $image_width=$original_image_size[1]; |
|
|
305
|
+ $image_height = $original_image_size[0]; |
|
|
306
|
+ $image_width = $original_image_size[1]; |
|
307
|
307
|
} |
|
308
|
308
|
} else { |
|
309
|
309
|
//example for svg files,... |
|
310
|
|
- $image_width=$max_thumbnail_width; |
|
311
|
|
- $image_height=$max_thumbnail_height; |
|
|
310
|
+ $image_width = $max_thumbnail_width; |
|
|
311
|
+ $image_height = $max_thumbnail_height; |
|
312
|
312
|
} |
|
313
|
313
|
|
|
314
|
314
|
$doc_url = ($path && $path !== '/') ? $path.'/'.$one_image_file : $path.$one_image_file; |
|
@@ -324,7 +324,7 @@ discard block |
|
|
block discarded – undo |
|
324
|
324
|
|
|
325
|
325
|
$i = 0; |
|
326
|
326
|
$count_image = count($image_tag); |
|
327
|
|
- $number_iteration = ceil($count_image/$number_image); |
|
|
327
|
+ $number_iteration = ceil($count_image / $number_image); |
|
328
|
328
|
$p = 0; |
|
329
|
329
|
$html = ''; |
|
330
|
330
|
$html .= '<div class="gallery">'; |
|
@@ -336,7 +336,7 @@ discard block |
|
|
block discarded – undo |
|
336
|
336
|
$html .= '<a class="canvas-two" href="slideshow.php?slide_id='.$p.'&curdirpath='.$pathurl.'">'; |
|
337
|
337
|
$html .= '<div class="frame">'; |
|
338
|
338
|
$html .= '<div class="photo">'; |
|
339
|
|
- $html .= $image_tag[$p]; |
|
|
339
|
+ $html .= $image_tag[$p]; |
|
340
|
340
|
$html .= '</div>'; |
|
341
|
341
|
$html .= '</div>'; |
|
342
|
342
|
$html .= '</a>'; |
|
@@ -393,7 +393,7 @@ discard block |
|
|
block discarded – undo |
|
393
|
393
|
|
|
394
|
394
|
list($width, $height) = getimagesize($image); |
|
395
|
395
|
// Auto resize |
|
396
|
|
- if (isset($_SESSION["image_resizing"]) && $_SESSION["image_resizing"] == 'resizing') { |
|
|
396
|
+ if (isset($_SESSION["image_resizing"]) && $_SESSION["image_resizing"] == 'resizing') { |
|
397
|
397
|
?> |
|
398
|
398
|
|
|
399
|
399
|
<script type="text/javascript"> |
|
@@ -410,7 +410,7 @@ discard block |
|
|
block discarded – undo |
|
410
|
410
|
start_height=initial_height; |
|
411
|
411
|
} |
|
412
|
412
|
|
|
413
|
|
- document.write('<img id="image" src="<?php echo 'download.php?doc_url='.$path.'/'.$image_files_only[$slide]; ?>" width="'+start_width+'" height="'+start_height+'" border="0" alt="<?php echo $image_files_only[$slide] ;?>">'); |
|
|
413
|
+ document.write('<img id="image" src="<?php echo 'download.php?doc_url='.$path.'/'.$image_files_only[$slide]; ?>" width="'+start_width+'" height="'+start_height+'" border="0" alt="<?php echo $image_files_only[$slide]; ?>">'); |
|
414
|
414
|
|
|
415
|
415
|
function resizeImage() { |
|
416
|
416
|
|
|
@@ -476,7 +476,7 @@ discard block |
|
|
block discarded – undo |
|
476
|
476
|
$resize_info = get_lang('Resizing').'<br />'; |
|
477
|
477
|
$resize_width = $_SESSION["image_resizing_width"].' x '; |
|
478
|
478
|
$resize_height = $_SESSION['image_resizing_height']; |
|
479
|
|
- } elseif (isset($_SESSION['image_resizing']) && $_SESSION['image_resizing'] != 'noresizing'){ |
|
|
479
|
+ } elseif (isset($_SESSION['image_resizing']) && $_SESSION['image_resizing'] != 'noresizing') { |
|
480
|
480
|
$resize_info = get_lang('Resizing').'<br />'; |
|
481
|
481
|
$resize_width = get_lang('Auto').' x '; |
|
482
|
482
|
$resize_height = get_lang('Auto'); |
|
@@ -493,7 +493,7 @@ discard block |
|
|
block discarded – undo |
|
493
|
493
|
|
|
494
|
494
|
echo $image_files_only[$slide].' <br />'; |
|
495
|
495
|
echo $width.' x '.$height.' <br />'; |
|
496
|
|
- echo round((filesize($image)/1024), 2).' KB'; |
|
|
496
|
+ echo round((filesize($image) / 1024), 2).' KB'; |
|
497
|
497
|
echo ' - '.$ext; |
|
498
|
498
|
echo '</td>'; |
|
499
|
499
|
echo '</tr>'; |