Skip to content

Instantly share code, notes, and snippets.

@Remiii
Created September 2, 2015 19:47
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Remiii/16caa6afc8bec6101e14 to your computer and use it in GitHub Desktop.
Save Remiii/16caa6afc8bec6101e14 to your computer and use it in GitHub Desktop.
Facebook generator

Facebook generator

Drop in photos folder your photos with firstname and lastname in title... do the following things et voila ;-)

Clean photos with ImageMagick (options)

$ for i in ./photos/*.JPG ; do convert -colorspace GRAY "$i" "${i%.*}.jpg" ; done
$ for i in ./photos/*.JPG ; do convert -resize 250 "$i" "${i%.*}.jpg" ; done

Generate Facebook

php ./facebook-generator.php > facebook.html

Author

  • Rémi Barbe (aka Remiii)
<!DOCTYPE html>
<html lang="fr">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="robots" content="noindex, nofollow" />
<meta name="generator" content="Vim, GNU/Linux" />
<meta name="author" content="Remi Barbe (aka Remiii)" />
<title>Facebook</title>
<link rel="stylesheet" href="http://netdna.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css">
<style type="text/css">
.container
{
width : 1280px !important ;
text-align : center ;
font-size : 12px ;
}
body
{
line-height : 1.26 ;
margin : 20px ;
background-color : #FFFFFF ;
}
h1
{
margin-top : 15px ;
margin-bottom : 20px ;
text-align : center ;
font-size : 24px ;
}
li
{
padding-bottom : 12px ;
}
</style>
</head>
<body>
<div class="container">
<h1>Facebook Generator</h1>
<ul class="list-inline">
<?php
$files = scandir ( './photos' ) ;
$vmFiles = array ( ) ;
foreach ( $files as $file )
{
if ( !in_array ( basename ( $file ) , array ( '.' , '..' , '.DS_Store' ) ) )
{
$vmFiles [ ] = array ( 'path' => $file , 'name' => basename ( $file , '.JPG' ) ) ;
}
}
foreach ( $vmFiles as $vmFile )
{
echo '<li><img src="./photos/' . $vmFile [ 'path'] .'" alt="' . $vmFile [ 'name' ] . '" width="125px" class="img-thumbnail"><br>' . $vmFile [ 'name' ] . '</li>' ;
}
?>
</ul>
</div>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment