定制 davidkrenekcz/bannerphoto 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

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

davidkrenekcz/bannerphoto

Composer 安装命令:

composer require davidkrenekcz/bannerphoto

包简介

Banner photo management

README 文档

README

Installation

Composer requirement

composer require davidkrenekcz/bannerphoto

Package migrations

php artisan module:migrate Bannerphoto

Usage

Uploading photos

Uplaoding banner photos can be done through administration. After a photo is uploaded, you can change order of the photos by dragging them to their desired position.

Note: if your application uses silber/page-cache to cache pages, the cache is automatically cleared after upload, delete and position change.

Uploading videos

Bannerphoto is capable of playing YouTube videos. Just go to administration > Settings > Bannerphoto where you'll find a textarea to write video links. Write each video link on a new line. Once you save this setting, new videos are loaded to the end of the slider and you can delete them/change their position through admin. It is strongly recommended to use only HQ videos, because LQ videos won't have their thumbnail loaded.

Setting uploaded images size

You can set maximal size of uploaded images - settings are taken from ./config/asgard/bannerphoto/core.php (see ./Modules/Bannerphoto/Config/core.example for format)

Setting banner texts

Banner texts are also supported - head to administration > Settings > Bannerphoto, where you'll find a textarea. You can write texts for each slide there, separated by a new line. The system does not have a validation so you need to make sure you have same number of lines as photos.

Getting banner data

Photos, texts and videos

To get object of photos with their corresponding labeling text, call \Modules\Bannerphoto\Entities\BannerPhoto::bannerWithTexts() Example:

{{ print_r(\Modules\Bannerphoto\Entities\BannerPhoto::bannerWithTexts()) }}

// stdClass Object
// (
//     [0] => stdClass Object
//        (
//            [photo] => https:/example.com/modules/bannerphoto/uploads/2017-09-25-image1-1509223303-234105.jpg
//            [text] => Lorem ipsum,
//			  [video] => false	// this is not a video
//        )
//
//     [1] => stdClass Object
//        (
//            [photo] => https:/example.com/modules/bannerphoto/uploads/2016-06-28-image2-1509226117-822424.png
//            [text] => Dolor sit amet
//            [video] => "M7lc1UVf-VE" // ID of YouTube video - for usage see bellow
//        )
//
// )

Photos

To get only array of uploaded photos'/videos' thumbnails URLs call \Modules\Bannerphoto\Entities\BannerPhoto::photos() Example:

{{ print_r(\Modules\Bannerphoto\Entities\BannerPhoto::photos()) }}

// Array
// (
//    [0] => https:/example.com/modules/bannerphoto/uploads/2017-09-25-image1-1509223303-234105.jpg
//    [1] => https:/example.com/modules/bannerphoto/uploads/2016-06-28-image2-1509226117-822424.png
// )

Texts

To get only array of texts from settings, call \Modules\Bannerphoto\Entities\BannerPhoto::texts() Example:

{{ print_r(\Modules\Bannerphoto\Entities\BannerPhoto::texts()) }}

// Array
// (
//    [0] => Lorem ipsum
//    [1] => Dolor sit amet
// )

Videos

You can use BannerPhoto's views bannerphoto::frontend.video and bannerphoto::frontend.video-control to get YouTube player functionality to your slider. Example:

	@foreach($slider as $slide)
  	<div>
  		<img src="{{ $slide->photo }}">
  		@if ($slide->video)
  			@include("bannerphoto::frontend.video", [ "slide" => $slide ])
  		@endif
  	</div>
  	@endforeach
  	@include("bannerphoto::frontend.video-control")

video view creates a simple template for every video and video-control (loaded only once!) takes care of player functionality. While video is loading, thumbnail is shown and video has opacity 0. After the video is loaded, the video's opacity is set to 1 and the video is played mute in a loop. The video can't be controlled by user. You just need to ensure that you style both img thumbnail and iframe player to your webpage so that they overlay.

Warning: Videos can't be automatically played on mobile devices, therefore only thumbnail is shown.

Global $bannerPhotos variable

Removed: global variable $bannerPhotos has been removed in 1.1.0 due to speed efficiency, please use methods mentioned above

Banners are available through the whole application in $bannerPhotos variable. This variable is an array containing links to banner images ordered by position, so it could look something like this:

{{ print_r($bannerPhotos) }}

// Array
// (
//    [0] => https:/example.com/modules/bannerphoto/uploads/2017-09-25-image1-1509223303-234105.jpg
//    [1] => https:/example.com/modules/bannerphoto/uploads/2016-06-28-image2-1509226117-822424.png
// )

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2017-10-28

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固