为画廊弹出轮播实时获取价值

时间:2017-02-10 22:03:52

标签: javascript php html

第一:我只使用cms进行用户友好的维护(客户端),然后在网站上我通过php工作。

所以我在创建一个画廊的过程中一切都很好,直到我需要弹出窗口(灯箱)才能启动。我得到所有图像并阅读它们exif_orientation所以我可以纠正它(这很有效)。

我的问题是我需要将我的方向值(可能是$ _POST ???)实时发送到magnific-popup(lighbox)的.css。

注意:将.css更改为.php

<link rel="stylesheet" href="vendor/magnific-popup/magnific-popup.min.php">

并使用

更正了.css(now.php)
<?php header("Content-type: text/css; charset: UTF-8"); ?>

所以我在gallery.php上有什么:

<div class="container">

<?php
if(!empty($row_GALERIAS['slideimagenspost'])){
?>

<div class="row">   

    <ul class="portfolio-list lightbox m-none" data-plugin-options='{"delegate": "a.lightbox-portfolio", "type": "image", "gallery": {"enabled": true}}'>

        <?php
         $anexos = json_decode($row_GALERIAS['slideimagenspost'], true);
         $n=0;

        foreach($anexos as $anexo){ 

        //obtains the path were the image is alocated
        $path = $URL_IMAGENS.'/'.$anexo['filename'];

        //obtains the name of the image
        $filename = basename($path); // $file is set to "xxxxx.php"

        //starts the exif work
        $exif = exif_read_data($path,  0, true);
        $orientation = array();
        foreach( $exif as $key => $value) {
            $orientation[] = $value['Orientation'];
        }
        $orientation = $orientation[2];

        ?>

        <li class="col-md-3 col-sm-6 col-xs-12">

            <div class="portfolio-item">
                <a href="<?php echo $URL_IMAGENS ?>/<?php echo $anexo['filename'] ?>" class="lightbox-portfolio" >
                    <span class="thumb-info thumb-info-lighten thumb-info-centered-icons">
                        <span class="thumb-info-wrapper">                            
                            <img src="<?php echo $URL_IMAGENS ?>/<?php echo $anexo['filename'] ?>" class="img-responsive" alt="<?php echo utf8_encode($row_GALERIAS['title']) ?>" 
                              <?php if($orientation == "3"){echo'style="transform:rotate(180deg);"';} 
                                      elseif($orientation == "6"){echo'style="transform:rotate(90deg);"';}
                                      elseif($orientation == "8"){echo 'style="transform:rotate(270deg);"';} 
                              ?> 
                             >
                            <!--this part corrects the image in the galery BEFORE calling the popup (working well) i just need to send the value of $orientation
                to the ".css" of the lightbox in real time-->                            
                        </span>
                    </span>
                </a>
            </div>
        </li>

        <?php 
         }
        $n++;
        ?>

    </ul>
</div>

<?php
} else { echo '';}
?>

在我的magnific-popup.min.css(现在是magnific-popup.min.php)文件中:

<?php header("Content-type: text/css; charset: UTF-8"); ?>

img.mfp-img {
  box-sizing: border-box;
  padding: 40px 0;
  margin: 0 auto;
  <?php if($var_value == "3"){echo'transform: rotate(180deg);';} 
  elseif($var_value == "6"){echo'transform: rotate(90deg);';} 
  elseif($var_value == "8"){echo 'transform: rotate(270deg);';} 
  //working completly fine if i force values into $val_value, just need it to correspond with the $orientation from gallery.php 
?>    
}

0 个答案:

没有答案