satmaxt/imagebam

此包已被废弃,不再维护。未建议替代包。

imagebam API

1.0.1 2019-10-22 22:51 UTC

This package is auto-updated.

Last update: 2021-02-23 02:25:26 UTC


README

ImageBam API 实现 https://imagebam.com

https://www.imagebam.com/sys/API/clients 注册 API 客户端

功能

  • 列出画廊
  • 从画廊中列出图片
  • 上传图片

安装

使用此命令开始使用包

composer require satmaxt/imagebam

执行该命令后,接下来实现它

实现

此包的完整示例实现可以在 implementation 文件夹中找到

配置

创建一个配置文件,例如 imagebam.php

按照以下方式填写配置

<?php

$constant['API_KEY'] = 'yourkey';
$constant['API_SECRET'] = 'yoursecret';
$constant['IMAGEBAM_CACHE_PATH'] = __DIR__ . 'cache/imagebam.dat';

foreach($constant as $key => $val) {
    if( !defined($key) ) {
        define($key, $val);
    }
}

示例输出

// Get all galleries
stdClass Object
(
  [rsp] => stdClass Object
  (
    [status] => ok
    [galleries] => Array
    (
      [0] => stdClass Object
      (
        [GID] => p2jg3ul6lb4uclvxkc14tcxlgkoxjy69
        [URL] => http://www.imagebam.com/gallery/p2jg3ulxxxxx69
        [title] => 
        [description] => 
      )
      ...
    )
  )
)
// Get all images from a gallery
stdClass Object
(
  [rsp] => stdClass Object
  (
    [status] => ok
    [images] => Array
    (
      [0] => stdClass Object
      (
        [ID] => a436fe1024587234
        [URL] => http://www.imagebam.com/image/a4safwxxxxx4
        [thumbnail] => https://thumbs2.imagebam.com/8d/18/21/a4safwxxxxx4
        [GID] => gxojib0f25ashg56cdf8xxxxxxxxx
        [filename] => my.jpg
      )
    )
  )
)
// Upload Image
stdClass Object
(
  [rsp] => stdClass Object
  (
    [status] => ok
    [image] => stdClass Object
    (
      [ID] => 5b93511xsdssssss
      [URL] => http://www.imagebam.com/image/5b93511xsdssssss
      [thumbnail] => https://thumbs2.imagebam.com/4c/94/5b/5b93511xsdssssss.jpg
      [GID] => 
      [filename] => bg.jpg
    )
  )
)

版权所有 © 2019. Satmaxt 开发者. 在 Bandung 用 ❤️ & ☕ 编码