A Flash Developer Resource Site

Page 1 of 3 123 LastLast
Results 1 to 20 of 51

Thread: Thumbnail's got form DB?

  1. #1
    Senior Member
    Join Date
    Feb 2002
    Location
    Geneva, CH, Europe
    Posts
    521

    Thumbnail's got form DB?

    Hello,

    http://www.jimmymcgrathphoto.com/

    Where are the thumnail's from? the Flash file or DB loaded? If they're db loaded, how can you create those thumbnails thru AS, instead of already having empty mcs?

    How do you store JPGs in a My SQL db?

    Thanks,
    Manojo

  2. #2
    Senior Member pellepiano's Avatar
    Join Date
    Feb 2000
    Location
    Stockholm, Sweden
    Posts
    15,151
    Its hard to say if the thumbnails are in the main Flash file or loaded separately. Filesize would indicate they are in the main file.

    He is loading separate swf or jpg files for the big images into a target movieclip. He also has a separate "canvas" movieclip that gets the image height and width from a image preloader and having the "canvas" dynamically resize to that with script.

    AS can not create thumbnails without using the original image.

    These galleries can be dine in a number of ways, so its hard to pinpoint the exact scenario for this one. Ive built some that has a separate administration swf interface that saves all relevant info to a textfile which my gallery reads from and dynamically creates the right number of buttons and links, and also simpler ones where you have all information IN the swf file.

    Ex
    http://www.pellepiano.com/v4/gallery_chrome.html

    -Pelle Piano
    // Image Gallery
    www.studiobild.com
    // Photo Blog
    http://talesofthepixel.blogspot.com

  3. #3
    Senior Member
    Join Date
    Feb 2002
    Location
    Geneva, CH, Europe
    Posts
    521
    Hey, that would be really nice.. could you pass me the code/explain(if you don't mind) and is there a way to do this in PHP?

    Thanks a lot,
    Manojo

  4. #4
    Senior Member pellepiano's Avatar
    Join Date
    Feb 2000
    Location
    Stockholm, Sweden
    Posts
    15,151
    I have no clue a bout either cgi or php ( even though I use a cgi script for the gallery. It just lets me write and retrieve variables from a textfile, I dont hever have to touch it and I use it for polls, highscores, guestbooks and so on ).

    As there are a LOT going on in the Flash file you have to be more specific.
    I have answered a few threads about the image resize bit here...

    http://www.flashkit.com/board/search...der=descending

    -Pelle Piano
    // Image Gallery
    www.studiobild.com
    // Photo Blog
    http://talesofthepixel.blogspot.com

  5. #5
    Senior Member
    Join Date
    Feb 2002
    Location
    Geneva, CH, Europe
    Posts
    521
    Hi,
    basically I would like to know how you got those thumbnails(or whatever you call them from the text file, how you calculatd the number of images, etc.

    Thanks a lot,
    Manojo

  6. #6
    Senior Member pellepiano's Avatar
    Join Date
    Feb 2000
    Location
    Stockholm, Sweden
    Posts
    15,151
    The thumbnails are seprate jpg images. They are not specified in the textfile. They have the same name as the big image , but with a x in front of it ( that was a way to just have to name the big images in the textfile ).

    When the textfile is loaded I run a loop that checks the big images that are specified in the textfile ( they are named image1=bird.jpg&image2=plane.jpg and so on ) and makes a duplicate of a thumbnail movieclip for everytime a big image is specified.

    // Duplicate thumbnail as long as there are image variables
    i=1;
    while("image"+i != undefined){
    duplicateMovieclip("thumbMC","t"+i,i);
    this["t"+i].loadMovie("x"+eval("image"+i);
    // Position
    this["t"+i]._x=(i*50)+20);
    i++:
    }

    The code above is taken from my head so I may have slipped with some syntax but thats the basics. (I left out that my thumbnail movieclip has also a button in it AND another movieclip that will recieve the image. This is so I can apply dynamic actions to the thumbnail so it will work as a button.

    -Pelle Piano
    // Image Gallery
    www.studiobild.com
    // Photo Blog
    http://talesofthepixel.blogspot.com

  7. #7
    Senior Member
    Join Date
    Feb 2002
    Location
    Geneva, CH, Europe
    Posts
    521
    great Thanks a lot
    You have different images for Thumbnails and big images, but would it be possible to just have the same image for boh, and define the size thru AS? How do you think the code would be?

    Qustions regarding your script: what is the "t"? the button?

    Now, how do you get the bigger picture, when you click on the thumbnail?

    Thanks a lot,
    Manojo.

  8. #8
    Senior Member pellepiano's Avatar
    Join Date
    Feb 2000
    Location
    Stockholm, Sweden
    Posts
    15,151
    t is the new name for the duplicate movieclips, they are named t1 t2 t3 and so on.
    The problem with using one image for both thumbnails and the big images is the filesize of the flash file. You have to load all images so they can be displayed as thumnails.

    The code would be almost the same but without the "x" and you probably want to increase the spacing between them.AND as you can not change the size of the movieclips until something has begun to load in them you probably need a preloader that checks for that and resizes the movieclips to thumnail sizes.

    As for clicking on them I suggest the use of hitTest . One problem is that you dont know the size of the original image ( as you want to make the thumnail return to its original size when clicking on them ).

    There are quite a few factors involved so its good to outline the whole project first before coding ( I wish I did that whan I start new projects =) ).

    -Pelle Piano
    // Image Gallery
    www.studiobild.com
    // Photo Blog
    http://talesofthepixel.blogspot.com

  9. #9
    Senior Member
    Join Date
    Feb 2002
    Location
    Geneva, CH, Europe
    Posts
    521
    No prob

    Well, the project is already outlined in my head, so I'll tel you what exactly I'm looking to do. I'm making a site for this small company that sells products like fans, TVs, etc. My goal is to show them a good products page: when they click on fans/tvs/etc, an MC or a new Flash file will open up, and there will be a list box giving a choice of all products. With that list box, there will also be these Thumbnails of those images, and when you click on them, you will geta bigger picture, and also text with product name, specifications, etc.
    The outline is a bit similar to your gallery, as you give title, price, etc.

    Thanks,
    Manojo

  10. #10
    Registered User
    Join Date
    Feb 2001
    Posts
    13,041
    Hi,

    loading the big images and showing them as small ones assumes that the viewer will eventually click most of the thumbnails to see the enlarged ones - and it means a bit more loading time.
    In a business setup, you cannot assume that viewers will look at all items you offer in one category ... but the extra waiting time may annoy them - unless your "big" images are fairly small files, of course

    Musicman

  11. #11
    Senior Member
    Join Date
    Feb 2002
    Location
    Geneva, CH, Europe
    Posts
    521
    Hi,
    thanks for the suggestion. At what size do you think a picture starts being a BIG FILE?

    Also, another question: I just passed by this loadjpg tutorial today:
    http://actionscript-toolbox.com/samplemx_loadjpg.php
    This tutorial talks about creating MCs thru actionscript, but if I already have a blanc mc (picHolder.JPGhold), how do you think the code would change?

    Thanks,
    Manojo

  12. #12
    Senior Member pellepiano's Avatar
    Join Date
    Feb 2000
    Location
    Stockholm, Sweden
    Posts
    15,151
    For me a big file is over 100 kb ( that is 20 seconds for a modem user ). So unless you have thumbnails as separate images your file is going to be HUGE and take a really long time to load.

    You can make the imageHolder mc's with script or manually, does not matter that much.

    The tutorial you mention creates a movieclip (one). Just take away the createMovieClip code and change the names of the movieclip. ( the code only works in MX, I think ).

    -Pelle Piano
    // Image Gallery
    www.studiobild.com
    // Photo Blog
    http://talesofthepixel.blogspot.com

  13. #13
    Senior Member
    Join Date
    Feb 2002
    Location
    Geneva, CH, Europe
    Posts
    521
    ok Great thanks a lot!
    am working on these 2-3 things right now, will get back if I have probs
    Manojo

  14. #14
    Senior Member
    Join Date
    Feb 2002
    Location
    Geneva, CH, Europe
    Posts
    521
    Hi,
    got a problem with this loadjpg thing, as you told me, I took out the CreateemptyMovieClip part and things like that, but I can't load the jpg.

    Here's the code I put on the first frame of my mc(the main thing is PicHolder, and in that there is JPGhold(empty Movie Clip)

    code:

    MovieClip.prototype.loadjpg = function(picName, holderName) {
    // holderName can be passed in case needed for progress indicator
    // if not passed, use 'holder' as default
    var JPGhold = holderName;
    this[JPGhold].loadMovie(picName);
    var id = setInterval(function (mc) {
    // width > 0 only when picture is completely loaded (and _width property available)
    if (mc[JPGhold]._width > 0) {
    mc._alpha = 99;
    clearInterval(id);
    mc._visible = true;
    mc.onComplete();
    } else {
    mc.onLoading();
    }
    }, 80, this);
    };

    _global.picLoaded = false;



    Ten frames later, as in the sample, I put this:
    code:

    function setIt() {
    this._x = 29;
    this._y = 31;
    // tell movie the picture has been loaded
    picLoaded = true;
    }

    // if this is the first time through the movie:
    if (!picLoaded) {
    jumpman.loadjpg("jumpman.jpg");
    } else {
    jumpman._visible = true;
    }
    //I put this on my own
    stop();




    Although I'm sure you will understand, I am also giving you my fla
    Thanks a lot,
    Manojo

  15. #15
    Senior Member pellepiano's Avatar
    Join Date
    Feb 2000
    Location
    Stockholm, Sweden
    Posts
    15,151
    JPGhold is a variable, not a name.It has to be defined somewhere as well as holderName. ( it may be supposed to be passed by the buttons, make shure you got the right path to the script ).

    Im not used to that kind of code.

    -Pelle Piano
    // Image Gallery
    www.studiobild.com
    // Photo Blog
    http://talesofthepixel.blogspot.com

  16. #16
    Senior Member
    Join Date
    Feb 2002
    Location
    Geneva, CH, Europe
    Posts
    521
    Hi,
    I don't exactly get what you're saying, so could you please look at the fla or tell me how you do to load a simple jpg?
    Here's the link for the FLA :
    http://membres.lycos.fr/manojo

    Thanks a lot for all your help,
    Manojo

  17. #17
    Senior Member pellepiano's Avatar
    Join Date
    Feb 2000
    Location
    Stockholm, Sweden
    Posts
    15,151
    Heres some basic info on loading external files, just change .swf to .jpg , the loadMovie code is the same for swf's and jpg's. ( one important thing, you can only load non progressive jpg images, so make sjure that option is not checked when saving the jpg from your image editor ).


    There are two ways of loading external files into Flash. Either you can load swf files into _levels or into movieclip targets.

    _levels only exist in the Flash player. They are like layers but for swf files The Flash player is like a overhead projector where the plastic films you put on top of each other are like the swf files in the player. There are 16000 available levels

    //To load a external swf into a _level from a button. The number 1 being the level to load into.

    on(release){
    loadMovieNum("myExternalFile.swf",1);
    }

    Movieclip targets are what it sounds like. A empty movieclip placed on the stage just for the purpose of loading a swf file into it. The advantage is that you can place it anywhere, manually ( as opposed to swf's in _levels) and also can control what othe objects shoeld be on top or beneath.

    Usually you give the movieclip an instance name of container.

    //To load a external swf into a target movieclip from a button ( both being on the main timeline ).

    on(release){
    container.loadMovie("myExternalFile.swf");
    }

    -Pelle Piano
    // Image Gallery
    www.studiobild.com
    // Photo Blog
    http://talesofthepixel.blogspot.com

  18. #18
    Senior Member
    Join Date
    Feb 2002
    Location
    Geneva, CH, Europe
    Posts
    521
    Hi,
    thanks a lot.
    But how about loading it without clicking on the button?
    And how do you limit the size of jpg so it fits your MC?

    thanks,
    Manojo
    Last edited by manojo; 08-06-2003 at 09:08 AM.

  19. #19
    Senior Member pellepiano's Avatar
    Join Date
    Feb 2000
    Location
    Stockholm, Sweden
    Posts
    15,151
    In a frame....

    container.loadMovie("myExternalFile.jpg");

    The container clip has no size as long as its empty. It will resize to the jpg's size ( or whatever you load into it ) . To change the jpgs ( eg container clip size ) size you just change the dimensions of the container mc ( after the jpg has begun to load ).

    container._width=345;
    container._height=145;


    ..or....

    container._xscale=200;
    container._yscale=200;

    -Pelle Piano
    // Image Gallery
    www.studiobild.com
    // Photo Blog
    http://talesofthepixel.blogspot.com

  20. #20
    Senior Member
    Join Date
    Feb 2002
    Location
    Geneva, CH, Europe
    Posts
    521
    Hi pellepiano,
    sorry for being SUCH A WASTE in AS, but "while it loads" = ???
    I tried putting that after the loadmovie line, but of course, tha's wrong. I tried putting it before, but that's also wrong. So what is it??

    If I want to load a random image,
    would the code be : container.loadMovie("*.jpg");

    ???

    Thanks, you have already helped me so much
    Manojo

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center