Download the PHP package tcwei/imgsrc without Composer

On this page you can find all versions of the php package tcwei/imgsrc. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package imgsrc

安装

composer安装: composer require tcwei/imgsrc

GetImgSrc::src 单张获取(可比普通正则获取快3倍)

获取HTML字符串中的图片地址 用法示例:

use tcwei\smallTools\GetImgSrc;
$htmlStr = '这里可以是新闻等文章或者html内容';
//获取首张图片的src
$imgSrc = GetImgSrc::src($htmlStr, 1);

/**
 * 提取HTML文章中的图片地址
 * @param string $data
 * @param int $num 第 $num 个图片的src,默认为第一张
 * @param string $order 顺取倒取; 默认为 asc ,从正方向计数。 desc 从反方向计数
 * @param string|array $blacklist 图片地址黑名单,排除图片地址中包含该数据的地址;例如 传入 baidu.com  会排除 src="http://www.baidu.com/img/a.png"
 * @param string $model 默认为字符串模式;可取值 string  preg;string模式处理效率高,PHP版本越高速度越快,可比正则快几倍
 * @return false | null | src  当data为空时返回 false , src不存在时返回 null ,反之返回src
 */
public static function src($data = null, $num = 1, $order = 'asc', $blacklist = false, $model = 'string'){...

GetImgSrc::srcList 多张获取

//从第一张获取,共获取3张
$srcArr = GetImgSrc::srcList($htmlStr, 1, 3);
参数解释:

/**
  * 提取HTML文章中的图片地址
  * @param string $data HTML或者文章
  * @param int $startNum 默认为1,从第一张图片开始抽取
  * @param int $length 从 $startNum 开始抽取,共抽取 $length 张;默认为0,为0则抽取到最后
  * @param string $order 顺取倒取; 默认为 asc ,从正方向计数。 desc 从反方向计数
  * @param string|array $blacklist 图片地址黑名单,排除图片地址中包含该数据的地址;例如 传入 img.baidu.com  会排除 src="img.baidu.com/a.png"
  * @param string $model 抽取集合时,默认为正则模式;可选模式:preg  string,当 $length > 3 或者 $length = 0时,强制使用正则模式,因为取的数量大时,正则速度更快。
  * @return 图片地址的集合数组,若无则返回空数组[]
  */
public static function srcList($data, $startNum = 1, $length = 0, $order = 'asc', $blacklist = false, $model = 'preg'){

All versions of imgsrc with dependencies

PHP Build Version
Package Version
No informations.
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package tcwei/imgsrc contains the following files

Loading the files please wait ....