// Open Source Image Sharing Script // Developed by Chad Smith // Web: http://imagepng.com/ // Donate: http://imagepng.com/donate // Download: http://imagepng.com/download // Support: http://posttopic.com/topic/open-source-image-sharing-script // Twitter: chadsmith // Google Talk: chad@mktgdept.com // // Copyright (C) 2009 Chad Smith // // 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 3 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. // // You should have received a copy of the GNU General Public License // along with this program. If not, see . // // Build: 20090826222650 This script originated as a service I planned on selling, but due to the high saturation of poor quality competing services, I decided to offer it for free. I'm pleased to say it is different from other image sharing scripts in a number of ways. It has a small footprint, is written entirely in PHP, uses MySQL to store your data, is completely customizable, includes statistics on each image shared, does not require registration (but comes with it just in case), and checks to see if each image has already been shared. If you downloaded this file from another site and have not already done so, you can see the script in action at http://imagepng.com/ Here is what you need to use it: Requirements - PHP5+ w\ GD2 enabled - Apache w\ mod_rewrite enabled - MySQL Installation - Save the contents of "root" in the root folder of your server and place everything else one directory above that (so it is not accessible from the web) - Make sure the image directories "uploads", "thumbnails", and "deleted" can be to written by the owner (CHMOD 644) - Create a database for the script, and configure the settings in config.php Configuration Open config.php in your favorite text editor and change any necessary settings in the $config array: define('DB_USER','root'); define('DB_PASSWORD',''); define('DB_HOST','localhost'); define('DB_NAME','imagepng'); $basepath=dirname(dirname(__FILE__)); // location of files - use dirname(dirname( ... so files are not accessable from the web $config=array( // the settings 'username'=>array( 'min'=>4, // minumum username length allowed 'max'=>24 // maximum username length allowed ), 'password'=>array( 'min'=>5, // minumum password length allowed 'salt'=>'some random characters' // random characters for salting passwords & sessions ), 'pages'=>array( 'login'=>'/account', // login page 'signup'=>'/register', // registration page 'manage'=>'/manage', // change email page 'change'=>'/change', // change password page 'activate'=>'/activate', // activation page 'logout'=>'/logout', // logout page 'stats'=>'/stats', // stats page 'create'=>'/create' // upload page ), 'site'=>array( 'admin'=>'Your Name', // your name 'email'=>'someone@imagepng.com', // address to send new account emails from 'name'=>'My ImagePNG Site', // site name to display in emails 'tracker'=>'_png', // tracking cookie (for non-logged in users) 'cookie'=>'imagepng', // session cookie name 'remember'=>'__pml', // remember me cookie name 'build'=>'Image[PNG]: 20090826222650' ), 'folders'=>array( 'thumbnails'=>$basepath.'/thumbnails/', // name of thumbnails folder 'uploads'=>$basepath.'/uploads/', // name of uploads folder 'trash'=>$basepath.'/deleted/' // name of trash folder ) ); The sections that MUST be changed are the settings for your database: define('DB_USER','root'); define('DB_PASSWORD',''); define('DB_HOST','localhost'); define('DB_NAME','imagepng'); And the strings to the right of 'salt'=>, 'admin'=>, 'email'=>, and 'name'=> 'salt'=>'some random characters' ), ... 'site'=>array( 'admin'=>'Your Name', // your name 'email'=>'someone@imagepng.com', // address to send new account emails from 'name'=>'My ImagePNG Site', // site name to display in emails ... Be sure you only change the right side, as the keys on the left are coded into the script. The rest of the settings can be changed too, such as the cookies and names of the folders, but it is not necessary. Basic Usage Once all files are uploaded and directories created you can begin sharing images. The script will automatically set up the database tables the first time they are needed. Images are converted to .png and will be assigned a short address (similar to TinyURL or TwitPic) where they can be viewed. Once uploaded, the script tracks the number of times an image is viewed and where the viewer came from (Twitter, Facebook, Direct, etc..). Captions can be added to each image by the person who uploaded it by typing where it says "Add Caption" and pushing enter. Additional features include duplicate image detection, deletion of images, and protection against SQL injection. This is an image sharing script as opposed to image hosting, so images CAN NOT be displayed directly on other sites. It takes a ton of resources to operate a viable image hosting service such as photobucket or tinypic, so if that's your goal this script is not for you. Contents deleted - folder for storing deleted images root css style.css - stylesheet used on imagepng.com images bg.png - background image used on imagepng.com logo-trans.png - ImagePNG logo upload.png - fancy upload image includes templates body footer.php - main footer header.php - main header list.php - template for the "Your Images" list email (templates for all the emails sent out) activation.php - activation/welcome message sent when a new user registers change-password.php - message to the user when they want to recover their password confirm-email.php - message to the user when they change their email address html-dtd.php - valid xhtml 1.0 for html e-mails (can be modified to effect all emails) login-notification.php - message to the site admin when a user logs in (can be turned off in extend.php) new-image.php - message to the site admin when a new image is uploaded (can be turned off in extend.php) signup-notification.php - message to the site admin when a new user registers (can be turned off in extend.php) forms (templates for all the forms) caption.php - image caption form change-email.php - change email form change-password.php - new password form login.php - login form recover-password.php - password recovery form signup.php - the registration form upload.php - the upload form pages (page templates, wrapped in header & footer) account.php - template for all the account related pages image.php - template for the image page index.php - template for the main page page stats.php - template for the statistics page common.php - modified from phpMyLogin - common functions db.functions.php - the database class, standalone at ezdb.org extend.php - modified from phpMyLogin - set of plugin & notification functions functions.php - from phpMyLogin - the main functions for the login system plugin.functions.php - from phpMyLogin - functions for action handling and plugins (borrowed from wordpress) js init.js - calls jQuery and the other necessary files run.js - main javascript file upload.js - Ajax (one click) upload plugin .htaccess - .htaccess file config.php - the config file which includes all the other functions index.php - the main file which calls the script and all the pages thumbnails - folder for storing thumbnails uploads - folder for storing the images CHANGELOG - list of version changes COPYING - license details README - the thing you're reading ImagePNG features - It's FREE - Image sharing using PHP and MySQL - Template system for complete customization - Session nonces to deter spam and hotlinking - Secured against XSS and SQL Injection - Valid XHTML 1.0 Strict - One click uploads - Duplicate image detection - Viewer statistics Other Let me know if you come up with any bugs or questions. Additional features are already in progress, such as commenting, and OpenID, Twitter, Facebook and OAuth authentication. Geo statistics are included on imagepng.com, but were removed while I investigate the Geo-IP database license. You are free to use the script in any way you please, however donations are appreciated, especially for commercial use or if require support. This script is not to be repackaged and sold as is.