通过我的图片托管网站的管理员,我有一个页面,我可以提取所有上传的图像。问题是,我认为它正试图将它们全部拉出来并使该站点崩溃超过5分钟。我怎样才能限制什么负载?我试图看看如何编写用户库脚本(因为它一次只加载15个左右,然后单击一个按钮来加载更多) - 但没有运气。
我想一次限制到50个。
<?php require_once 'header.php'; ?>
<div class="well">
<h1><?=_('Pictures Administration') ?></h1>
<?php require_once 'admin-navigation.php'; ?><?php
if(count($pictures)) {
?>
<table class="table-bordered table-hover table-striped table-sortable table-condensed">
<thead>
<tr>
<th> </th>
<th><?=_('Title') ?></th>
<th><?=_('User') ?></th>
<th><?=_('Date') ?></th>
<th><?=_('Views') ?></th>
<th><?=_('Server') ?></th>
<th><?=_('Remove') ?></th>
</tr>
</thead>
<?php
foreach($pictures as $p) {
$user = ($p->username == NULL) ? 'Guest' : $p->username;
$image_main = $p->image_name;
$image_title = htmlentities($p->image_title, ENT_QUOTES);
$image_path = image_path($p);
$image_size = getimagesize($image_path);
if($image_size[0] > 124) {
$thumbnail = str_replace("original", "thumbnail", $image_path);
}else{
$thumbnail = $image_path;
}
?>
<tr>
<td>
<a href="<?=SITE_URL ?>/view-image/<?=$image_main ?>" target="_blank">
<img alt="" src="<?=$thumbnail ?>" /> </a></td>
<td><?php echo $image_title ?></td>
<td><?php if($user != 'Guest') : ?>
<a href="<?=SITE_URL ?>/user-gallery/<?=$p->username ?>" target="_blank">
<?=$p->username ?></a><?php else: ?>Guest <?php endif; ?></td>
<td><?=date("jS F Y", $p->image_date) ?></td>
<td><?=$p->image_views ?></td>
<td><?=$p->server ?></td>
<td>
<a href="<?=SITE_URL ?>/admin-pictures?remove=<?=$p->imageID ?>">
<b class="icon-remove-sign"></b></a></td>
</tr>
<?php
}
?>
</table>
<?php
}else{
echo _("No pictures yet!");
}
?></div>
<?php require_once 'footer.php'; ?>