承接 jdz/image 相关项目开发

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

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

jdz/image

最新稳定版本:1.0.1

Composer 安装命令:

composer require jdz/image

包简介

JDZ Image utils

README 文档

README

JDZ Image Utilities is a PHP library that provides various utilities for handling images, including thumbnail creation, image protection, and more.

Installation

To install the library, use Composer:

composer require jdz/image

Requirements

PHP >= 8.1 Symfony Filesystem ^6.4 Symfony Finder ^6.4 Imagine ^1.3

Usage

*Protecting an Image

To protect an image with a watermark:

<?php
require_once realpath(__DIR__ . '/../vendor/autoload.php');

$basePath = realpath(__DIR__ . '/files/');
$coyright = new \JDZ\Image\Copyright($basePath, 'protect', 'nepascopier.png', 'repeat');
$coyright->protectImage('media/test.jpg');

*Unprotecting an Image

To remove the watermark from an image:

<?php
require_once realpath(__DIR__ . '/../vendor/autoload.php');

$basePath = realpath(__DIR__ . '/files/');
$coyright = new \JDZ\Image\Copyright($basePath, 'protect', 'nepascopier.png', 'repeat');
$coyright->unprotectImage('media/test.jpg');

*Creating a Thumbnail

To create a thumbnail of an image:

<?php
require_once realpath(__DIR__ . '/../vendor/autoload.php');

$basePath = realpath(__DIR__ . '/files/');
$thumb = new \JDZ\Image\Thumb($basePath, 200, 'thumbs', 120);
$thumb->thumbImage('media/test.jpg');

*Loading and Displaying an Image

To load and display an image with lazy loading and caching:

<?php
require_once realpath(__DIR__ . '/../vendor/autoload.php');

$basePath = realpath(__DIR__ . '/files/');
$baseUrl = 'https://mywebsite.dot/';
$thumbsFolder = 'thumbs';
$cacheTime = 60;
$thumbMaxWidth = 800;
$defaultImage = 'images/default.jpg';

$image = new \JDZ\Image\Image($basePath, $baseUrl, $thumbsFolder);
$image->lazy = true;
$image->cacheLife = $cacheTime;
$image->targetWidth = $thumbMaxWidth;
$image->load('media/test.jpg', $defaultImage);

$pic = $image->getPic('My pic');
echo (string)$pic;

I apologize for the inconvenience. Let's update the

README.md

file with the new content:

# JDZ Image Utilities

JDZ Image Utilities is a PHP library that provides various utilities for handling images, including thumbnail creation, image protection, and more.

## Installation

To install the library, use Composer:

```sh
composer require jdz/image

Requirements

  • PHP >= 8.1
  • Symfony Filesystem ^6.4
  • Symfony Finder ^6.4
  • Imagine ^1.3

Usage

Protecting an Image

To protect an image with a watermark:

require_once realpath(__DIR__ . '/../vendor/autoload.php');

$basePath = realpath(__DIR__ . '/files/');
$coyright = new \JDZ\Image\Copyright($basePath, 'protect', 'nepascopier.png', 'repeat');
$coyright->protectImage('media/test.jpg');

Unprotecting an Image

To remove the watermark from an image:

require_once realpath(__DIR__ . '/../vendor/autoload.php');

$basePath = realpath(__DIR__ . '/files/');
$coyright = new \JDZ\Image\Copyright($basePath, 'protect', 'nepascopier.png', 'repeat');
$coyright->unprotectImage('media/test.jpg');

Creating Thumbnails

To create a thumbnail for an image:

require_once realpath(__DIR__ . '/../vendor/autoload.php');

$basePath = realpath(__DIR__ . '/files/');
$thumb = new \JDZ\Image\Thumb($basePath, 200, 'thumbs', 120);
$thumb->thumbImage('media/test.jpg');

Loading and Displaying Images

To load and display an image:

require_once realpath(__DIR__ . '/../vendor/autoload.php');

$basePath = realpath(__DIR__ . '/files/');
$baseUrl = 'https://mywebsite.dot/';
$thumbsFolder = 'thumbs';
$cacheTime = 60;
$thumbMaxWidth = 800;
$defaultImage = 'images/default.jpg';

$image = new \JDZ\Image\Image($basePath, $baseUrl, $thumbsFolder);
$image->lazy = true;
$image->cacheLife = $cacheTime;
$image->targetWidth = $thumbMaxWidth;
$image->load('media/test.jpg', $defaultImage);

$pic = $image->getPic('My pic');
echo (string)$pic;

License

This project is licensed under the MIT License - see the LICENSE file for details.

Author

For more examples, see the examples directory.

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2025-01-14