5 Replies - 11173 Views - Last Post: 24 February 2006 - 02:42 AM

#1 pixelz   User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 20
  • Joined: 12-June 05

load width and height from images

Posted 15 February 2006 - 04:58 PM

I wont to load some images (I KNOW THIS) but I need to load width and height first.
How to load width and height from images?
Is This A Good Question/Topic? 0
  • +

Replies To: load width and height from images

#2 pioSko   User is offline

  • still.dreaming
  • member icon

Reputation: 23
  • View blog
  • Posts: 1,888
  • Joined: 06-June 03

Re: load width and height from images

Posted 16 February 2006 - 01:35 AM

make the movieClip where you are loading the images invisible. Then, when the movie finishes loading get the width and height. Use those values and then make the image visible again.
Was This Post Helpful? 0
  • +
  • -

#3 pixelz   User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 20
  • Joined: 12-June 05

Re: load width and height from images

Posted 16 February 2006 - 03:41 PM

Here is whole problem:
In FLASH I have little pictures(thumbs). When I click on some pictures I call getURL function

adrress = "javascript:void(window.open('Some.html', 'subWin', 'width=?, height=?'))";      

getURL(adrress);


where I open LARGE image in HTML.

First, I need to load width and height from large image in flash.
Second, I put width and height in getURL func. and open large image in HTML where window dimensions are width and height from image.

P.S. I dont need to load images in flash (because images are very big). I only need to load their width and height!

This post has been edited by pioSko: 24 February 2006 - 02:39 AM

Was This Post Helpful? 0
  • +
  • -

#4 pioSko   User is offline

  • still.dreaming
  • member icon

Reputation: 23
  • View blog
  • Posts: 1,888
  • Joined: 06-June 03

Re: load width and height from images

Posted 17 February 2006 - 03:05 AM

This information would have been useful in the first post.

.... if you are not loading in the image into flash, then you need to send to flash what the image sizes are. Flash is not able to seek and determine external file properties. Therefore, you will need to decide for a means of feeding flash with the information...

choices are:

* External functions which are executed by Flash. These can be in javascript or PHP or whatever you use. If you can get an external script to determine the properties of a file, then have Flash just send out a request to execute the function providing the file name.

* XML: Create an XML file and actionscript which will read the properties from the XML.

* Inserting the values straight into flash, as an array or something.
Was This Post Helpful? 0
  • +
  • -

#5 pixelz   User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 20
  • Joined: 12-June 05

Re: load width and height from images

Posted 21 February 2006 - 03:05 PM

This is a code if somebody have the same problem:

Actionscript: I have a button with code:

on (release) {

    dataSender = new LoadVars();
    dataReceiver = new LoadVars();

    dataSender.path1 = "1.jpg";
    dataReceiver.onload = function() {
        widthData=dataReceiver.width1;
        heightData=dataReceiver.height1;
        address = "javascript:void(window.open('1.html', 'subWin', 'width="+widthData+", height="+heightData+"'))";
        getURL(address);
    } 

    dataSender.sendAndLoad("getsize.php", dataReceiver, "POST");

}


PHP code: getsize.php

<?php

    $path1= $_POST['path1'];
    $path1 =trim($path1);
	
	
    $size = getimagesize ($path1);
    echo "width1=$size[0]&height1=$size[1]";

?>

This post has been edited by pioSko: 24 February 2006 - 02:41 AM

Was This Post Helpful? 0
  • +
  • -

#6 pioSko   User is offline

  • still.dreaming
  • member icon

Reputation: 23
  • View blog
  • Posts: 1,888
  • Joined: 06-June 03

Re: load width and height from images

Posted 24 February 2006 - 02:42 AM

Great. Well done :)

Thanks for the solution.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1