beryllium/icelus 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

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

beryllium/icelus

Composer 安装命令:

composer require beryllium/icelus

包简介

Thumbnail generator for Sculpin-based websites

README 文档

README

Build Status SensioLabsInsight

Icelus enables your Sculpin-based websites and blogs to generate space and bandwidth-saving thumbnails of images.

Icelus, otherwise known as "Scaled Sculpin", are a genus of small fish mainly found in the North Pacific.

Requirements

Icelus requires:

  • PHP 8.5+
  • PHP Composer
  • Imagick or Gd extension (installable via apt-get, pecl, pie, homebrew, macports, or yum)

Installation

You can run composer require beryllium/icelus to get things rolling.

Once the library is installed, you have to tell Sculpin how to load it. You can do this by creating or modifying the app/SculpinKernel.php file to resemble the following:

<?php

class SculpinKernel extends \Sculpin\Bundle\SculpinBundle\HttpKernel\AbstractKernel
{
    protected function getAdditionalSculpinBundles(): array
    {
        return array(
            \Beryllium\Icelus\IcelusBundle::class,
        );
    }
}

Note: The class name should be either the class constant (shown above) or a string, not an object instantiation.

Configuration

Generally, no additional configuration is required. If you want to rename the output subfolder for thumbnails (default is 'yourblog.com/_thumbs'), add this to app/config/sculpin_kernel.yml:

icelus:
    prefix: '/_thumbs'
  • icelus.prefix : A subdirectory under the Sculpin output directory to store the thumbnails. Default is '/_thumbs'.

Usage

Icelus exposes a thumbnail function in Twig, which you can use either on its own or by creating Twig macros to customize the output.

thumbnail(image, width, height, crop)

  • image (string): The relative path to the image in the source/ folder.
  • width (int): Maximum width, in pixels
  • height (int): Maximum height, in pixels
  • crop (bool): False will fit the whole image inside the provided dimensions. True will crop the image from the center. Default: FALSE

Note: The crop setting currently only works with the Imagick loader, which has built-in support. Gd allows cropping and many other advanced operations, but implementing them is more challenging.

Inline Example:

<a href="image.jpg"><img src="{{ thumbnail('image.jpg', 100, 100) }}"></a>

Macro Example:

index.html:

{% import '_macros.html.twig' as m %}

<h1>Gone Fishin'!</h1>
{{ m.small_thumbnail('image.jpg', 'A picture from my fishing trip') }}


_macros.html.twig: 

{% macro small_thumbnail(image, caption) %}
  <a href="{{ image }}">
    <img src="{{ thumbnail(image, 100, 100) }}">
    <br>
    <em>{{ caption }}</em>
  </a>
{% endmacro %}

A service called icelus.service is also added to the Sculpin dependency injection container, which you can use in your own Sculpin extensions.

Future Plans

I would like for Icelus to expose more features of the underlying image processing libraries, particularly with regard to watermarks and drawing text onto images.

Thanks

Special thanks to Beau Simensen, for inviting me into the Sculpin organization, and to Erika Heidi for the ease-of-use of the original Imanee library that worked for many years.

beryllium/icelus 适用场景与选型建议

beryllium/icelus 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 405 次下载、GitHub Stars 达 9, 最近一次更新时间为 2015 年 03 月 05 日, 在 PHP 生态内属于活跃度较高的组件。

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

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

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

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

BUG 修复 & 性能优化

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

项目外包 & 长期维护

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

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

统计信息

  • 总下载量: 405
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 9
  • 点击次数: 22
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 9
  • Watchers: 3
  • Forks: 5
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2015-03-05