小编Jus*_*ell的帖子

PhpPresentation imagecreatefromstring():数据不是可识别的格式 - PHP7.2

我正在尝试使用PhpPresentation sample.pptx在他们的文档中使用读者的简单说明来阅读文件,我得到:

imagecreatefromstring(): Data is not in a recognized format

我已经检查过我安装了PHP7.2-gd以及所有其他依赖项.

我的代码:

require_once 'vendor/autoload.php';

use \PhpOffice\PhpPresentation\PhpPresentation;
use \PhpOffice\PhpPresentation\IOFactory;
use \PhpOffice\PhpPresentation\Style\Color;
use \PhpOffice\PhpPresentation\Style\Alignment;

$oReader = IOFactory::createReader('PowerPoint2007');
$data = $oReader->load(__DIR__ . '/sample.pptx');
var_dump($data);
Run Code Online (Sandbox Code Playgroud)

任何人都可以帮我理解这个问题吗?

php phppresentation

8
推荐指数
1
解决办法
707
查看次数

在将字符串操作到AttributedString之后调整元素 - Swift 4

我有以下内容允许我创建一个非常有效的项目符号列表,但是,在创建项目符号列表后,我需要操纵输出的属性字符串以使某些元素以粗体或斜体或两者都有.

我的功能是:

@IBOutlet var label: UILabel!
let bulletString = ["String 1","String 2","String 3"]

label.attributedText = label.bulletPoints(stringList: bulletString, font: UIFont.stdFontMediumSeventeen, bullet: "•", lineSpacing: 4, paragraphSpacing: 4, textColor: UIColor.darkGreyColor, bulletColor: UIColor.darkGreyColor)

func bulletPoints(stringList: [String],font: UIFont,bullet: String = "\u{2022}",indentation: CGFloat = 20,lineSpacing: CGFloat = 2,paragraphSpacing: CGFloat = 12,textColor: UIColor = .gray,bulletColor: UIColor = .red) -> NSAttributedString{
    let textAttributes: [NSAttributedStringKey: Any] = [NSAttributedStringKey.font: font, NSAttributedStringKey.foregroundColor: textColor]
    let bulletAttributes: [NSAttributedStringKey: Any] = [NSAttributedStringKey.font: font, NSAttributedStringKey.foregroundColor: bulletColor]

    let paragraphStyle = NSMutableParagraphStyle()
    let nonOptions = [NSTextTab.OptionKey: Any]() …
Run Code Online (Sandbox Code Playgroud)

ios swift

6
推荐指数
1
解决办法
305
查看次数

TCPDF 浏览器弹出标题

编辑

根据@Will 的建议,这里是一个简化的问题......

我可以在 TCPDF PDF Creator 文件 (example_003.php) 中使用标签将浏览器标题设置为 php 文件的完整 URL 以外的任何内容吗?

我在很多其他事情中尝试过这个,但它似乎没有播放。

$pdf->SetCreator(PDF_CREATOR);
$pdf->SetAuthor('Author');
$pdf->SetTitle('Title');
$pdf->SetSubject('Subject');
$pdf->SetKeywords('Keywords');
$pdf->setHeaderData($ht='Browser Title?');
Run Code Online (Sandbox Code Playgroud)

任何帮助都会很棒,谢谢

php tcpdf

5
推荐指数
1
解决办法
3073
查看次数

microtime到标准日期格式

我有一些自epoch以来毫秒的值,即microtime(true)在我的MySQL数据库中这些值作为字符串我需要将它们转换为标准的PHP日期()

$updated = 1349697975.9381;
$nUpdated = date($updated, "l jS F \@\ g:i a");
Run Code Online (Sandbox Code Playgroud)

这是一个空白字符串,有人帮忙吗?

php date milliseconds microtime

5
推荐指数
1
解决办法
1万
查看次数

Firefox ::after 伪元素不起作用

我有一个 CSS 类,它在标题后输出一行

在此处输入图片说明

这适用于 Safari 和 Chrome,但在 Firefox 中没有出现该行。

我的代码:

.sidebar h2 {
    color: #f7f7f7;
    width: 100%;
    font-size: 24px;
    position: relative;
}

.sidebar h2 span {
    background-color: #40d1b0;
    padding-right: 2px;
}
.sidebar h2::after {
    content:"";
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 0.22em;
    border-top: 1px solid rgba(0,0,0,0.10);
    z-index: -1;
}

<h2><span>Show</span></h2>
Run Code Online (Sandbox Code Playgroud)

容器 div 有一个类 Sidebar

编辑

根据要求使用 JSFiddle

http://jsfiddle.net/jerswell/Lxsmt96k/

html css firefox

5
推荐指数
1
解决办法
5037
查看次数

MySQL多重插入查询不存在的地方

更新并回答@ypercube的感谢和信任

答案如下,我已经冒昧发布它,因为它出现在我的PHP有一个帮手,我正在使用PDO

    INSERT INTO `users_relationship` (`profile_1_id`, `profile_2_id` ,`request_date`,`auth_token`,`status`, `updated`, `deleted`)
    VALUES
        (:uid, :fid, '$now', '$fToken', 0, '$now',0),
        (:fid, :uid, '$now', '$fToken', 0, '$now',0)
    ON DUPLICATE KEY UPDATE request_date = VALUES(request_date), auth_token = VALUES(auth_token), updated = VALUES(updated), deleted = VALUES (deleted);
Run Code Online (Sandbox Code Playgroud)

我有一个令我困惑的MySQL查询,要求是我需要一次创建一个表中的行但是这些行可能已经存在,所以我需要更新这一行中的一些列而不是插入重复.

Justin(2)与Ben(5)相关,然后通过更新profile_1_id为2或5的数据库中的行并在已删除列中插入标志来终止关系.Ben然后尝试重新启动关系,因此我们需要再次更新行并删除已删除的标志并更新request_date,auth_token并使用新值更新.

我写了以下内容,但它没有触发错误:

重复列名称'2012-09-05 10:13:06'

INSERT INTO `users_relationship` (`profile_1_id`, `profile_2_id`,`request_date`,`auth_token`,`status`, `updated`, `deleted`)
    SELECT * FROM 
        (SELECT 2, 5, '2012-09-05 10:13:06', 'SQLTEST', 0, '2012-09-05 10:13:06', 0) AS faTmp,
        (SELECT 5, 2, '2012-09-05 10:13:06', 'SQLTEST', 0, '2012-09-05 10:13:06', 0) AS fTmp …
Run Code Online (Sandbox Code Playgroud)

mysql sql entity-relationship

4
推荐指数
1
解决办法
4483
查看次数

Blueimp Jquery文件上传S3和调整大小

我正在使用Blueimp/jQuery-File-Uploader和可用的Amazon S3插件,所有这些都很好但是我需要调整我的图像大小不要超过或低于640px的最短边.

我目前的代码是

   global $s3;
    if (isset($_REQUEST['_method']) && $_REQUEST['_method'] === 'DELETE') {
        return "";
    }
    $upload = isset($_FILES['files']) ? $_FILES['files'] : null;
    $info = array();
    if ($upload && is_array($upload['tmp_name'])) {
        foreach($upload['tmp_name'] as $index => $value) {
            $fileTempName = $upload['tmp_name'][$index];

            $file_name = (isset($_SERVER['HTTP_X_FILE_NAME']) ? $_SERVER['HTTP_X_FILE_NAME'] : $upload['name'][$index]);
            $extension=end(explode(".", $file_name));
            $rand = rand(1,100000000);
            $sha1 = sha1($rand);
            $md5 = md5($sha1);
            $filename = substr($md5, 0, 8);
            $fileName=$filename.".".$extension;    

            $fileName = $prefix.str_replace(" ", "_", $fileName);
            $response = $s3->create_object($bucket, $fileName, array('fileUpload' => $fileTempName, 'acl' => …
Run Code Online (Sandbox Code Playgroud)

php jquery amazon-s3 imagick blueimp

4
推荐指数
1
解决办法
2042
查看次数

CSS - 按钮边框渐变

经过广泛搜索后,我陷入了如何在 CSS 中复制此按钮的问题,特别是边框,因为如果可能的话,我将在其他元素上使用它。

\n

设计好的按钮

\n

带有右上角渐变边框的按钮

\n

\r\n
\r\n
button.rounded-button {\n    box-sizing: border-box;\n    display: flex;\n    flex-direction: row;\n    justify-content: center;\n    align-items: center;\n    padding: 1.125rem 2rem;\n    \n    position: absolute;\n    width: 13.5919rem;\n    height: 4.375rem;\n    \n    background: rgba(255, 255, 255, 0.1);\n    backdrop-filter: blur(0.7942rem);\n\n    border-radius: 5.8652rem;\n    border-image-slice: 1 1 0 0;\n    border: 1px solid;\n    border-image-source: linear-gradient(257.34deg, #FFFFFF 4.56%, rgba(255, 255, 255, 0) 29.19%);\n    \n    font-size: 1.25rem;\n    line-height: 2.125rem;\n    color: #fff;\n}\n\nbody {\n    background: #393939;\n}
Run Code Online (Sandbox Code Playgroud)\r\n
<!-- SVG Not included with the example -->\n<button type="button" class="rounded-button">\n  Watch …
Run Code Online (Sandbox Code Playgroud)

html css

4
推荐指数
1
解决办法
2883
查看次数

PHP数组以逗号分隔列表

我有一个数据库中的项目列表正在解析数组

Array
(
    [0] => Array
        (
            [dToken] => 731fea87ea9dc61f16e93f1ad2b964bf1926633acac151c1853ab91ea0465228
            [0] => 731fea87ea9dc61f16e93f1ad2b964bf1926633acac151c1853ab91ea0465228
        )

    [1] => Array
        (
            [dToken] => d890a5002f7da8bd35f6cae50e597d6f11554b26ba686bc7314afe77d1b36a61
            [0] => d890a5002f7da8bd35f6cae50e597d6f11554b26ba686bc7314afe77d1b36a61
        )

)
Run Code Online (Sandbox Code Playgroud)

我需要获取所有dTokens并将它们列在一个变量中,每个dToken用逗号分隔,除了列表中的最后一个.

foreach($result as $device['dToken'] => $token){
    //$devices = $token['dToken'];
    print_r($token['dToken']);
}
Run Code Online (Sandbox Code Playgroud)

有什么帮助吗?

php csv arrays

3
推荐指数
1
解决办法
8484
查看次数

HTML5 音频标签 - 在位置开始和结束

我的<audio>代码中有许多标签,我想知道是否有一种方法可以将每个标签设置为具有自定义开始结束位置,因为它们都加载相同的文件。

这应该在没有用户交互的情况下发生。实际上,我需要部署和<audio>标记并拥有类似的东西data-start="04.22" data-end="09.45"

html javascript html5-audio

3
推荐指数
1
解决办法
5060
查看次数