Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Faker Images #118

Closed
AnthonySGeorge opened this issue Oct 12, 2017 · 2 comments
Closed

Faker Images #118

AnthonySGeorge opened this issue Oct 12, 2017 · 2 comments
Labels
Milestone

Comments

@AnthonySGeorge
Copy link

Description:
When I add Faker.Image() to the _data/data.json it creates the src link but no image.
An example src it generates is : /var/folders/7z/jk7wgm2x16l_vl_qs9r0vxmm0000gq/T/7c7e4c2e39293c4027572b87f8c3d7c6.jpg

@illepic
Copy link
Contributor

illepic commented Oct 16, 2017

Noting here @AnthonySGeorge that we're looking to address this in the v10 release and backport it to v9. Since this is PL based, you obviously won't be able to just update a dependency but we'll at least have a solution.

@illepic illepic added this to the v10 milestone Oct 16, 2017
@illepic illepic added the v9 label Oct 16, 2017
@illepic
Copy link
Contributor

illepic commented Oct 22, 2017

A follow up and answer as to what's going on:

Faker.image() let's us do two main things:

  1. It writes an image file to any path on a filesystem
  2. It let's the actual return path represent a different path

In other words, Faker.image() should let us write a file to /dist/images/random.jpg but return a value from data.json as, say, just images/random.jpg. In the current state of Pattern Lab Starter - which is based off of the Drupal Edition of Pattern Lab which in turn uses the PHP Faker plugin - this is not happening.

Captured in this issue here you'll see that the PHP Faker plugin is NOT taking any other arguments other than the first sent to it, meaning that writing a file to a filesystem works, but returning a path to Pattern Lab that is usable does not.

@AnthonySGeorge, I think you'll find that the actual image is writing to the filesystem, but it's of course at a path unusable by your running Pattern Lab.

But this does bring up a more important point: don't use Faker.image(). It will write dozens or hundreds of images to a filesystem. It also adds a lot of time to the PL compile time.

Solution: use Faker.imageUrl() instead.

@illepic illepic closed this as completed Oct 22, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants