Skip to content

Instantly share code, notes, and snippets.

View arrowmedia's full-sized avatar

Paul Hayler arrowmedia

View GitHub Profile
<?php
if( isset($_POST['submit']) ) {
 
include('SimpleImage.php');
$image = new SimpleImage();
$image->load($_FILES['uploaded_image']['tmp_name']);
$image->resizeToWidth(150);
$image->output();
} else {
 
<?php   /* * File: SimpleImage.php * Author: Simon Jarvis * Copyright: 2006 Simon Jarvis * Date: 08/11/06 * Link: http://www.white-hat-web-design.co.uk/articles/php-image-resizing.php * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details: * http://www.gnu.org/licenses/gpl.html * */   class SimpleImage {   var $image; var $image_type;   function load($filename) {   $image_info = getimagesize($filename); $this->image_type = $image_info[2]; if( $this->image_type == IMAGETYPE_JPEG ) {   $this->image = imagecreatefromjpeg($filename); } elseif(
System variable [[++site_name]] [[++modx_charset]] [[++base_url]] [[++site_url]] [[++assets_url]]
Resource variable [[*pagetitle]] [[*content]]
Template variables [[*tvname]]
Chunks [[$ChunkName]]
Snippet [[Snippetname?]]
Wayfinder [[Wayfinder? &startId=`0`]] uncached [[!Wayfinder? &startId=`0`]]
URL [[~id]]
@arrowmedia
arrowmedia / .htaccess
Created May 14, 2013 13:25
URL rewrite
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^([^/]*)\.html$ /index.php?page=$1 [L]
</IfModule>
ErrorDocument 404 /home.html