Hmmm...jackpf wrote:The only thing I've ever made in flash is an animation of someone shooting them self in the head
is it as much fun as this toy I made ten years ago?
http://www.shutterbugclub.com/tax.html
Moderator: General Moderators
Hmmm...jackpf wrote:The only thing I've ever made in flash is an animation of someone shooting them self in the head

Groovy... Away we go !jackpf wrote:Yes
Code: Select all
function get_image_sizes($"/a_website/a_dir/images/uploads/11.jpg",
$maxResizeWidth, $maxResizeHeight) {
Code: Select all
function get_image_sizes($sourceImageFilePath,
$maxResizeWidth, $maxResizeHeight) {
// Get the width and height of the original image
$size = getimagesize($sourceImageFilePath);
if($size === FALSE) return FALSE; // Error condition
$origWidth = $size[0];
$origHeight = $size[1];
// Change dimensions to fit maximum width and height
$resizedWidth = $origWidth;
$resizedHeight = $origHeight;
if($resizedWidth > $maxResizeWidth) {
$aspectRatio = $maxResizeWidth / $resizedWidth;
$resizedWidth = round($aspectRatio * $resizedWidth);
$resizedHeight = round($aspectRatio * $resizedHeight);
}
if($resizedHeight > $maxResizeHeight) {
$aspectRatio = $maxResizeHeight / $resizedHeight;
$resizedWidth = round($aspectRatio * $resizedWidth);
$resizedHeight = round($aspectRatio * $resizedHeight);
}
// Return an array with the original and resized dimensions
return array($origWidth, $origHeight, $resizedWidth,
$resizedHeight);
}
Code: Select all
<?php
define ("MAX_SIZE","100");
function getExtension($str) {
$i = strrpos($str,".");
if (!$i) { return ""; }
$l = strlen($str) - $i;
$ext = substr($str,$i+1,$l);
return $ext;
}
$errors=0;
if(isset($_POST['Submit']))
{
$image=$_FILES['image']['name'];
if ($image)
{
$filename = stripslashes($_FILES['image']['name']);
$extension = getExtension($filename);
$extension = strtolower($extension);
if (($extension != "jpg") && ($extension != "jpeg") && ($extension != "png") && ($extension != "gif"))
{
echo '<h1>Only try to upload .jpg, .jpeg, .png and .gif files!</h1>';
$errors=1;
}
else
{
$size=filesize($_FILES['image']['tmp_name']);
if ($size > MAX_SIZE*1024)
{
echo '<h1>You have exceeded the size limit!</h1>';
$errors=1;
}
$groovy = sizeof(glob("/images/uploads/*"));
$groovy = ++$groovy;
print $groovy;
$image_name=$groovy.'.'.$extension;
$newname="uploads/".$image_name;
$copied = copy($_FILES['image']['tmp_name'], $newname);
if (!$copied)
{
echo '<h1>Copy unsuccessfull!</h1>';
$errors=1;
}}}}
if(isset($_POST['Submit']) && !$errors)
{
echo "<h1>File Uploaded Successfully!</h1>";
}
// Now make an array of the contents of the directory "uploads"
$array = glob('uploads/*');
// write the .txt file with the new array
$myFile = "gallarray.txt";
$fh = fopen($myFile, 'w+') or die("can't open file");
$stringData = "arse=images/".implode(",images/",$array);
fwrite($fh, $stringData);
fclose($fh);
// APPEND the .txt fil with the total image number
$myFile = "gallarray.txt";
$fh = fopen($myFile, 'a+') or die("can't open file");
$stringData = "&totalimgs=".$groovy;
fwrite($fh, $stringData);
fclose($fh);
?>
Code: Select all
<?php
include '/uploads/doresize.php';
define ("MAX_SIZE","100");
function getExtension($str) {
$i = strrpos($str,".");
if (!$i) { return ""; }
$l = strlen($str) - $i;
$ext = substr($str,$i+1,$l);
return $ext;
}
$errors=0;
if(isset($_POST['Submit']))
{
$image=$_FILES['image']['name'];
if ($image)
{
$filename = stripslashes($_FILES['image']['name']);
$extension = getExtension($filename);
$extension = strtolower($extension);
if (($extension != "jpg") && ($extension != "jpeg") && ($extension != "png") && ($extension != "gif"))
{
echo '<h1>Only try to upload .jpg, .jpeg, .png and .gif files!</h1>';
$errors=1;
}
else
{
$size=filesize($_FILES['image']['tmp_name']);
if ($size > MAX_SIZE*1024)
{
echo '<h1>You have exceeded the size limit!</h1>';
$errors=1;
}
$groovy = sizeof(glob("/Sites/com/shutterbugclub/www/images/uploads/*"));
$groovy = ++$groovy;
print $groovy;
$image_name=$groovy.'.'.$extension;
$newname="uploads/".$image_name;
$copied = copy($_FILES['image']['tmp_name'], $newname);
if (!$copied)
{
echo '<h1>Copy unsuccessfull!</h1>';
$errors=1;
}}}}
if(isset($_POST['Submit']) && !$errors)
{
echo "<h1>File Uploaded Successfully!</h1>";
}
// make the call to doresize.php
img_resize ($_FILES [ 'image'] [ 'name'], $_FILES [ 'image'] [ 'tmp_name'], 150, 'sorted.jpg');
// Now make an array of the contents of the directory "uploads"
$array = glob('uploads/*');
// write the .txt file with the new array
$myFile = "gallarray.txt";
$fh = fopen($myFile, 'w+') or die("can't open file");
$stringData = "arse=images/".implode(",images/",$array);
fwrite($fh, $stringData);
fclose($fh);
// APPEND the .txt fil with the total image number
$myFile = "gallarray.txt";
$fh = fopen($myFile, 'a+') or die("can't open file");
$stringData = "&totalimgs=".$groovy;
fwrite($fh, $stringData);
fclose($fh);
?>
Code: Select all
<?php
// Image resize script by the DtTvB
function img_resize($photo_name, $from, $max, $to) {
$ext = strtolower(end(explode('.',$photo_name)));
if ($ext == 'jpg' || $ext == 'jpeg') {
$im = imagecreatefromjpeg($from);
} else if ($ext == 'gif') {
$im = imagecreatefromgif($from);
} else if ($ext == 'png') {
$im = imagecreatefrompng($from);
} else {
return false;
}
$sx = imagesx($im);
$sy = imagesy($im);
$nx = $sx;
$ny = $sy;
if ($nx > $max) {
$nx = $max;
$ny = max(1, round($ny * ($nx / $sx)));
}
if ($ny > $max) {
$ny = $max;
$nx = max(1, round($nx * ($ny / $sy)));
}
$nm = imagecreatetruecolor($nx, $ny);
imagealphablending ($nm, false);
imagecopyresampled ($nm, $im, 0, 0, 0, 0, $nx, $ny, $sx, $sy);
if ($ext == 'jpg' || $ext == 'jpeg') {
imagejpeg ($nm, $to);
} else if ($ext == 'gif') {
imagegif ($nm, $to);
} else if ($ext == 'png') {
imagesavealpha ($nm, true);
imagepng ($nm, $to);
} else {
return false;
}
}
?>
Code: Select all
$myFile = "gallarray.txt";
$fh = fopen($myFile, 'w+') or die("can't open file");
$stringData = "arse=images/".implode(",images/",$array);
fwrite($fh, $stringData);
fclose($fh);
Code: Select all
$array = array('some/dir/1.jpg', 'some/dir/2.jpg', 'some/dir/6.jpg', 'some/dir/4.jpg', 'some/dir/3.jpg', 'some/dir/5.jpg');
function sort_files($file1, $file2)
{
return (reset(explode('.', end(explode('/', $file1)))) > reset(explode('.', end(explode('/', $file2))))) ? 1 : -1;
}
uasort(&$array, 'sort_files');
header('Content-Type: text/plain');
print_r($array);