本文整理汇总了PHP中Attachment::getSizeInBytes方法的典型用法代码示例。如果您正苦于以下问题:PHP Attachment::getSizeInBytes方法的具体用法?PHP Attachment::getSizeInBytes怎么用?PHP Attachment::getSizeInBytes使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Attachment
的用法示例。
在下文中一共展示了Attachment::getSizeInBytes方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: ltrim
}
$attachmentId = (int) ltrim($attachment, " 0\t\n\r");
$attachmentObj = new Attachment($attachmentId);
if (!$attachmentObj->exists()) {
header('HTTP/1.0 404 Not Found');
echo 'Error 404: File not found';
exit;
}
header('Content-Type: ' . $attachmentObj->getMimeType());
if ($g_download == 1) {
header('Content-Disposition: ' . $attachmentObj->getContentDisposition() . '; filename="' . $attachmentObj->getFileName()) . '"';
} else {
if ($g_show_in_browser == 1) {
header('Content-Disposition: inline; filename="' . $attachmentObj->getFileName()) . '"';
} else {
if (!$attachmentObj->getContentDisposition() && strstr($attachmentObj->getMimeType(), 'image/') && (strstr($_SERVER['HTTP_ACCEPT'], $attachmentObj->getMimeType()) || strstr($_SERVER['HTTP_ACCEPT'], '*/*'))) {
header('Content-Disposition: inline; filename="' . $attachmentObj->getFileName()) . '"';
} else {
header('Content-Disposition: ' . $attachmentObj->getContentDisposition() . '; filename="' . $attachmentObj->getFileName()) . '"';
}
}
}
header('Content-Length: ' . $attachmentObj->getSizeInBytes());
$filePath = $attachmentObj->getStorageLocation();
if (file_exists($filePath)) {
readfile($filePath);
} else {
header('HTTP/1.0 404 Not Found');
echo 'Error 404: File not found';
exit;
}
示例2: htmlspecialchars
<INPUT TYPE="TEXT" NAME="f_description" VALUE="<?php
echo htmlspecialchars($attachmentObj->getDescription($f_language_selected));
?>
" class="input_text" SIZE="32" <?php
p($isReadOnly);
?>
>
</TD>
</TR>
<TR>
<TD ALIGN="RIGHT"><?php
echo $translator->trans('File Size', array(), 'article_files');
?>
:</TD>
<TD><?php
p(camp_format_bytes($attachmentObj->getSizeInBytes()));
?>
</TD>
</TR>
<TR>
<TD ALIGN="left" colspan="2" style="padding-left: 15px;"><?php
echo $translator->trans("Should this file only be available for this translation of the article, or for all translations?", array(), 'article_files');
?>
</TD>
</TR>
<TR>
<TD colspan="2" class="indent" style="padding-left: 30px;">
<INPUT type="radio" name="f_language_specific" value="yes" <?php
if ($attachmentObj->getLanguageId()) {
?>
checked<?php
示例3: putGS
<dl class="attachment">
<dt><?php
putGS('Type');
?>
:</dt>
<dd><?php
echo $object->getMimeType();
?>
</dd>
<dt><?php
putGS('Size');
?>
:</dt>
<dd><?php
echo MediaList::FormatFileSize($object->getSizeInBytes());
?>
</dd>
<?php
if ($object->getCharset()) {
?>
<dt><?php
putGS('Charset');
?>
:</dt>
<dd><?php
echo $object->getCharset();
?>
</dd>
<?php
示例4: putGS
</TR>
<TR>
<TD ALIGN="RIGHT"><?php putGS('File Name'); ?>:</TD>
<TD><?php echo htmlspecialchars($attachmentObj->getFileName()); ?> <A
HREF="/attachment/<?php p(basename($attachmentObj->getStorageLocation())); ?>"><IMG
TITLE="<?php putGS('Download'); ?>" BORDER="0" ALIGN="absmiddle" SRC="<?php p($Campsite["ADMIN_IMAGE_BASE_URL"]);?>/download.png" /></A></TD>
</TR>
<TR>
<TD ALIGN="RIGHT"><?php putGS('Description'); ?>:</TD>
<TD>
<INPUT TYPE="TEXT" NAME="f_description" VALUE="<?php echo htmlspecialchars($attachmentObj->getDescription($f_language_selected)); ?>" class="input_text" SIZE="32" <?php p($isReadOnly); ?>>
</TD>
</TR>
<TR>
<TD ALIGN="RIGHT"><?php putGS('File Size'); ?>:</TD>
<TD><?php p(camp_format_bytes($attachmentObj->getSizeInBytes())); ?></TD>
</TR>
<TR>
<TD ALIGN="left" colspan="2" style="padding-left: 15px;"><?php putGS("Should this file only be available for this translation of the article, or for all translations?"); ?></TD>
</TR>
<TR>
<TD colspan="2" class="indent" style="padding-left: 30px;">
<INPUT type="radio" name="f_language_specific" value="yes" <?php if ($attachmentObj->getLanguageId()) { ?> checked<?php } ?> <?php p($isDisabled); ?>><?php putGS("Only this translation"); ?><br>
<INPUT type="radio" name="f_language_specific" value="no" <?php if (!$attachmentObj->getLanguageId()) { ?> checked<?php } ?> <?php p($isDisabled); ?>><?php putGS("All translations"); ?>
</TD>
</TR>
<TR>
<TD ALIGN="left" colspan="2" style="padding-left: 15px;"><?php putGS("Do you want this file to open in the user's browser, or to automatically download?"); ?></TD>
</TR>
<TR>
<TD colspan="2" style="padding-left: 30px;">
示例5: putGS
<?php camp_html_display_msgs(); ?>
<div class="wrapper"><div class="main-content-wrapper">
<h2><?php echo $object->getFileName(); ?></h2>
<p class="dates"><?php putGS('Created'); ?>: <?php echo $object->getTimeCreated(); ?>, <?php putGS('Last modified'); ?>: <?php echo $object->getLastModified(); ?></p>
<?php echo new MediaPlayer($object->getAttachmentUrl() . '?g_show_in_browser=1', $object->getMimeType()); ?>
<dl class="attachment">
<dt><?php putGS('Type'); ?>:</dt>
<dd><?php echo $object->getMimeType(); ?></dd>
<dt><?php putGS('Size'); ?>:</dt>
<dd><?php echo MediaList::FormatFileSize($object->getSizeInBytes()); ?></dd>
<?php if ($object->getCharset()) { ?>
<dt><?php putGS('Charset'); ?>:</dt>
<dd><?php echo $object->getCharset(); ?></dd>
<?php } ?>
</dl>
<form name="edit" method="POST" action="do_edit-attachment.php">
<?php echo SecurityToken::FormParameter(); ?>
<input type="hidden" name="f_attachment_id" value="<?php echo $object->getAttachmentId(); ?>" />
<div class="ui-widget-content big-block block-shadow padded-strong">
<fieldset class="plain">