承接 encoda/ss-image-helpers 相关项目开发

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

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

encoda/ss-image-helpers

Composer 安装命令:

composer require encoda/ss-image-helpers

包简介

SilverStripe View Helpers module

README 文档

README

SS-image-helpers is a SilverStripe Module that provides some template methods, a.k.a., View Helpers, for image usage.

Works fine with SS-Image-Min.

Requirements

SilverStripe Framework 3.0+

Installation

Composer

Create a composer.json file:

{
    "require" : {
        "encoda/ss-image-helpers": "0.0.0"
    }
}

Navigate to your project root and run the install command.

$ composer install

Github

Navigate to the root directory of your SilverStripe application and execute git clone https://github.com/encoda/ss-image-helpers.git

Manually

Download this zip file and extract it in your SilverStripe root directory.

Usage

ImageAbsoluteUrl( string $image_file_name )

Returns the AbsoluteUrl for the Image of the given file name, starting with the application absoluteBaseURL.

  <img src="$ImageAbsoluteUrl('example.png')" />
  <!-- <img src="http://example.com/assets/images/example.png" /> -->

ImageRelativeUrl( string $image_file_name )

Returns the RelativeLink for the Image of the given file name.

  <img src="$ImageRelativeLink('example.png')" />
  <!-- <img src="assets/images/example.png" /> -->

ImageUrl( string $image_file_name )

Returns the Url for the Image of the given file name, starting with the application baseURL.

  <img src="$ImageUrl('example.png')" />
  <!-- <img src="/assets/images/example.png" /> -->

ImageTag( string $image_file_name )

Returns the html Tag for the Image of the given file name.

  $ImageTag('example.png')
  <!-- <img src="/assets/images/example.png" /> -->

Configurations

Image Paths

By default, when any of the helpers methods is used to insert an image in the template, the module searches for the image file, by its name, in the following directories:

  • assets/
  • assets/images/
  • themes/{current theme}/images/

Images out of the the Images Path are ignored by the helpers. To add new directories to the Images Path, add the following line to your _config.php.

<?php

SSImageHelpersExtension::add_image_path('my/custom/image/path/');

It also accepts multiple paths at the same time in the form of an array.

<?php

SSImageHelpersExtension::add_image_path(array(
  'path/',
  'some/image/path/',
  'some/new/image/path/',
  'and/another/image/path/',
));

License (MIT)

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2015-01-27