TwelvestoneFlash

Photo Browser flash+xml+php


Sign in

  • Waiting for Godot ( 720 k posts )
    Just conversation.
  • Thunder Dome ( 23 k posts )
    Photoshop Tennis and Collabs.
  • Photography ( 4.8 k posts )
    For all you shutterbugs, sh...
  • Flash ( 18 k posts )
    ActionScripting to tweens, ...
  • Front End ( 5.8 k posts )
    general front end design an...
  • Back End ( 9.6 k posts )
    serverside scripting, progr...
  • Projects and Theory ( 12 k posts )
    This forum is for discussio...
  • FAQ ( 269 posts )
    All those nagging questions...
  • Design ( 17 k posts )
    graphics & all aspects of g...
  • Purgatory ( 3.6 k posts )
    12stone Jail, feel free to ...
craftymind
 
2004-03-24

I thought you guys might get a kick out of this.

http://www.mustardlab.com/developer/test/new/

The directory includes the following files you can download if you want

gallery.fla gallery.swf gallery.php index.php

**jpg images

what happens is the swf file loads in gallery.php which contains the following code

<? $xml = '<?xml version="1.0"?'.'>'; $handle = opendir("."); while ( ($file=readdir($handle)) !== false ) { if ( !is_dir($file) ){ $pic = @getimagesize($file); if($pic != false && $pic[2] == 2){ $xml .= ''; } } } echo $xml; ?>

which spits out an xml list of every image in the folder gallery.php is included in

<?xml version="1.0"?>

the index page lets you even link to a specific image http://www.mustardlab.com/developer/test/new/?image=sinister.jpg

which is taken care of by some code in the index.php file

" />

all the source code is inhttp://www.mustardlab.com/developer/test/new/gallery.fla

I have to admit though, the visual idea of a photostack has to be credited to Andy from trendwhore.net if any of you are on there, he was also andy on o8. I just tried to make it as fast and seamless as possible

jeremy
 
2004-03-24

:notworthy amazing

*was that the jmack dog in there too?

craftymind
 
2004-03-24

jmack dog k ?

i think this would be more his breed. http://www.mediocreminds.com/03q3/misc/pcs/triumph.jpg

Barn
 
2004-03-24

I don't know anything about PHP, but I'd love to look at those PHP files. How can I get at them? (Got the FLA, but can't figure out a way to download the PHP files.)

craftymind
 
2004-03-24

this is the entire contents of gallery.php

<? $xml = '<?xml version="1.0"?'.'>'; $handle = opendir("."); while ( ($file=readdir($handle)) !== false ) { if ( !is_dir($file) ){ $pic = @getimagesize($file); if($pic != false && $pic[2] == 2){ $xml .= ''; } } } echo $xml; ?>

and the entire code for index.php

Flash Photo Stack " />

sorry, the server will process these files so there's no way of downloading the raw text unless I upload it into a .txt file on the server.

craftymind
 
2004-03-24
persist
 
2004-03-24

it's fun to clickreally really fast.

nice stuff!

craftymind
 
2004-03-24

I optimized the code entirely around the ability to click immediately even without all the images loaded and clicking any list size of photos as fast as possible.

sakri
 
2004-03-25

sweet!!!11

I had the php converting to xml thing before, but I love the photostack thing (even if the credits go to some guy named andy from some place called o8 k)

now make a recursive function that goes through all sub folders etc. and creates a deep nested xml tree :nerd:

:thumbsup:

mosquito
 
2004-03-25

very nice crafty!

Flux
 
2004-03-25

Great!! I'm gonna use that PHP a lot thanks!!

shuteye
 
2004-03-25

$pic[2] == 2

Maybe a dumb question, but I don't get this part. So pic[0] is width, pic[1] is height, but why pic[2] ==2?

mosquito
 
2004-03-25

getimagesize($file)> Returns an array with 4 elements. Index 0 contains the width of the image in pixels. Index 1 contains the height. Index 2 is a flag indicating the type of the image: 1 = GIF, 2 = JPG, 3 = PNG, 4 = SWF, 5 = PSD, 6 = BMP, 7 = TIFF(intel byte order), 8 = TIFF(motorola byte order), 9 = JPC, 10 = JP2, 11 = JPX, 12 = JB2, 13 = SWC, 14 = IFF, 15 = WBMP, 16 = XBM. These values correspond to the IMAGETYPE constants that were added in PHP 4.3. Index 3 is a text string with the correct height="yyy" width="xxx" string that can be used directly in an IMG tag.in short it if there is a return and it is of type jpg, do this... runs

shuteye
 
2004-03-25

But why read for myself when i have all these helpful people to tell me stuff? k

mosquito
 
2004-03-25

i'm just giving you a hard time. i'm suprised you haven't dug into php yet. it's a blast.

craftymind
 
2004-03-25

i was considering using this for that 100 lines of AS contest we were going to have for loading data, but I'm assuming that contest is dead?

mosquito
 
2004-03-25

it's not dead yet, i think we just all got really busy. i keep thinking about it though.

k

persist
 
2004-03-25

also, we were going to coincide it with the v2 launch.

craftymind
 
2004-03-25

ok.

btw, in case anyone is wondering what this code does

MovieClip.prototype.addProperty("onLoad", function () { return onLoadHandler[this]; }, function (f) { if (onLoadHandler == undefined) { global.onLoadHandler_ = {}; } onLoadHandler[this] = f; });

I can't remember where I got it from, but it restores the onLoad handler for movieclips when loading jpgs and swfs, very handy when you don't need or want to set up a getBytesLoaded/getBytesTotal loader

I'm assuming everyone is aware that flash wipes out all variables and values of a clip when loading files into that clip, but I guess flash doesn't reset or wipe out properties overridden or added through addProperty.

persist
 
2004-03-25

can you share a simplified example usage?

craftymind
 
2004-03-25

_root.createEmptyMovieClip("image", 1); image.onLoad = function() { trace("test.jpg has loaded into "+this); }; image.loadMovie("test.jpg");

If you were to run this code above, the onLoad event specificied would never run, the onLoad event would still fire when the loadMovie has finished, but the function attached to that event doesn't exist anymore because all the contents of that movieclip got wiped during the load.

MovieClip.prototype.addProperty("onLoad", function () { return onLoadHandler[this]; }, function (f) { if (onLoadHandler == undefined) { global.onLoadHandler_ = {}; } onLoadHandler[this] = f; });

_root.createEmptyMovieClip("image", 1); image.onLoad = function() { trace("test.jpg has loaded into "+this); }; image.loadMovie("test.jpg");

but by overwriting the onLoad property so that it targets actions stored outside of the movieclip, the function is able to run.

mosquito
 
2004-03-25

_Originally posted by craftymind _ [B]I can't remember where I got it from, but it restores the onLoad handler for movieclips when loading jpgs and swfs, very handy when you don't need or want to set up a getBytesLoaded/getBytesTotal loader/B]i found one that was very similar in the chatty.figleaf archives.

persist
 
2004-03-25

so will this return a success-false if a failure occurs?

onLoad = function(success){ }

?

craftymind
 
2004-03-25

MovieClip.onLoad doesn't have any parameters

persist
 
2004-04-26

I am confused.

is this different?

good use of right click, and thumbviews. http://www.andrewberg.com/photobrowser/afpb_flash.html

TwelvestoneFlash

Photo Browser flash+xml+php