Skip to content

Commit

Permalink
Merge branch 'release/1.10.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
rvdsteege committed Sep 23, 2022
2 parents 8064e21 + 1c0715f commit 3afb0e6
Show file tree
Hide file tree
Showing 1,404 changed files with 7,144 additions and 1,395 deletions.
11 changes: 10 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,15 @@ All notable changes to this project will be documented in this file.
This projects adheres to [Semantic Versioning](http://semver.org/) and [Keep a CHANGELOG](http://keepachangelog.com/).

## [Unreleased][unreleased]
-
- Removed Payvision logos.
- Removed Sisow logos.

## [1.10.0] - 2022-09-23
- Added icons.
- Updated tooling.
- Updated to new Pay. branding.
- Removed Payvision logo (pronamic/wp-pronamic-pay-payvision#1).
- Removed Sisow logo.

## [1.9.0] - 2022-08-18
- Added plugin icons.
Expand Down Expand Up @@ -107,6 +115,7 @@ This projects adheres to [Semantic Versioning](http://semver.org/) and [Keep a C
- First release.

[unreleased]: https://github.com/wp-pay/logos/compare/1.8.3...HEAD
[1.10.0]: https://github.com/pronamic/wp-pay-logos/compare/1.9.0...1.10.0
[1.8.3]: https://github.com/wp-pay/logos/compare/1.8.2...1.8.3
[1.8.2]: https://github.com/wp-pay/logos/compare/1.8.1...1.8.2
[1.8.1]: https://github.com/wp-pay/logos/compare/1.8.0...1.8.1
Expand Down
32 changes: 16 additions & 16 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -65,16 +65,6 @@ The `max-width` of the actual logo is `512` and the `max-height` is `288`.

## Requirements

### svgcleaner

```
brew install svgcleaner
```

- https://formulae.brew.sh/formula/svgcleaner
- https://github.com/RazrFalcon/svgcleaner


### pngquant

```
Expand Down Expand Up @@ -102,13 +92,23 @@ bin/toolbox all
```

```
bin/toolbox all --dir=src/methods/maestro
bin/toolbox all --dir=src/methods/mastercard
bin/toolbox all --path=methods/maestro
bin/toolbox all --path=methods/mastercard
```

## Other libraries

After Pronamic launched this pay logos libraries a number of other (Dutch) payment providers have followed our example:

| Date | Repository |
| ---- | ---------- |
| 2020-02-25 | https://github.com/pronamic/wp-pay-logos |
| 2020-03-30 | https://github.com/MultiSafepay/MultiSafepay-icons |
| 2020-06-19 | https://github.com/paynl/payment-images |

## Resources

* https://brand.mastercard.com/brandcenter/other-marks.html
* https://brand.mastercard.com/brandcenter/mastercard-brand-mark/downloads.html
* https://en.wikipedia.org/wiki/Box-drawing_character
* https://en.wikipedia.org/wiki/Arrow_(symbol)
- https://brand.mastercard.com/brandcenter/other-marks.html
- https://brand.mastercard.com/brandcenter/mastercard-brand-mark/downloads.html
- https://en.wikipedia.org/wiki/Box-drawing_character
- https://en.wikipedia.org/wiki/Arrow_(symbol)
210 changes: 49 additions & 161 deletions bin/toolbox
Original file line number Diff line number Diff line change
Expand Up @@ -13,33 +13,58 @@ use Symfony\Component\Finder\Finder;
$application = new Application( 'WordPress Pay Logos', '1.0.0' );

$application
->register( 'svg-png' )
->addOption(
'dir',
'd',
InputOption::VALUE_REQUIRED,
'Directory to scan for SVG files.',
__DIR__ . '/../src/'
)
->register( 'all' )
->addOption(
'tool',
't',
'path',
'p',
InputOption::VALUE_REQUIRED,
'Tool to convert SVG to PNG.',
'Inkscape'
'Path to scan for files.',
''
)
->setCode( function( InputInterface $input, OutputInterface $output ) {
$tool = $input->getOption( 'tool' );
$application = $this->getApplication();

$path = $input->getOption( 'path' );

$filesystem = new Filesystem();

$dir_cwd = new SplFileInfo( getcwd() );
$dir_src = new SplFileInfo( __DIR__ . '/../src/' . $path );
$dir_dist = new SplFileInfo( __DIR__ . '/../dist/' . $path );

$path_src = $filesystem->makePathRelative( $dir_src->getRealPath(), $dir_cwd->getRealPath() );
$path_dist = $filesystem->makePathRelative( $dir_dist->getRealPath(), $dir_cwd->getRealPath() );

/**
* Synchronize.
*/
$command = sprintf(
'rsync --delete --archive --include "*/" --include="*.svg" --exclude="*" --exclude="src-*" %s %s',
$path_src,
$path_dist
);

$extension = '.svgcleaner-min.svg';
echo $command, PHP_EOL;

$dir = new SplFileInfo( $input->getOption( 'dir' ) );
passthru( $command );

/**
* SVGO.
*/
$command = 'svgo --recursive --folder ' . $path_dist;

echo $command, PHP_EOL;

passthru( $command );

/**
* SVG to PNG.
*/
$finder = new Finder();

$finder->in( $dir->getRealPath() )->files()->name( '*' . $extension );
$finder->in( $dir_dist->getRealPath() )->files()->name( '*.svg' );

foreach ( $finder as $file ) {
foreach ( $finder as $file ) {
echo $file->getRealPath(), PHP_EOL;

$filename = $file->getFilename();
Expand All @@ -59,8 +84,6 @@ $application
$width = $matches['width'];
$height = $matches['height'];

$info = new SplFileInfo( $file->getRealPath() );

$densities = array(
'1' => (object) array(
'factor' => 1,
Expand All @@ -81,7 +104,7 @@ $application
);

foreach ( $densities as $density ) {
$png = $info->getPath() . '/' . $info->getBasename( $extension ) . $density->extension;
$png = $file->getPath() . '/' . $file->getBasename( '.' . $file->getExtension() ) . $density->extension;

$w = $width * $density->factor;
$h = $height * $density->factor;
Expand All @@ -96,162 +119,27 @@ $application

echo $command, PHP_EOL;

if ( 'ImageMagick' === $tool ) {
$command = sprintf(
'convert -background transparent -resize %dx%d %s %s',
$w,
$h,
$file->getRealPath(),
$png
);

echo $command, PHP_EOL;
}

if ( 'SVG Converter' === $tool ) {
$command = sprintf(
'rsvg-convert -w %d -h %d %s -o %s',
$w,
$h,
$file->getRealPath(),
$png
);

echo $command, PHP_EOL;
}

passthru( $command );
}
}
} );

$application
->register( 'png-min' )
->addOption(
'dir',
'd',
InputOption::VALUE_REQUIRED,
'Directory to scan for SVG files.',
__DIR__ . '/../src/'
)
->setCode( function( InputInterface $input, OutputInterface $output ) {
$filesystem = new Filesystem();

/**
* PNG compressor.
*/
$finder = new Finder();

$dir = new SplFileInfo( $input->getOption( 'dir' ) );

$dir_src = new SplFileInfo( __DIR__ . '/../src/' );
$dir_dist = new SplFileInfo( __DIR__ . '/../dist/' );

$finder->in( $dir->getRealPath() )->files()->name( '*.png' );
$finder->in( $dir_dist->getRealPath() )->files()->name( '*.png' );

foreach ( $finder as $file ) {
$relative = $filesystem->makePathRelative( $file->getRealPath(), $dir_src->getRealPath() );
$relative = rtrim( $relative, '/' );

$output = $dir_dist->getRealPath() . '/' . $relative;

$command = sprintf(
'pngquant %s --output %s --force',
$file->getRealPath(),
$output
'pngquant %s --ext=.png --force',
$file->getRealPath()
);

echo $command, PHP_EOL;

passthru( $command );
}
} );
$application
->register( 'svg-min' )
->addOption(
'dir',
'd',
InputOption::VALUE_REQUIRED,
'Directory to scan for SVG files.',
__DIR__ . '/../src/'
)
->setCode( function( InputInterface $input, OutputInterface $output ) {
$filesystem = new Filesystem();

$finder = new Finder();

$dir = new SplFileInfo( $input->getOption( 'dir' ) );

$dir_src = new SplFileInfo( __DIR__ . '/../src/' );
$dir_dist = new SplFileInfo( __DIR__ . '/../dist/' );

$finder->in( $dir->getRealPath() )->files()->name( '*.svg' )->notName( 'src-*' )->notName( '*.svgcleaner-min.svg' );

foreach ( $finder as $file ) {
$relative = $filesystem->makePathRelative( $file->getRealPath(), $dir_src->getRealPath() );
$relative = rtrim( $relative, '/' );

$output = $dir_dist->getRealPath() . '/' . $relative;

$command = sprintf(
'svgo %s --output %s',
$file->getRealPath(),
$output
);

echo $command, PHP_EOL;

passthru( $command );
}
} );

$application
->register( 'svgcleaner' )
->addOption(
'dir',
'd',
InputOption::VALUE_REQUIRED,
'Directory to scan for SVG files.',
__DIR__ . '/../src/'
)
->setCode( function( InputInterface $input, OutputInterface $output ) {
$finder = new Finder();

$dir = new SplFileInfo( $input->getOption( 'dir' ) );

$dir_src = new SplFileInfo( __DIR__ . '/../src/' );
$dir_dist = new SplFileInfo( __DIR__ . '/../dist/' );

$finder->in( $dir_src->getRealPath() )->files()->name( '*.svg' )->notName( 'src-*' )->notName( '*.svgcleaner-min.svg' );

foreach ( $finder as $file ) {
$output = $file->getPath() . '/' . $file->getBasename( '.' . $file->getExtension() ) . '.svgcleaner-min.svg';

$command = sprintf(
'svgcleaner %s %s',
$file->getRealPath(),
$output
);

echo $command, PHP_EOL;

passthru( $command );
}
} );

$application
->register( 'all' )
->addOption(
'dir',
'd',
InputOption::VALUE_REQUIRED,
'Directory to scan for files.',
__DIR__ . '/../src/'
)
->setCode( function( InputInterface $input, OutputInterface $output ) {
$application = $this->getApplication();

$application->find( 'svgcleaner' )->run( $input, $output );
$application->find( 'svg-min' )->run( $input, $output );
$application->find( 'svg-png' )->run( $input, $output );
$application->find( 'png-min' )->run( $input, $output );
} );

$application->run();
Loading

0 comments on commit 3afb0e6

Please sign in to comment.