[svn r20854] Fixed distorted picture into view of courses - partial FS#4232 (by jhp1411)

skala
Cristian Fasanando 16 years ago
parent 6766b029dc
commit 6d98e8748f
  1. 36
      main/newscorm/learnpath.class.php
  2. 16
      main/newscorm/lp_view.php

@ -8838,22 +8838,38 @@ EOD;
$new_path = $updir . '/' . $new_file_name;
//$result= @move_uploaded_file($image_array['tmp_name'], $new_path);
// resize the image
include_once (api_get_path(LIBRARY_PATH) . 'image.lib.php');
$temp = new image($image_array['tmp_name']);
$picture_infos = @ getimagesize($image_array['tmp_name']); // $picture_infos[0]-> width
if ($picture_infos[0] > 240)
$thumbwidth = 240;
else
$picture_infos=@getimagesize($image_array['tmp_name']); // $picture_infos[0]-> width
if ($picture_infos[0] > 104) {
$thumbwidth = 104;
} else {
$thumbwidth = $picture_infos[0];
if ($picture_infos[1] > 100)
$new_height = 100;
else
}
if ($picture_infos[1] > 96) {
$new_height = 96;
} else {
$new_height = $picture_infos[1];
}
//$new_height = round(($thumbwidth/$picture_infos[0])*$picture_infos[1]);
$temp->resize($thumbwidth,$new_height,0);
$type=$picture_infos[2];
$result=false;
switch ($type)
{
case 2 :
$result=$temp->send_image('JPG',$new_path);
break;
case 3 :
$result=$temp->send_image('PNG',$new_path);
break;
case 1 :
$result=$temp->send_image('GIF',$new_path);
break;
}
$temp->resize($thumbwidth, $new_height, 0);
$type = $picture_infos[2];

@ -453,20 +453,26 @@ else
<!-- end header -->
<!-- Image preview Layout -->
<div id="author_image" name="author_image" class="lp_author_image" style="height:23%; width:100%;margin-left:5px">
<div id="author_image" name="author_image" class="lp_author_image" style="height:23%; width:100%;margin-left:5px;">
<?php $image = '../img/lp_author_background.gif'; ?>
<div id="preview_image" style="padding:5px;background-image: url('../img/lp_author_background.gif');background-repeat:no-repeat;height:110px">
<div style="width:100; float:left;height:105;margin:5px">
<span>
<?php if ($_SESSION['oLP']->get_preview_image()!=''): ?>
<img width="115" height="100" src="<?php echo api_get_path(WEB_COURSE_PATH).api_get_course_path().'/upload/learning_path/images/'.$_SESSION['oLP']->get_preview_image(); ?>">
<span style="width:104px; height:96px; float:left; vertical-align:bottom;">
<center><?php if ($_SESSION['oLP']->get_preview_image()!=''): ?>
<?php
$picture = getimagesize(api_get_path(SYS_COURSE_PATH).api_get_course_path().'/upload/learning_path/images/'.$_SESSION['oLP']->get_preview_image());
if($picture['1'] < 96) $style = ' style="padding-top:'.((94 -$picture['1'])/2).'px;" ';
$size = ($picture['0'] > 104 && $picture['1'] > 96 )? ' width="104" height="96" ': $style;
$flie = api_get_path(WEB_COURSE_PATH).api_get_course_path().'/upload/learning_path/images/'.$_SESSION['oLP']->get_preview_image();
echo '<img '.$size.' src="'.$flie.'">';
?>
<?php
else
: echo Display :: display_icon('unknown_250_100.jpg', ' ');
endif;
?>
?></center>
</span>
</div>

Loading…
Cancel
Save