Skip to content

Instantly share code, notes, and snippets.

View florentdestremau's full-sized avatar

Florent Destremau florentdestremau

View GitHub Profile
@florentdestremau
florentdestremau / create_thumb.php
Created March 17, 2015 20:58
Make an automatic thumbnail in PHP
function create_thumb($src,$dest,$desired_width = false, $desired_height = false)
{
/*If no dimenstion for thumbnail given, return false */
if (!$desired_height&&!$desired_width) return false;
$fparts = pathinfo($src);
$ext = strtolower($fparts['extension']);
/* if its not an image return false */
if (!in_array($ext,array('gif','jpg','png','jpeg'))) return false;
/* read the source image */
@florentdestremau
florentdestremau / Apache-auth
Last active August 29, 2015 14:16
Enable apache auth for websites under construction
First of all, you need uapache2-utils tools.
sudo apt-get install apache2-utils
Then you add this in your virtualhost in your <Directory> tag :
#Require all granted
# you need to comment this line above to require a valid-user
AuthName "This website is not ready to go public !"
AuthType Basic
@florentdestremau
florentdestremau / gist:59fe3568ca72943aece5
Created March 3, 2015 13:32
VirtualHost for sf2 apache 2.4+
<VirtualHost *:80>
ServerName domain.tld
ServerAlias www.domain.tld
DocumentRoot /var/www/project/web
<Directory /var/www/project/web>
# enable the .htaccess rewrites
AllowOverride All
Require all granted
</Directory>