Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
I
ipfs-images-php-client
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
ipfs-images
ipfs-images-php-client
Commits
609f6c88
Commit
609f6c88
authored
Sep 12, 2017
by
Dmitry Nikulin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add support for building thumbnails URL
parent
7f1cc6ae
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
39 additions
and
1 deletion
+39
-1
AttachmentsClient-AttachmentsClient.md
AttachmentsClient-AttachmentsClient.md
+17
-0
README.md
README.md
+8
-0
AttachmentsClient.php
src/AttachmentsClient.php
+14
-1
No files found.
AttachmentsClient-AttachmentsClient.md
View file @
609f6c88
...
...
@@ -52,6 +52,23 @@ Methods
### getThumbnailUrl
string AttachmentsClient\AttachmentsClient::getThumbnailUrl(string $hash, $name)
Возвращает URL для миниатюры (thumbnail) изображения.
*
Visibility:
**public**
#### Arguments
*
$hash
**string**
-
<
p
>
Хэш файла, полученный от метода загрузки.
<
/p
>
*
$name
**mixed**
### uploadFromFile
string AttachmentsClient\AttachmentsClient::uploadFromFile(string $filename)
...
...
README.md
View file @
609f6c88
...
...
@@ -68,3 +68,11 @@ echo "Download URL: $url\n";
```
$ php index.php
```
Для изображений сервер создаёт миниатюры, их URL можно получить так:
```
$thumbUrl = $client->getThumbnailUrl(
$hash, // хэш изображения, полученные от метода заливки
128 // желаемый размер миниатюры
);
```
src/AttachmentsClient.php
View file @
609f6c88
...
...
@@ -31,7 +31,20 @@ class AttachmentsClient {
* @return string
*/
public
function
getDownloadUrl
(
$hash
,
$name
)
{
return
$this
->
baseUrl
.
'/dl/'
.
$hash
.
'/'
.
$name
;
return
"
$this->baseUrl
/dl/
$hash
/
$name
"
;
}
/**
* Возвращает URL для миниатюры (thumbnail) изображения.
*
* @param string $hash Хэш файла, полученный от метода загрузки.
* @param int $size (необязательно) Размер миниатюры в пикселях, по
* умолчанию - 128
*
* @return string
*/
public
function
getThumbnailUrl
(
$hash
,
$name
)
{
return
"
$this->baseUrl
/dl/thumb/
$size
/
$hash
"
;
}
/**
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment