简体   繁体   English

Php 代码 我的图片没有显示在网站上

[英]Php code My image is no showing on website

my uploaded image are not showing on webpage.我上传的图片没有显示在网页上。

<div class="col-md-8 news-item">

<a href="<?php echo base_url('home/newsdetail/'); ?><?php echo $newsdetail[0]['id']; ?>" style="text-decoration: none; color:black;" >
        <h1><?php echo $newsdetail[0]['heading']; ?></h1>
    </a>
    <p class="author-name"><?php echo $newsdetail[0]['staffname']; ?> <span class="time"><i class="fa fa-clock-o"></i><?php echo  date("d-m-Y H:i:s",strtotime($newsdetail[0]['created_date'])); ?></span></p>
    <div class="read-img">
    <?php if($newsdetail[0]['image']==''){ ?>
        <img class="img-responsive" src="<?php echo base_url('assets/img/noimage.gif')?>" height="70"/>
        <?php } else { ?>
        <?php $multiimage=explode(",",$newsdetail[0]['image']); ?>
        <div id="jssor_1" style="position:relative;margin:0 auto;top:0px;left:0px;width:980px;height:480px;overflow:hidden;visibility:hidden;">
<!-- Loading Screen -->
<div data-u="loading" class="jssorl-009-spin" style="position:absolute;top:0px;left:0px;width:100%;height:100%;text-align:center;background-color:rgba(0,0,0,0.7);">
    <img style="margin-top:-19px;position:relative;top:50%;width:38px;height:38px;" src="//jssorcdn7.azureedge.net/theme/svg/loading/static-svg/spin.svg" />
</div>
<div data-u="slides" style="cursor:default;position:relative;top:0px;left:0px;width:980px;height:380px;overflow:hidden;">
    <?php foreach($multiimage as $imgrow){ ?>
    <div>
        <img data-u="image" src="<?php echo base_url('uploads/newsimages/'); ?><?php echo $imgrow; ?>" />
        <img data-u="thumb" src="<?php echo base_url('uploads/newsimages/'); ?><?php echo $imgrow; ?>" />
    </div>
    <?php } ?>
    </div>

First, try to print image path array.首先,尝试打印图像路径数组。 see if those are correct.看看这些是否正确。

<?php
   $multiimage=explode(",",$newsdetail[0]['image']); 
   print_r($multiimage);
?>

Then make sure those images are in the right directory.然后确保这些图像在正确的目录中。

Also for debugging purpos try printing the path if it's ok.同样为了调试目的,如果可以,请尝试打印路径。 you can check the image by simply putting the path on a browser URL.您可以通过简单地将路径放在浏览器 URL 上来检查图像。 <?php echo base_url('uploads/newsimages/').$imgrow ?>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM