承接 soysaltan/imagify 相关项目开发

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

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

soysaltan/imagify

Composer 安装命令:

composer require soysaltan/imagify

包简介

Imagify image upload simplifier

README 文档

README

Imagify simplifies your image upload process, does not tire you.

Installation

Add JQuery and Imagify source files. (best practice)

 <link href="https://cdn.jsdelivr.net/gh/soysaltan/imagify@latest/imagify.min.css" rel="stylesheet">
<script src="https://code.jquery.com/jquery-3.4.1.js"></script>
<script src="https://cdn.jsdelivr.net/gh/soysaltan/imagify@latest/imagify.min.js"></script>

or

composer require soysaltan/imagify 

... and you are ready to go.

<div id="test"></div>
$("#test").imagify();

EVENTS

onInit (elm):

This event runs the first time the imafigy element is called and and returns the rendered element itself.

Example :

  • Background color becomes red when the div element is rendered with imagify.
<div id="test"></div>
$('#test").imagify({
            onInit: function (elm) {
             	elm.css("background-color","red");  
});

onSuccess (elm,source):

The rendered element has been attributed with data-src key

Example :

  • Log the selected image's base64 code.
$('#test").imagify({
            onSuccess: function (elm, source) {
             console.log( $("#test").attr("data-src") );
});

elm : The rendered element source : Base64 code of the selected image

onError (errorId):

Returns the errorId information for the error.

Example :

  • Background color becomes red when the div element is rendered with imagify.
$('#test").imagify({
            onError: function (errorId) {
             if (errorId==$.fn.imagify.ALLOWED_EXT_ERROR) {
			 	alert('This extension is not supported !')
			 }
});

errorId : The error id of the error information. It could be :

MAX_SIZE_ERROR = 1;
DIMENSION_ERROR = 2;
MIN_SIZE_ERROR = 3;
ALLOWED_EXT_ERROR = 4;

onDimensionError:

Fires when image dimension error occurred.

Example :

  • Fire the dimension error when the specified attributes in the html.
  <div id="test" data-max-width="640" data-max-height="960" data-min-width="640" data-min-height="960"></div>
$('#test").imagify({
            onDimensionError: function (file) {
			 	alert('Dimension error !')
});

or you can specify the attributes in the javascript side.Dimensions in px.

$('#test").imagify({
			maxWidth:  2000,
			minWidth:  1,
 		   maxHeight:  3000,
			minHeight:  1,
            onDimensionError: function (file) {
			 	alert('Dimension error !')
});

file : The selected image file element.

onMinSizeError:

Fires when minimum image size error occurred.

Example :

  • Fire the minimum image size error when the specified attributes in the html.
 <div id="test" data-max-file-size="5" data-min-file-size="1"></div>
$('#test").imagify({
            onMinSizeError: function (file) {
			 	alert('Min size error !')
});

onMaxSizeError:

Fires when maximum image size error occurred.

Example :

  • Fire the maximum size error when the specified attributes in the html.
 <div id="test" data-max-file-size="5" data-min-file-size="1"></div>
$('#test").imagify({
            onMaxSizeError: function (file) {
			 	alert('Max size error !')
});

onAllowedExtError:

Fires when image extension error occurred.

Example :

  • Fire the image extension error when the specified attributes in the html.
 <div id="test"    data-allowed-file-extensions="png jpg jpeg"></div>
$('#test").imagify({
            onAllowedExtError: function (file) {
			 	alert('This extension is not allowed. Just available for Png, Jpg or Jpeg !')
});

Default options :

style: 'border: 1px solid #ccc;',
minSize: 0, // MB
maxSize: 1, // MB
maxSizeErrorMessage: 'Imagify : Max size error !',
minSizeErrorMessage: 'Imagify : Min size error !',

maxWidth: 2000, // px
minWidth: 1, // px
maxHeight: 3000, //px
minHeight: 1, //px
dimensionErrorMessage: 'Imagify : Dimension error',

allowedExt: elm.attr('data-allowed-file-extensions') || 'jpg jpeg png',
allowedExtErrorMessage: 'Imagify : Not allowed image extension !',

showThumb: true, // show preview image
feedElement: true, // add the 'data-src' attribute to the element
chooseText: "Choose Image",
changeFileText: "Change Image",
showImageLabel: true

soysaltan/imagify 适用场景与选型建议

soysaltan/imagify 是一款 基于 JavaScript 开发的 Composer 扩展包,目前已累计 5 次下载、GitHub Stars 达 1, 最近一次更新时间为 2019 年 07 月 28 日, 在 PHP 生态内属于活跃度较高的组件。

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

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

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

BUG 修复 & 性能优化

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

项目外包 & 长期维护

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

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

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: Unknown
  • 更新时间: 2019-07-28