Detecting Image sizes on Import

  • Is there a way to detect the size (pixelwidth and pixelheight) of a directory object, such as a jpeg image, before it is loaded into a plugin?
    If Not, is it possible to detect it after it is loaded as a plugin and the scale is set to 1, but no width or height is set?

    I tried this for the directory option:

    Code
    set(imagewidth, get(url[photos/1.jpg].pixelwidth));


    ... but it didn't work.


    I tried this by loading the plugin without setting a width or height, instead using scale and then trying to determine the width or height...

    Code
    <!-- create the image plugin -->
    <plugin name="testimage" url="photos/1.jpg" align="leftbottom" edge="leftbottom" scale="1" width="" height="" keep="true" visible="true" />
    <!-- run an action to check for pixelwidth -->
    	<action name="test">
    		plugin[testimage].updatepos();
    		set(testsize, get(plugin[testimage].pixelwidth));
                    <!-- update the test layer that shows the result as text -->
    		set(layer[infotext].html, get(testsize)); wait(5);
    		</action>

    ... but that came up with zero (0) as the result, I'm guessing because the width and height were not set in the plugin. If I used .width instead of .pixelwidth, the answer was NULL.

    Any ideas?

  • I have managed to manipulate the code in vtourskin.xml to create a photogallery with thumbs that popup where the scene thumbs would pop up. So far all is very preliminary and functional. But to generate everything, I had to know and handcode the size of the image, whether or not it was landscape or portrait, and I am working with a fixed screen size.

    I want to make things a bit more dynamic when it comes to generating the image plugins and ensuring they size, orientate and position properly on different screen sizes/devices. So I wanted to be able to detect the image size so that I could determine its orientation (portrait or landscape) and adjust its width/height to fit within the bounds allocated on the screen. But more importantly than all of that, I wanted to generate all of this information when generating the thumbnails. Currently I have a list of thumbnails that I have to hand code, and when there are a lot of thumbs, it takes a lot of time. So I wanted to write a statement that would loop through this process and generate the xml for the thumbs, and images, in real time, so I wouldn't have to hand write all of these thumbs each time I created a tour. And the kicker is... I only want to load 1 full size image at a time. So I wanted to gather the needed information to generate the thumbnail code, without having to load all of the actual images.

    Using the plugin[name].imagewidth works to get the data, but to generate all of these thumbs, I first have to load the image to establish the "onloaded" event, then another, and another... consuming memory and time. I suppose I could load them into a plugin and destroy them 1 at a time until I had generated the code. I was hoping for a "leaner" method.

    Code
    <thumb name="0" url="thumbs/0.jpg" imageurl="photos/0.jpg" source_image_width="1000" source_image_height="633" source_image_orientation="horizontal" />
    <thumb name="1" url="thumbs/1.jpg" imageurl="photos/1.jpg" source_image_width="633" source_image_height="1000" source_image_orientation="vertical" />
    <thumb name="2" url="thumbs/2.jpg" imageurl="photos/2.jpg" source_image_width="1000" source_image_height="633" source_image_orientation="horizontal" />
    ...
    ...
    ...

    Einmal editiert, zuletzt von nefar1ous (14. November 2012 um 04:05)

  • Andrey's image gallery plugin resizes well for $35.


    I've never seen his image gallery plugin. I know he has an autothumbs, but it's quite old. I had requested he make an image gallery seems like a year ago, and kept begging, and begging. I wasn't aware he had finally made it.
    ** Where is it? Link? **

    For the thumbs I would set the smallest dimension to prop and the larger one to your max thumbnail dimension and use a parent plugin with the max width and height dimension with maskchilden so it's cropped.

    For the thumbs, I am trying to generate data only, they are all 1 size, which is easy enough to regulate. It's the images themselves that can be variable sizes. your reference to .imagewidth is 1 possible solution. Also, using a max size container, and scaling children rather than cropping also works to control behavior of the image size for scaling. . . but, if I wanted a frame around the picture, I need to be able to change the container size according to the size of the image.

    Overall, I am just looking for greater dynamics.

    Is it possible to generate XML tags in real time? I want something similar to addplugin(someName); ... but instead... addthumb(someThumbName); This would simply generate a virtual list (like an array) of thumbs for reference data...

Jetzt mitmachen!

Sie haben noch kein Benutzerkonto auf unserer Seite? Registrieren Sie sich kostenlos und nehmen Sie an unserer Community teil!