无法在我的网页上显示从PHP中的FTP服务器获取的图像

时间:2018-03-06 10:01:13

标签: php jquery wordpress image-uploading

我无法在我的页面上查看图像,我尝试从FTP获取图像,但我无法查看图像。我已创建本地FTP并从本地服务器获取图像并制作图像库,并在上传文件夹中使用多个复选框传输图像后,但这次我无法在网页上查看我的图像,我是php的新手。

    <?php
    $qt_folder_name = 'images'; // change this to a folder of your choice for images
            $qt_handle = opendir( dirname( realpath( __FILE__ ) ) . '/' . $qt_folder_name . '/' );

/* ========================================================================== */
/* ========================================================================== */
/*                                    FTP LOGIC                                   */


/* ========================================================================== */

            $qt_counter = 0;



            while( $qt_file = readdir( $qt_handle ) ) :

                if( $qt_file !== '.' && $qt_file !== '..' ) :

                    $qt_counter++;

                    $qt_file_path = $qt_folder_name . '/' . $qt_file;

                    ?>
<!-- ======================================================================= -->                    
          <?php
           $exp=  explode('!',$qt_file);
           ?>
<!-- ======================================================================= -->

                    <div class="qt-photo-gallery-item qt-image-no-<?php echo $qt_counter; ?>">
                        <a class="qt-photo-gallery-item-link" href="<?php echo $qt_file_path; ?>"title="<?php echo $exp[0]."\n".$exp[1]; ?><?php //echo $qt_file;?>">

                            <div class="qt-photo-gallery-item-image-wrapper">

                                <img src="<?php echo $qt_file_path; ?>" class="qt-photo-gallery-item-image" />
                                <p class="title_name"><?php echo $exp[0]."\n".$exp[1]; ?></p>
                            </div>


                        </a>
                    </div>

<!-- ======================================================================= -->

                    <?php

                    if( $qt_counter == 5 ) {
                        $qt_counter = 0;
                    }

                endif;

            endwhile;

/* ========================================================================== */

            ?>

1 个答案:

答案 0 :(得分:0)

乍一看,它看起来像img src =你正在引用文件系统中的图像路径而不是网站的索引目录,这可能会导致问题。