<?php
namespace PHPImageWorkshop\Core;
use PHPImageWorkshop\Exif\ExifOrientations;
use PHPImageWorkshop\ImageWorkshop as ImageWorkshop;
use PHPImageWorkshop\Core\ImageWorkshopLib as ImageWorkshopLib;
use PHPImageWorkshop\Core\Exception\ImageWorkshopLayerException as ImageWorkshopLayerException;
/**
* ImageWorkshopLayer class
*
* This class represents a layer that contains a background image and can be edited
*
* @link http://phpimageworkshop.com
* @author Sybio (Clément Guillemain / @Sybio01)
* @license http://en.wikipedia.org/wiki/MIT_License
* @copyright Clément Guillemain
*/
class ImageWorkshopLayer
{
// ===================================================================================
// Properties
// ===================================================================================
/**
* @var int
*
* Width of the group model
* Default: 800
*/
protected $width;
/**
* @var int
*
* Height of the group model
* Default: 600
*/
protected $height;
/**
* @var self[]
*
* Layers (and groups)
*/
public $layers;
/**
* @var int[]
*
* Levels of the sublayers in the stack
*/
protected $layerLevels;
/**
* @var array
*
* Positions (x and y) of the sublayers in the stack
*/
protected $layerPositions;
/**
* @var int
*
* Id of the last indexed sublayer in the stack
*/
protected $lastLayerId;
/**
* @var int
*
* The highest sublayer level
*/
protected $highestLayerLevel;
/**
* @var resource
*
* Background Image
*/
protected $image;
/**
* @var array
*
* Exif data
*/
protected $exif;
/**
* @var string
*/
const UNIT_PIXEL = 'pixel';
/**
* @var string
*/
const UNIT_PERCENT = 'percent';
/**
* @var integer
*/
const ERROR_GD_NOT_INSTALLED = 1;
/**
* @var integer
*/
const ERROR_PHP_IMAGE_VAR_NOT_USED = 2;
/**
* @var integer
*/
const ERROR_FONT_NOT_FOUND = 3;
/**
* @var integer
*/
const METHOD_DEPRECATED = 4;
/**
* @var integer
*/
const ERROR_NEGATIVE_NUMBER_USED = 5;
/**
* @var integer
*/
const ERROR_NOT_WRITABLE_FOLDER = 6;
/**
* @var integer
*/
const ERROR_NOT_SUPPORTED_FORMAT = 7;
/**
* @var integer
*/
const ERROR_UNKNOW = 8;
// ===================================================================================
// Methods
// ===================================================================================
// Magicals
// =========================================================
/**
* Constructor
*
* @param resource $image
*/
public function __construct($image, array $exif = array())
{
if (!extension_loaded('gd')) {
throw new ImageWorkshopLayerException('PHPImageWorkshop requires the GD extension to be loaded.', static::ERROR_GD_NOT_INSTALLED);
}
if (gettype($image) != 'resource' && gettype($image) != '\resource') {
throw new ImageWorkshopLayerException('You must give a php image var to initialize a layer.', static::ERROR_PHP_IMAGE_VAR_NOT_USED);
}
$this->width = imagesx($image);
$this->height = imagesy($image);
$this->image = $image;
$this->exif = $exif;
$this->layers = $this->layerLevels = $this->layerPositions = array();
$this->clearStack();
}
/**
* Clone method: use it if you want to reuse an existing ImageWorkshop object in another variable
* This is important because img resource var references all the same image in PHP.
* Example: $b = clone $a; (never do $b = $a;)
*/
public function __clone()
{
$this->createNewVarFromBackgroundImage();
}
// Superimpose a sublayer
// =========================================================
/**
* Add an existing ImageWorkshop sublayer and set it in the stack at a given level
* Return an array containing the generated sublayer id in the stack and its corrected level:
* array("layerLevel" => integer, "id" => integer)
*
* $position: http://phpimageworkshop.com/doc/22/corners-positions-schema-of-an-image.html
*
* @param int $layerLevel
* @param ImageWorkshopLayer $layer
* @param int $positionX
* @param int $positionY
* @param string $position
*
* @return array
*/
public function addLayer($layerLevel, $layer, $positionX = 0, $positionY = 0, $position = 'LT')
{
return $this->indexLayer($layerLevel, $layer, $positionX, $positionY, $position);
}
/**
* Add an existing ImageWorkshop sublayer and set it in the stack at the highest level
* Return an array containing the generated sublayer id in the stack and the highest level:
* array("layerLevel" => integer, "id" => integer)
*
* $position: http://phpimageworkshop.com/doc/22/corners-positions-schema-of-an-image.html
*
* @param ImageWorkshopLayer $layer
* @param int $positionX
* @param int $positionY
* @param string $position
*
* @return array
*/
public function addLayerOnTop($layer, $positionX = 0, $positionY = 0, $position = 'LT')
{
return $this->indexLayer($this->highestLayerLevel + 1, $layer, $positionX, $positionY, $position);
}
/**
* Add an existing ImageWorkshop sublayer and set it in the stack at level 1
* Return an array containing the generated sublayer id in the stack and level 1:
* array("layerLevel" => integer, "id" => integer)
*
* $position: http://phpimageworkshop.com/doc/22/corners-positions-schema-of-an-image.html
*
* @param ImageWorkshopLayer $layer
* @param int $positionX
* @param int $positionY
* @param string $position
*
* @return array
*/
public function addLayerBelow($layer, $positionX = 0, $positionY = 0, $position = 'LT')
{
return $this->indexLayer(1, $layer, $positionX, $positionY, $position);
}
// Move a sublayer inside the stack
// =========================================================
/**
* Move a sublayer on the top of a group stack
* Return new sublayer level if success or false otherwise
*
* @param int $layerId
* @return mixed
*/
public function moveTop($layerId)
{
return $this->moveTo($layerId, $this->highestLayerLevel, false);
}
/**
* Move a sublayer to the level 1 of a group stack
* Return new sublayer level if success or false otherwise
*
* @param int $layerId
*
* @return mixed
*/
public function moveBottom($layerId)
{
return $this->moveTo($layerId, 1, true);
}
/**
* Move a sublayer to the level $level of a group stack
* Return new sublayer level if success or false if layer isn't found
*
* Set $insertUnderTargetedLayer true if you want to move the sublayer under the other sublayer at the targeted level,
* or false to insert it on the top of the other sublayer at the targeted level
*
* @param int $layerId
* @param int $level
* @param boolean $insertUnderTargetedLayer
*
* @return mixed
*/
public function moveTo($layerId, $level, $insertUnderTargetedLayer = true)
{
// if the sublayer exists in stack
if ($this->isLayerInIndex($layerId)) {
$layerOldLevel = $this->getLayerLevel($layerId);
if ($level < 1) {
$level = 1;
$insertUnderTargetedLayer = true;
}
if ($level > $this->highestLayerLevel) {
$level = $this->highestLayerLevel;
$insertUnderTargetedLayer = false;
}
没有合适的资源?快使用搜索试试~ 我知道了~
群多多社群人脉H5_优化采集等功能
共714个文件
js:254个
png:178个
php:147个
1.该资源内容由用户上传,如若侵权请联系客服进行举报
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
版权申诉
5星 · 超过95%的资源 4 下载量 142 浏览量
2022-03-16
14:34:22
上传
评论
收藏 14.33MB ZIP 举报
温馨提示
群多多是一款非常棒的折扣社交购物平台,用户在这里能学习到很多薅羊毛的技巧,超全的品类和海量的优惠券让你彻底爱上它,更有免单群,抢购群等你加入,是一款购物神器
资源推荐
资源详情
资源评论
收起资源包目录
群多多社群人脉H5_优化采集等功能 (714个子文件)
index.css 80KB
simplepro.css 67KB
colorui_h5.css 62KB
b.dialog.bootstrap3.css 40KB
b.dialog.css 40KB
index.css 23KB
common.css 8KB
jquery.contextMenu.css 4KB
poster.css 2KB
index.html_zAG4JE.tar.gz 2KB
setting.html 18KB
qr_list.html 17KB
set_poster.html 13KB
card_list.html 13KB
qr_list_caiji.html 13KB
sea_qr_list.html 12KB
ad_list.html 9KB
tousulist.html 9KB
set_system.html 8KB
set_vip.html 6KB
kami.html 6KB
user_list.html 6KB
set_saler.html 6KB
userinfo.html 5KB
set_pay.html 5KB
qrtype.html 5KB
set_ad.html 5KB
user_list.html 5KB
1userinfo.html 4KB
set_chongzhi.html 4KB
saler_list.html 4KB
cardinfo.html 4KB
contactstype.html 4KB
set_clubcard.html 3KB
set_theme.html 3KB
withdraw_paycode_form.html 3KB
index.html 3KB
slider_post.html 3KB
kami_form_saler.html 3KB
kami_form_vip.html 3KB
financelist.html 3KB
index.html 3KB
111index.html 3KB
qrcate_post.html 3KB
set_subscribe.html 3KB
withdraw_form.html 3KB
withdraw_list.html 3KB
cat_slider_post.html 3KB
home.html 3KB
set_tag.html 2KB
home.html 2KB
qrcate_list.html 2KB
set_nav.html 2KB
kami_tocreate.html 2KB
cat_slider_list.html 2KB
slider_list.html 2KB
tellist.html 2KB
set_share.html 2KB
setting.html 2KB
set_fuckwx.html 1KB
set_tpl.html 1KB
set_help.html 1KB
set_qrtype.html 1KB
set_agree.html 1KB
404.html 456B
fuckwx.html 372B
form.html 265B
common.html 137B
welcome.html 78B
index.html 1B
index.html 1B
homeBg.jpg 525KB
bg.jpg 444KB
image2.jpg 170KB
share-900-2.jpg 164KB
image1.jpg 158KB
image5.jpg 139KB
image3.jpg 130KB
image4.jpg 122KB
head_top.e7c0795e.jpg 103KB
head_top.jpg 103KB
banner-def.jpg 65KB
erweima.jpg 54KB
vip_banner.jpg 52KB
guanzhu.jpg 49KB
P13LZ5vdKg9L6779M8173FlGrw51lu.jpg 47KB
preview.jpg 45KB
icon.jpg 45KB
preview.jpg 45KB
icon.jpg 45KB
kefu_ex.jpg 28KB
pxOZBJ8aN58xbJmaaRmjjAUboZFGT4.jpg 22KB
pxOZBJ8aN58xbJmaaRmjjAUboZ5J5O.jpg 20KB
timg.jpg 14KB
168.40e486ff.jpg 8KB
168.jpg 8KB
default.jpg 7KB
manImg.jpg 6KB
manImg.6d281cde.jpg 6KB
avatar.jpg 2KB
共 714 条
- 1
- 2
- 3
- 4
- 5
- 6
- 8
资源评论
- 晓斌吖2023-04-06非常有用的资源,可以直接使用,对我很有用,果断支持!
- qq_551722242022-07-04资源内容总结的很到位,内容详实,很受用,学到了~
- Microsofty2023-04-22超赞的资源,感谢资源主分享,大家一起进步!
- luqixun2023-12-04资源很实用,内容详细,值得借鉴的内容很多,感谢分享。
智慧浩海
- 粉丝: 1w+
- 资源: 5172
下载权益
C知道特权
VIP文章
课程特权
开通VIP
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功