承接 minicodemonkey/portrayal 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

minicodemonkey/portrayal

Composer 安装命令:

composer require minicodemonkey/portrayal

包简介

Simple, self-contained library allows you to capture screenshots of websites using PhantomJS.

README 文档

README

Build Status

Portrayal

This simple, self-contained library allows you to capture screenshots using PhantomJS.

Installation

You can install this package through Composer. Edit your project's composer.json file to require minicodemonkey/portrayal.

"require": {
	"minicodemonkey/portrayal": "~2.0"
}

You will also need to add post-install and post-update scripts to composer.json as well as a config entry to set up the phantomjs binary dependency:

"config": {
    "bin-dir": "bin"
},
"scripts": {
    "post-install-cmd": [
        "PhantomInstaller\\Installer::installPhantomJS"
    ],
    "post-update-cmd": [
        "PhantomInstaller\\Installer::installPhantomJS"
    ]
}

Now run composer update from the terminal, and you're good to go!

For more information, check out jakoch/phantomjs-installer

Usage

$capture = new \Portrayal\Capture;
$filename = $capture->snap('https://github.com/minicodemonkey/Portrayal', sys_get_temp_dir());

// $filename = /var/folders/6_/htvcfzcd4cb_w9z6bgpmnx5h0000gn/T/d0582362c2ffbf50ee119e504bb64fdc6bba5abd.png

Adjust timeout

The time in seconds to wait on the phantomjs process before giving up. The default timeout is 30s.

$capture = new \Portrayal\Capture;
$filename = $capture->setTimeout(10)
    ->snap('https://github.com/minicodemonkey/Portrayal', sys_get_temp_dir());

Adjust rendering delay

The time in seconds to wait taking the screenshot after the webpage has loaded. The default value is 0.35s (350ms).

$capture = new \Portrayal\Capture;
$filename = $capture->setRenderDelay(200)
    ->snap('https://github.com/minicodemonkey/Portrayal', sys_get_temp_dir());

Disable animations

This will inject a couple of scripts to disable CSS3 animations as well as jQuery animations. Useful for making sure that subsequent screenshots will have the same state.

$capture = new \Portrayal\Capture;
$filename = $capture->disableAnimations()
    ->snap('https://github.com/minicodemonkey/Portrayal', sys_get_temp_dir());

Change user agent

This allows you to change the HTTP User-Agent header set by the phantomjs process.

$capture = new \Portrayal\Capture;
$filename = $capture->setUserAgent('MyScreenShotApp 1.0')
    ->snap('https://github.com/minicodemonkey/Portrayal', sys_get_temp_dir());

Change browser viewport dimensions

This will change the browser viewport. Please note that this might not necessarily correspond to the exact dimensions of the screenshot. Please see https://github.com/ariya/phantomjs/issues/10619 for additional details.

$capture = new \Portrayal\Capture;
$filename = $capture->setViewPort($width = 320, $height = 480)
    ->snap('https://github.com/minicodemonkey/Portrayal', sys_get_temp_dir());

Specify a custom cookie jar

This will allow you to set specific cookies for the session, this is for example useful for retaining the cookie state across multiple requests.

$capture = new \Portrayal\Capture;
$filename = $capture->setCookiesFile('/tmp/cookies.txt')
    ->snap('https://github.com/minicodemonkey/Portrayal', sys_get_temp_dir());

minicodemonkey/portrayal 适用场景与选型建议

minicodemonkey/portrayal 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 9.35k 次下载、GitHub Stars 达 0, 最近一次更新时间为 2015 年 08 月 30 日, 在 PHP 生态内属于活跃度较高的组件。

我们在过去多个企业项目中使用过 minicodemonkey/portrayal 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。

围绕 minicodemonkey/portrayal 我们能提供哪些服务?
定制开发 / 二次开发

基于 minicodemonkey/portrayal 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。

BUG 修复 & 性能优化

线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。

项目外包 & 长期维护

承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。

yvsm@zunyunkeji.com QQ:316430983 微信:yvsm316 西安尊云信息科技 · 专注 PHP / Go / 分布式系统研发

统计信息

  • 总下载量: 9.35k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 18
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 1
  • Forks: 2
  • 开发语言: PHP

其他信息

  • 授权协议: Unknown
  • 更新时间: 2015-08-30