Skip to content

Commit

Permalink
Merge pull request #11 from xefi/images-extension
Browse files Browse the repository at this point in the history
✨ Image extension
  • Loading branch information
GautierDele authored Nov 18, 2024
2 parents 35a8856 + adeb6f1 commit c4bb70f
Show file tree
Hide file tree
Showing 4 changed files with 36 additions and 4 deletions.
4 changes: 2 additions & 2 deletions app/app.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,11 +41,11 @@ export default defineAppConfig({
title: 'Table of Contents',
bottom: {
title: 'Community',
edit: 'https://github.com/lomkit/laravel-rest-api-doc/edit/master/content',
edit: 'https://github.com/xefi/faker-doc/edit/main/content',
links: [{
icon: 'i-heroicons-star',
label: 'Star on GitHub',
to: 'https://github.com/lomkit/laravel-rest-api',
to: 'https://github.com/xefi/faker-php',
target: '_blank'
}]
}
Expand Down
4 changes: 2 additions & 2 deletions app/app.vue
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ useHead({
useSeoMeta({
titleTemplate: `%s - ${seo?.siteName}`,
ogSiteName: seo?.siteName,
ogImage: 'https://docs-template.nuxt.dev/social-card.png',
twitterImage: 'https://docs-template.nuxt.dev/social-card.png',
ogImage: 'https://faker-php.xefi.com/social-card.png',
twitterImage: 'https://faker-php.xefi.com/social-card.png',
twitterCard: 'summary_large_image'
})
Expand Down
32 changes: 32 additions & 0 deletions content/2.extensions/images.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
---
title: Images
description: Images extension for Xefi Faker PHP
---

## Requirement

This extension is not included with the base faker php package, you'll need to require it:

```bash
composer require --dev xefi/faker-php-images
```

## Image

Returns a [Image](https://github.com/Intervention/image/blob/develop/src/Image.php) object from the intervention/image package ([documentation](https://image.intervention.io/v3)).

Example : ![1280 x 720 example](/img/images-extension-1280x720.png)

```php
$faker->image(width: 1280, height: 720, backgroundColor: '#cccccc', textColor: '#333333', text: 'My Placeholder text');

// Examples for saving the image
$image = $faker->image();
$image->toPng()->save('images/foo.png');
```

## Image URL

```php
$faker->imageUrl(width: 1280, height: 720); // https://placehold.co/1280x720
```
Binary file added public/img/images-extension-1280x720.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit c4bb70f

Please sign in to comment.