Skip to content

Commit 65862e3

Browse files
committed
fixes
1 parent 9390bf8 commit 65862e3

File tree

3 files changed

+35
-5
lines changed

3 files changed

+35
-5
lines changed

demo/index.php

+28-2
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,32 @@
44

55
include __DIR__.'/../vendor/autoload.php';
66

7+
$options = [
8+
'min_image_width' => 100,
9+
'min_image_height' => 100,
10+
'images_blacklist' => null,
11+
'choose_bigger_image' => true,
12+
13+
'html' => [
14+
'max_images' => 10,
15+
'external_images' => false
16+
],
17+
18+
'oembed' => [
19+
'parameters' => [],
20+
'embedly_key' => null,
21+
'iframely_key' => null,
22+
],
23+
24+
'google' => [
25+
'key' => null,
26+
],
27+
28+
'soundcloud' => [
29+
'key' => null,
30+
],
31+
];
32+
733
function getUrl()
834
{
935
if (!isset($_GET['url'])) {
@@ -200,7 +226,7 @@ function printCode($code, $asHtml = true)
200226

201227
<?php
202228
try {
203-
$info = Embed\Embed::create(getUrl());
229+
$info = Embed\Embed::create(getUrl(), $options);
204230
} catch (Exception $exception) {
205231
echo '<p>'.$exception->getMessage().'</p>';
206232
echo '</section>';
@@ -255,7 +281,7 @@ function printCode($code, $asHtml = true)
255281
<table>
256282
<?php foreach ($info->getDispatcher()->getAllResponses() as $response): ?>
257283
<tr>
258-
<th><?= $response->getUri() ?></th>
284+
<th><?= $response->getUrl() ?></th>
259285
</tr>
260286
<tr>
261287
<td><?php printHeaders($response->getHeaders()); ?></td>

tests/AbstractTestCase.php

+4
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,10 @@ protected function assertEmbed($url, array $info, array $config = [])
5252
$this->assertString($value, $i->$name);
5353
break;
5454

55+
case 'images':
56+
$this->assertCount($value, $i->$name);
57+
break;
58+
5559
case 'code':
5660
if ($value === true) {
5761
$this->assertNotEmpty($value);

tests/HtmlProviderTest.php

+3-3
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ public function testAllowExternalImages()
99
$this->assertEmbed(
1010
'http://www.brothers-brick.com/2016/04/06/stunning-lego-darth-vader-mask-cleverly-hides-scenes-from-star-wars/',
1111
[
12-
'image' => 'https://i1.wp.com/farm2.staticflickr.com/1629/25975785880_114d1bce41_z.jpg?resize=625%2C416&ssl=1',
12+
'images' => 9,
1313
],
1414
[
1515
'html' => [
@@ -24,7 +24,7 @@ public function testNotAllowExternalImages()
2424
$this->assertEmbed(
2525
'http://www.brothers-brick.com/2016/04/06/stunning-lego-darth-vader-mask-cleverly-hides-scenes-from-star-wars/',
2626
[
27-
'image' => '',
27+
'images' => 2,
2828
],
2929
[
3030
'html' => [
@@ -39,7 +39,7 @@ public function testAllowSomeExternalImages()
3939
$this->assertEmbed(
4040
'http://www.brothers-brick.com/2016/04/06/stunning-lego-darth-vader-mask-cleverly-hides-scenes-from-star-wars/',
4141
[
42-
'image' => 'https://i1.wp.com/farm2.staticflickr.com/1629/25975785880_114d1bce41_z.jpg?resize=625%2C416&ssl=1',
42+
'images' => 4,
4343
],
4444
[
4545
'html' => [

0 commit comments

Comments
 (0)