承接 rosell-dk/webp-convert-cloud-service 相关项目开发

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

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

rosell-dk/webp-convert-cloud-service

Composer 安装命令:

composer require rosell-dk/webp-convert-cloud-service

包简介

Cloud service for converting JPEG & PNG to WebP

README 文档

README

This library allows you to set up your own WebP conversion cloud service. This way you can have a cloud converter for free. You won't have to worry about licenses expiring or being stolen and abused. And you will be completely in control of it (and downtime)

After setting up the cloud service, you will be able to use it to convert jpeg and png images into webp images. You can do that, using webp-convert, or one of its implementations, such as the Wordpress plugin, WebP Express.

Alternatively to installing this library, you could install Wordpress and the the WebP Express plugin mentioned above. WebP Express can be configured to act as a conversion service. The plugin actually uses this library to achieve that functionality.

Installation

1. Require the library with composer

composer require rosell-dk/webp-convert-cloud-service

2. Create a script, which calls the library with configuration options

Here is an example to get started with:

<?php
require 'vendor/autoload.php';

use \WebPConvertCloudService\WebPConvertCloudService;

$options = [
    // Set dir for storing converted images temporarily
    // Make sure to create that dir, with permissions for web server to write.
    // You can __DIR__ to get same dir as this script, or "dirname(__DIR__)" to get parent dir of the script,
    'destination-dir' => dirname(__DIR__) . '/conversions',

    // Set acccess restrictions
    'access' => [
        'whitelist' => [
            [
                'ip' => '*',
                'api-key' => 'my dog is white',
                'require-api-key-to-be-crypted-in-transfer' => false
            ]
        ]
    ],

    // Optionally set webp-convert options
    'webp-convert' => [
        'converters' => ['cwebp', 'gd', 'imagick'],
        'converter-options' => [
            'cwebp' => [
                'try-common-system-paths' => true,
                'try-supplied-binary-for-os' => true,
                'use-nice' => true
            ]
        ]
    ]
];

$wpc = new WebPConvertCloudService();
$wpc->handleRequest($options);
?>

3. Test if it works

You can call the API with curl. First thing you might do is to test if service is available. You can do that by asking for the api-version, as this does not require any authorization:

curl --form action="api-version" http://wpc.example.com/wpc.php

Next, you can test access. If you have set require-api-key-to-be-crypted-in-transfer to false, you can test access like this:

curl --form action="check-access" --form api-key="my dog is white" http://wpc.example.com/wpc.php

Finally, you can make a test conversion like this. First, place a file test.jpg in your current dir, then run:

curl --form action="convert" --form api-key="my dog is white" --form file=@test.jpg http://wpc.example.com/wpc.php > test.webp

If you get a corrupt file, then it is probably because the output contains an error message. To see it, run the above command again, but remove the piping of the output to a file.

You will probably not need to know more of the API. But in case you do, check out docs/api.md

Mad Scientist-ware

If you enjoy this software, feel free to conduct some secret experiments and go mad. If you like.

rosell-dk/webp-convert-cloud-service 适用场景与选型建议

rosell-dk/webp-convert-cloud-service 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 5.94k 次下载、GitHub Stars 达 54, 最近一次更新时间为 2018 年 11 月 08 日, 在 PHP 生态内属于活跃度较高的组件。

它主要适用于以下技术方向: 「images」 「gd」 「imagick」 「png」 「jpg」 「Webp」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。

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

围绕 rosell-dk/webp-convert-cloud-service 我们能提供哪些服务?
定制开发 / 二次开发

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

BUG 修复 & 性能优化

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

项目外包 & 长期维护

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

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

统计信息

  • 总下载量: 5.94k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 54
  • 点击次数: 27
  • 依赖项目数: 3
  • 推荐数: 0

GitHub 信息

  • Stars: 54
  • Watchers: 3
  • Forks: 14
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2018-11-08