Skip to content

Commit

Permalink
New method
Browse files Browse the repository at this point in the history
A lightweight method added
  • Loading branch information
giekaton committed Mar 7, 2018
1 parent 4966899 commit 4d579bd
Show file tree
Hide file tree
Showing 70 changed files with 129 additions and 1 deletion.
37 changes: 37 additions & 0 deletions 1_get_logos_16x16.php
@@ -0,0 +1,37 @@
<?php

// Get data for all coins from Coinmarketcap API
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "https://files.coinmarketcap.com/generated/search/quick_search.json");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
$output = curl_exec($ch);
curl_close($ch);

// Replace quotes that might break the json decode
$output = str_replace("'", "", $output);

// Decode json data to use as a php array
$outputdecoded = json_decode($output, true);


foreach ($outputdecoded as $coin) {

// Get CMC ID
$cmcid = $coin["id"];

// Get public ID
$pubid = $coin["slug"];

echo($cmcid);
echo($pubid);

// Using the CMC ID build the link for logo
$file_url = "https://files.coinmarketcap.com/static/img/coins/16x16/" . $cmcid . ".png";

// Get file logo, rename it and save
$image = file_get_contents($file_url);
$img_path = "coins/16x16/" . $pubid . ".png";
file_put_contents($img_path, $image);
}

?>
37 changes: 37 additions & 0 deletions 1_get_logos_32x32.php
@@ -0,0 +1,37 @@
<?php

// Get data for all coins from Coinmarketcap API
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "https://files.coinmarketcap.com/generated/search/quick_search.json");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
$output = curl_exec($ch);
curl_close($ch);

// Replace quotes that might break the json decode
$output = str_replace("'", "", $output);

// Decode json data to use as a php array
$outputdecoded = json_decode($output, true);


foreach ($outputdecoded as $coin) {

// Get CMC ID
$cmcid = $coin["id"];

// Get public ID
$pubid = $coin["slug"];

echo($cmcid);
echo($pubid);

// Using the CMC ID build the link for logo
$file_url = "https://files.coinmarketcap.com/static/img/coins/32x32/" . $cmcid . ".png";

// Get file logo, rename it and save
$image = file_get_contents($file_url);
$img_path = "coins/32x32/" . $pubid . ".png";
file_put_contents($img_path, $image);
}

?>
File renamed without changes.
File renamed without changes.
33 changes: 32 additions & 1 deletion README.md

Large diffs are not rendered by default.

Binary file added coins/16x16/arcblock.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified coins/16x16/b2bx.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added coins/16x16/bezop.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed coins/16x16/bitcoin-lightning.png
Binary file not shown.
Binary file added coins/16x16/copytrack.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified coins/16x16/dadi.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added coins/16x16/experty.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified coins/16x16/funfair.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified coins/16x16/fusion.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added coins/16x16/iht-real-estate-protocol.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added coins/16x16/ink-protocol.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
File renamed without changes
Binary file added coins/16x16/lympo.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added coins/16x16/mercury-protocol.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified coins/16x16/newyorkcoin.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added coins/16x16/nucleus-vision.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added coins/16x16/poa-network.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added coins/16x16/polcoin.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added coins/16x16/refereum.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added coins/16x16/remme.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
File renamed without changes
Binary file added coins/16x16/rock.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added coins/16x16/sether.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified coins/16x16/smartlands.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
File renamed without changes
Binary file added coins/16x16/tidex-token.png
File renamed without changes
Binary file modified coins/16x16/tittiecoin.png
Binary file modified coins/16x16/trezarcoin.png
Binary file modified coins/16x16/viacoin.png
Binary file modified coins/16x16/vsync-vsx.png
Binary file removed coins/16x16/xde-ii.png
Diff not rendered.
Binary file added coins/32x32/arcblock.png
Binary file modified coins/32x32/b2bx.png
Binary file added coins/32x32/bezop.png
Binary file removed coins/32x32/bitcoin-lightning.png
Diff not rendered.
Binary file added coins/32x32/copytrack.png
Binary file modified coins/32x32/dadi.png
Binary file added coins/32x32/experty.png
Binary file modified coins/32x32/funfair.png
Binary file modified coins/32x32/fusion.png
Binary file added coins/32x32/iht-real-estate-protocol.png
Binary file added coins/32x32/ink-protocol.png
File renamed without changes
Binary file added coins/32x32/lympo.png
Binary file added coins/32x32/mercury-protocol.png
Binary file modified coins/32x32/newyorkcoin.png
Binary file added coins/32x32/nucleus-vision.png
Binary file added coins/32x32/poa-network.png
Binary file added coins/32x32/polcoin.png
Binary file added coins/32x32/refereum.png
Binary file added coins/32x32/remme.png
File renamed without changes
Binary file added coins/32x32/rock.png
Binary file added coins/32x32/sether.png
Binary file modified coins/32x32/smartlands.png
File renamed without changes
Binary file added coins/32x32/tidex-token.png
File renamed without changes
Binary file modified coins/32x32/tittiecoin.png
Binary file modified coins/32x32/trezarcoin.png
Binary file modified coins/32x32/viacoin.png
Binary file modified coins/32x32/vsync-vsx.png
Binary file removed coins/32x32/xde-ii.png
Diff not rendered.
23 changes: 23 additions & 0 deletions logos_for_github_readme.php
@@ -0,0 +1,23 @@
<?php

// Get data for all coins from Coinmarketcap API
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "https://files.coinmarketcap.com/generated/search/quick_search.json");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
$output = curl_exec($ch);
curl_close($ch);

// Replace quotes that might break the json decode
$output = str_replace("'", "", $output);

// Decode json data to use as a php array
$outputdecoded = json_decode($output, true);

// Build CMC links for each coin
foreach ($outputdecoded as $coin) {
$string .= "![". $coin["slug"] ."](https://raw.githubusercontent.com/dziungles/cryptocurrency-logos/master/coins/16x16/" . $coin["slug"] . ".png) ";
}

echo($string);

?>

0 comments on commit 4d579bd

Please sign in to comment.