On Mon, 30 May 2011 14:20:53 +0900 Daniel Juyung Seo <[email protected]> said:
use shot module :) > How can I use this shot.php page? > > Daniel Juyung Seo (SeoZ) > > On Sat, May 28, 2011 at 5:15 PM, Enlightenment SVN > <[email protected]> wrote: > > Log: > > hmm fix up shot.php to work on e.org > > > > > > > > Author: raster > > Date: 2011-05-28 01:15:06 -0700 (Sat, 28 May 2011) > > New Revision: 59769 > > Trac: http://trac.enlightenment.org/e/changeset/59769 > > > > Modified: > > trunk/web/www/shot.php > > > > Modified: trunk/web/www/shot.php > > =================================================================== > > --- trunk/web/www/shot.php 2011-05-28 07:40:15 UTC (rev 59768) > > +++ trunk/web/www/shot.php 2011-05-28 08:15:06 UTC (rev 59769) > > @@ -1,19 +1,38 @@ > > <?php > > -$data = file_get_contents('php://input'); > > -#ff d8 ff e0 > > +ob_start(); > > +############ limit - 6 mb. > > +$data = file_get_contents('php://input', NULL, NULL, 0, 6 * 1024 * 1024); > > +############ magic jpeg signature > > $jpeg_match = "\xff\xd8\xff\xe0"; > > $jpeg_magic = substr($data, 0, 4); > > -#89 50 4e 47 > > +############ magic png signature > > $png_match = "\x89\x50\x4e\x47"; > > $png_magic = substr($data, 0, 4); > > + > > +############ base on signaure, add file extension > > $ext = ".unknown"; > > if ($jpeg_match == $jpeg_magic) $ext = ".jpg"; > > else if ($png_match == $png_magic) $ext = ".png"; > > +############ not a correct matching file - abort > > +else { > > + echo "bzzt"; > > + ob_end_flush(); > > + die(); > > +} > > + > > +############ get a unique name > > $dest = uniqid("e-", true) . $ext; > > +############ store the file > > $fh = fopen("/var/www/download/shots/".$dest, 'wb'); > > fwrite($fh, $data); > > fclose($fh); > > +############ prepare url to get file from > > +$loc = "http://www.enlightenment.org/ss/" . $dest; > > + > > +############ respond! > > +header("HTTP/1.1 200 OK"); > > +header("Content-Type: text/plain"); > > +header("X-Enlightenment-Service: Pants On"); > > +print $loc; > > +ob_end_flush(); > > ?> > > -<?php > > - echo "http://www.enlightenment.org/ss/" . $dest; > > -?> > > > > > > ------------------------------------------------------------------------------ > > vRanger cuts backup time in half-while increasing security. > > With the market-leading solution for virtual backup and recovery, > > you get blazing-fast, flexible, and affordable data protection. > > Download your free trial now. > > http://p.sf.net/sfu/quest-d2dcopy1 > > _______________________________________________ > > enlightenment-svn mailing list > > [email protected] > > https://lists.sourceforge.net/lists/listinfo/enlightenment-svn > > > > ------------------------------------------------------------------------------ > vRanger cuts backup time in half-while increasing security. > With the market-leading solution for virtual backup and recovery, > you get blazing-fast, flexible, and affordable data protection. > Download your free trial now. > http://p.sf.net/sfu/quest-d2dcopy1 > _______________________________________________ > enlightenment-devel mailing list > [email protected] > https://lists.sourceforge.net/lists/listinfo/enlightenment-devel > -- ------------- Codito, ergo sum - "I code, therefore I am" -------------- The Rasterman (Carsten Haitzler) [email protected] ------------------------------------------------------------------------------ vRanger cuts backup time in half-while increasing security. With the market-leading solution for virtual backup and recovery, you get blazing-fast, flexible, and affordable data protection. Download your free trial now. http://p.sf.net/sfu/quest-d2dcopy1 _______________________________________________ enlightenment-devel mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/enlightenment-devel
