Jquery 插件简单的灯箱 IE 错误



我在我的网站上下载并安装了Jquery插件简单的Lightbox(http://dbrekalo.github.io/simpleLightbox/(。现在我才发现,当我上传纵向图片时,IE将图片旋转90°: 刚刚发现IE也支持插件中的所有类。 但是,如果我直接打开图片,它也会在IE中以90°角显示,但在Chrome中不正确

以前有人经历过吗?我必须在我的 Apache 服务器中更改它吗?

当然,您需要为Internet Explorer添加一些修复程序,因此执行以下操作:

onShown: function(){
if(isInternetExplorer){
$('.ekko-lightbox').addClass('iefix');
}
}
});

但是首先你需要看看为什么在 Internet Explorer 中变成 90deg,IE 应该不支持一些类,所以我建议检查 IE 中的元素,将其与 chrome 或它工作的浏览器进行比较,然后将 CSS 中的修复应用于类"iefix",然后添加具有上述代码的类。

我发现,它与服务器或CSS无关。上传的图片仍然有一些Exif数据,图片旋转了90°。 我通过将其旋转到右角并从图片中删除所有 Exif 数据来修复它:

function autoRotateImage($image) {
$orientation = $image->getImageOrientation();
switch($orientation) {
case imagick::ORIENTATION_BOTTOMRIGHT: 
$image->rotateimage("#000", 180); // rotate 180 degrees
break;
case imagick::ORIENTATION_RIGHTTOP:
$image->rotateimage("#000", 90); // rotate 90 degrees CW
break;
case imagick::ORIENTATION_LEFTBOTTOM: 
$image->rotateimage("#000", -90); // rotate 90 degrees CCW
break;
}
// Now that it's auto-rotated, make sure the EXIF data is correct in case the EXIF gets saved with the image!
$image->setImageOrientation(imagick::ORIENTATION_TOPLEFT);
}
function fixuploadedimg($image) {
autoRotateImage($image);//rotate and fix Exif rotation
$image->stripImage();//remove all EXIF data
//resize image if necessary
$xWidth = $image->getImageWidth();
$xHeight = $image->getImageHeight();
if($xWidth > 1000)
{
$image->resizeImage(1000, ($xHeight*1000/$xWidth), imagick::FILTER_GAUSSIAN, 1); 
}
else if($xHeight > 1000)
{
$image->resizeImage(($xWidth*1000/$xHeight), 1000, imagick::FILTER_GAUSSIAN, 1); 
}
$image->writeImage($uploadimg_title);
}
function get_file_extension($file_name) {
return substr(strrchr($file_name,'.'),1);
}

$img_ext_title = get_file_extension($_FILES['titelbild']['name']);
//$uploadimg_title_temp = $ordner.$foldername."/title_temp.".$img_ext_title;
$uploadimg_title = $ordner.$foldername."/title.".$img_ext_title;
if(move_uploaded_file($_FILES['titelbild']['tmp_name'], $uploadimg_title)){ 
$img_title = new Imagick($uploadimg_title);
fixuploadedimg($img_title);
$img_title->clear();
$img_title->destroy();
}
else
{
echo "upload failed";
exit();
}

最新更新