/** * This function calculates the resized width and resized heigt according to the source and target widths * and heights, height so that no distortions occur * parameters * $image = the absolute path to the image * $target_width = how large do you want your resized image * $target_height = how large do you want your resized image * $slideshow (default=0) = indicates weither we are generating images for a slideshow or not, t * this overrides the $_SESSION["image_resizing"] a bit so that a thumbnail * view is also possible when you choose not to resize the source images */ function resize_image($image, $target_width, $target_height, $slideshow = 0) { // Modifications by Ivan Tcholakov, 04-MAY-2009. $result = array(); if (isset($_SESSION['image_resizing']) && $_SESSION['image_resizing'] == 'resizing' or $slideshow == 1) { $new_sizes = api_resize_image($image, $target_width, $target_height); $result[] = $new_sizes['height']; $result[] = $new_sizes['width']; } else { $size = api_getimagesize($image); $result[] = $size['height']; $result[] = $size['width']; } return $result; }
echo api_get_js('jquery.js'); echo $style; ?> <body> <?php echo '<h2>' . get_lang('Course') . ': ' . $course_info['name'] . '</h2>'; if (!empty($png_svg_files)) { echo '<h3>' . get_lang('SelectSVGEditImage') . '</h3>'; echo '<ul>'; foreach ($png_svg_files as $filename) { $image = $disk_path . $filename; if (strpos($filename, "svg")) { $new_sizes['width'] = 60; $new_sizes['height'] = 60; } else { $new_sizes = api_resize_image($image, 60, 60); } echo '<li style="display:inline; padding:8px;"><a href="' . $web_path . $filename . '" alt "' . $filename . '" title="' . $filename . '"><img src="' . $web_path . $filename . '" width="' . $new_sizes['width'] . '" height="' . $new_sizes['height'] . '" border="0"></a></li>'; } echo '</ul>'; } else { Display::display_warning_message(get_lang('NoSVGImagesInImagesGalleryPath')); } ?> </body> <script> $('a').click(function() { var href = this.href; // Convert Non-SVG images to data URL first // (this could also have been done server-side by the library)