duanmu5641 2016-06-21 13:37
浏览 77

无法加载资源。 服务器错误500

I have the following code which is used as an example for a caching class from the following page

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Image Cache Test</title>
    <link href='http://fonts.googleapis.com/css?family=Open+Sans' rel='stylesheet' type='text/css'>
    <style>
        body {
            font-family: 'Open Sans', Helvetica, Arial, sans-serif;
        }
        img {
            max-width: 100%;
        }
    </style>
</head>
<body>
    <?php
        $imagecache = new ImageCache();
        $imagecache->cached_image_directory = dirname(__FILE__) . '../';
        $cached_src_one = $imagecache->cache( 'background.jpg' );
        echo '<p>Original file size: ' . filesize($imagecache->image_src) . ' bytes</p>';
        echo '<p>PHPImageCach-ified file size: ' . filesize($imagecache->cached_filename) . ' bytes</p>';
        echo '<p>Total image size reduction: ' . (((filesize($imagecache->image_src) - filesize($imagecache->cached_filename)) / filesize($imagecache->image_src))*100) . '%</p>';
    ?>
    <img src="<?php echo $cached_src_one; ?>" alt="">
    <hr>
    <?php
        $imagecache->check_link_cached = false;
        $cached_src_two = $imagecache->cache( 'background.jpg' );
        echo '<p>Original file size: ' . filesize($imagecache->image_src) . ' bytes</p>';
        echo '<p>PHPImageCach-ified file size: ' . filesize($imagecache->cached_filename) . ' bytes</p>';
        echo '<p>Total image size reduction: ' . (((filesize($imagecache->image_src) - filesize($imagecache->cached_filename)) / filesize($imagecache->image_src))*100) . '%</p>';
    ?>
    <img src="<?php echo $cached_src_two; ?>" alt="">
    <hr>
    <?php
        $cached_src_two = $imagecache->cache( 'http://placehold.it/350x350' );
        echo 'Original file size: ' . filesize($imagecache->image_src) . ' bytes<br>';
        echo 'PHPImageCach-ified file size: ' . filesize($imagecache->cached_filename) . ' bytes<br>';
        echo 'Total image size reduction: ' . (((filesize($imagecache->image_src) - filesize($imagecache->cached_filename)) / filesize($imagecache->image_src))*100) . '%';
    ?>
    <p>Because the "compressed" file size is larger than the original, a local copy of the original file will be server instead.</p>
    <img src="<?php echo $cached_src_two; ?>" alt="">

</body>
</html>

I am getting the mentioned error and not sure if it has to do something with the code. Everything is relative in terms of paths.

  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥15 数值计算均差系数编程
    • ¥15 redis-full-check比较 两个集群的数据出错
    • ¥15 Matlab编程问题
    • ¥15 训练的多模态特征融合模型准确度很低怎么办
    • ¥15 kylin启动报错log4j类冲突
    • ¥15 超声波模块测距控制点灯,灯的闪烁很不稳定,经过调试发现测的距离偏大
    • ¥15 import arcpy出现importing _arcgisscripting 找不到相关程序
    • ¥15 onvif+openssl,vs2022编译openssl64
    • ¥15 iOS 自定义输入法-第三方输入法
    • ¥15 很想要一个很好的答案或提示