Image width on adding
Hi all.
I would like to know how i can figure out the width of an image after adding it to the canvas.
I was trying to call the width getter method, but it returned 0.
I could get width with the MOUSE.CLICK - Event, but i need it immediately after adding to the canvas.
Could somebody give me an advice to solve this problem?
Hi,
Use following code, may be this is what you are looking for:
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute">
<mx:Script>
<![CDATA[
private function onImageLoadHandler(event:Event):void
var bmp:Bitmap = event.target.content as Bitmap;
trace("Height :: " + bmp.height);
trace("Width :: " + bmp.width)
]]>
</mx:Script>
<mx:Image source="image.png" complete="onImageLoadHandler(event)">
</mx:Image>
</mx:Application>
Cheers
-Vikash
Similar Messages
-
Controlling image width in XML brought into TextField via RSS
Hello. First off, let me say that I am new to these forums,
and new to AS 3.0
Here's my question.
I'm building an RSS Reader. Everything is working great,
except I can't figure out how to control the size of images
embedded in the XML of the blog posts.
I attempted to set up a textField with an attached css
stylesheet to limit image widths, but I couldn't get that to
function. Should I try saving the remote XML to my server via PHP,
and then adding my desired maximum width to every <img> tag?
That seems like a lot of work for a simple task.
Ideally, I'm dreaming of a textField or TextArea or
ScrollPane property that would force contents to obey the
container's width. Can you tell I usually write css?
Thanks in advance for any advice.Assuming that html is valid xml, and it apparently is if you
are working with it successfully, you would access that value like
this:
description.img.(@src)
A labelFunction would make it easy to display that string.
I haven't worked much with in-line renderers so ai am not
sure you you would do it in there.
Tracy -
Not able to get image width after uploading image
hi
I am working on uploading image. Once the image is uploaded I need to know image width and height. Right now I am listening to "complete" event but it seems image is still not loaded when the complete event is raised as it returns image width as zero. This is very urgent and imp for me, Please let me know how can I get the wridth and height of image once it is uploaded on remote server
<mx:VBox width="100%" height="100%">
<mx:Label text="Image" />
<mx:HBox width="100%" height="10%">
<mx:TextInput id="txt_imgname" width="321"/>
<mx:Button label="Browse" click="bn_Browse_Click()"/>
</mx:HBox>
<mx:Canvas width="400" height="264" backgroundColor="#000000" borderStyle="solid" cornerRadius="12" borderThickness="3" borderColor="#222F92">
<mx:ProgressBar id="progressBar" indeterminate="true" visible="false" height="1%" />
<mx:Image id="img" complete="{imageLoadListener(event)}" />
</mx:Canvas>
<mx:HBox width="100%" height="10%" horizontalAlign="right" verticalAlign="middle">
<mx:Button label="OK" id="okbutton" click="bn_ok_click()" />
<mx:Button label="Cancel" click="bn_cancel_click()" />
</mx:HBox>
private function bn_Browse_Click():void
CreateFileReference();
fileReference.addEventListener(DataEvent.UPLOAD_COMPLETE_DATA, onUploadCompleteData);
FileBrowse();
private function FileBrowse():void
try
var success:Boolean = fileReference.browse(allTypes);
catch (error:Error)
Alert.show("Unable to browse for files.");
private function CreateFileReference():void
var imageTypes:FileFilter = new FileFilter("Images (*.jpg, *.jpeg, *.gif, *.png)", "*.jpg; *.jpeg; *.gif; *.png");
allTypes = new Array(imageTypes);
fileReference = new FileReference();
fileReference.addEventListener(Event.SELECT, selectHandler);
fileReference.addEventListener(ProgressEvent.PROGRESS, fileRef_progress);
private function selectHandler(event:Event):void
var request:URLRequest = new URLRequest("http://"+TestLoginIntegration.GetServerAddress()+"/FileUpload/Default.aspx");
try
request.contentType = "application/octet-stream";
request.method = "POST";
fileReference.upload(request,fileReference.name,false);
catch (error:Error)
Alert.show("Unable to upload file." + error.message);
private function fileRef_progress(evt:ProgressEvent):void
img.source = "";
progressBar.visible = true;
private function onUploadCompleteData (event : DataEvent) : void
var filePath:String = event.data;
img.source = filePath;
progressBar.visible = false;
txt_imgname.text = GetFileNameFromPath(filePath);
private function imageLoadListener(e:Event):void{
Alert.show(e.currentTarget.width);
private function GetFileNameFromPath(filepath:String):String
if(filepath == null || filepath == "")
return null;
var name:String = filepath.substring(filepath.lastIndexOf("/") + 1, filepath.length);
return name;Read this older post
http://forums.adobe.com/message/1900768#1900768 -
Adjust image width and position along with browser size automatically.
Hi, I'm trying to place an image at the left edge of browser window, and the image width is 50% of the browser window size. The similar effect can be found on this website. Lenzing Instruments
Notice that as the browser zoom out, the image remains half of the width of browser window and align with the right edge of the browser.
I'm new to Muse. Not sure if it is possible to achieve this effect in Muse. I know Muse can set image 100% width of browser window, but how about 50%, 75% and other user defined proportion?
Any help will be appreciated!Thank you for your reply Sanjit. Could you explain more in details about
Exact responsiveness cannot be achieved but yes with scroll and pin you can create a similar effect
I also followed this post Can you create responsive sites with Adobe Muse? It seems that Muse does not support responsive design very well. So I'm not sure how exactly to get an similar responsive design effect in Muse.
Thanks!
Yinze
Design Engineer
Lawson Hemphill Inc. -
How to transfer images from Recently added in iOS8?
Hi
when I used to download images on my iPad or iPhone, they went to camera roll and they were easy to transfer to iMac with Image Capture when connected with USB. Now Camera Roll is gone in iOS 8 and Image Capture does not see the images on Recently Added. How to transfer images to iMac now under iOS8? I am completely at a loss. How can this be so poorly instructed - I find no info on this and I am sure I am not the only one struggling with this.
Thanks a lot for any help!
TimoYou can directly transfer photos and videos via WiFi between the iDevices, PCs, and Macs with an App like Photo Transfer.
See: https://itunes.apple.com/us/app/photo-transfer-app-easily/id365152940?mt=8
Or you can upload the photos and videos to the Dropbox service using the Dropbox App on the iDevice, PC, or Mac and download them to the another device using the Dropbox App on that device. By the way, once the videos are on Dropbox you can share them with others.
See: https://itunes.apple.com/us/app/dropbox/id327630330?mt=8 -
http://pyroblue.dyndns.org:8080/flexapps/BhgPhotoContest/bin/BhgPhotoContest.html
if you view that page, you can see there is a lot of
whitespace underneath the image...im just setting the image width
(similar to what you do with HTML)...but for some reason, Flex puts
a bunch of whitespace (the original height's worth) at the bottom
of the image....
my mxml file looks like this:
<mx:HTTPService id="contestListing" url="photocontest.xml"
result="pcDataHandler(event)" fault="faultHandler(event)"/>
−
<mx:Repeater dataProvider="{photoContests}"
id="pcRepeater">
−
<mx:VBox>
<mx:Label
text="{photoContests.getItemAt(pcRepeater.currentIndex).pcName}"
fontSize="14" fontWeight="bold"/>
−
<mx:HBox>
<mx:Image
source="{photoContests.getItemAt(pcRepeater.currentIndex).prevPhoto}"
maxWidth="75" maintainAspectRatio="true"/>
<mx:Text
text="{photoContests.getItemAt(pcRepeater.currentIndex).desc}"
width="400" fontSize="10"/>
</mx:HBox>
</mx:VBox>
</mx:Repeater>
</mx:VBox>
any ideas?Let's say your image is 300x300 pixels. You want to place it
into an area that is 100x200 and an area that's 500x200, centered
in both:
<mx:Image id="img1"
width="100" height="200" source="{imagefile}"
scaleContent="true" maintainAspectRatio="true"
horizontalAlign="center" verticalAlign="middle" />
<mx:Image id="img2"
width="500" height="200" source="{imagefile}"
scaleContent="true" maintainAspectRatio="true"
horizontalAlign="center" verticalAlign="middle" />
For img1, the smallest dimension is 100 (width) which it
matches to the real image's maximum dimension which is 300. That
means img1 will display an image 100x100 centered vertically with
50 pixels above and below.
For img2, the smallest dimension is 200 (height) which it
matches to the real image's maxium dimension which is 300. That
means img2 will display an image 200x200 centered horizontally with
150 pixels to the left and right.
The Image tag has 2 dimensions: img.width and img.height is
the area it occupies on the display. img.contentWidth and
img.contentHeight is area the pixels occupy. For img1, contentWidth
and contentHeight are 100, for example. -
How can I get the image width and height stored in database?
Hi!I write s servlet to display images store in database.but how can I get the image width and height?
Have you tryed using PJA or a similar library?
I presume you get java.lang.NoClassDefFoundError on the line :
Toolkit.getDefaultToolkit();? -
[CS2]How to get the Image Width & Height using JS (ILLUSTRATOR CS2)
Hi,
How to get the Image width & height of an Image using javascript .Im using Illustrator CS2.
Any sample code
Regards
MyRiazyou can reference the dimensions of a loading image (or swf)
by referencing the target movieclip's dimensions AFTER loading is
complete. ie, use preloader code or the onLoadInit() method of a
moviecliploader listener. -
Hi,
We are indexing file share with images and get the properties of Image Width, Image Height, Image Size (we show it as refiners in SharePoint after make it managed properties). Somehow when the picture is png format - we see only Size but not height and width.
Is that any setting that should be done in the file share (when i select an image in the windows explorer window i can see all its properties, and it seems that png files do expose the width and height properties
keren tsurHi Keren,
According to your description, my understanding is that when you tried to crawl file share with images, the ows_ImageWidth and ows_ImageHeight crawled property for PNG file could not be generated.
For your issue, I can reproduce your issue in my SharePoint 2013 environment. For a workaround, you can upload the PNG images into SharePoint images Library and they would work fine.
Best Regards,
Eric
Eric Tao
TechNet Community Support -
Slideshow image resizing when adding new images
I am creating a series of slideshows on multiple pages. I created one slide show using the "basic" slideshow and resized it to the dimensions and settings I wanted. I have many pictures all of different proportion, therefore, I selected the "fill frame proportionally" so they would all fit the dimension I set. I wanted to use this first slideshow as a template for all of the rest. I added images to this first slideshow with no problems. All of my different sized images scaled or cropped to fit within the dimension I set. The problem comes in when I do two things: 1) When I add other images of different dimensions to this same slideshow gallery, they come smaller that the intended dimensions I set previous. I check the setting and it is still on "fill frame proportionally" similar to the first batch of pictures. 2) The second issue is when copy this slideshow as a template to other pages. When I try to replace or add to the slideshow gallery, the images come in cropped or smaller rather than filling the frame. Again, the settings are still the same from my very first slideshow that worked just as i intended.
I could resize all the images to all the same dimensions using another program like photoshop, but that is another step that is very tedious and it would seem that it should be something built into Muse.
Is there a way around this?. Am I doing something wrong? Or is this just one of those glitches that happens with Muse? I appreciate any help that I can get.
Thanks!Hi, I got it to work like this:
Using background colours in Photoshop so that all sizes are the same in pixels. Then manually adjusting thumbnails by double-clicking on them so that a red square appears.
Cheers,
Elsemiek
Op 26 dec. 2014, om 00:50 heeft MediaGraphics <[email protected]> het volgende geschreven:
slideshow image resizing when adding new images
created by MediaGraphics <https://forums.adobe.com/people/MediaGraphics> in Adobe Muse Bugs - View the full discussion <https://forums.adobe.com/message/7043933#7043933>
Hi there Elsemiekagain,
I had to fiddle around with my slide show to get it to work. That is, it worked at first, then went funky, and I had to fiddle. So much fiddling that I can't possibly know what actually made it start to work again.
And to some degree, this is the way that I find Muse to be in general. That it requires finessing to get it to work as expected. This adds a good deal of time to every development project, though I am getting better at this with practice and experience.
Most of it is not even things that could be easily put in words as instructions, as many are nanced. But in fairness, this version of Muse is a complete code re-write this year. So we do need to cut Adobe some slack, and give the team time to iron things out.
If the reply above answers your question, please take a moment to mark this answer as correct by visiting: https://forums.adobe.com/message/7043933#7043933 and clicking ‘Correct’ below the answer
Replies to this message go to everyone subscribed to this thread, not directly to the person who posted the message. To post a reply, either reply to this email or visit the message page:
Please note that the Adobe Forums do not accept email attachments. If you want to embed an image in your message please visit the thread in the forum and click the camera icon: https://forums.adobe.com/message/7043933#7043933
To unsubscribe from this thread, please visit the message page at , click "Following" at the top right, & "Stop Following"
Start a new discussion in Adobe Muse Bugs by email <mailto:[email protected]ftware.com> or at Adobe Community <https://forums.adobe.com/choose-container.jspa?contentType=1&containerType=14&container=47 59>
For more information about maintaining your forum email notifications please go to https://forums.adobe.com/thread/1516624 <https://forums.adobe.com/thread/1516624>. -
Hello!
I have an Image within a Canvas.
Both of them have width set to 100%:
- the Canvas has that so that it will stretch as much as it's own containter allows it.
- the Image has both width and height set to 100% so that images larger than the Canvas are resized, otherwise a huge image is displayed and scroll bars for the Canvas.
My question is, how can I get the Image width and height, not the container's but the real width and height of the displayed image? I need this because the Image container will always be as large as the Canvas.
The idea is to superposition a canvas with text with the same width as the image, not the Image container, the image itself.
Thank you!Not entirely what I wanted though now that I look more closely.
It gives me the W and H of the image, not the resized image.
The image is 1024x768 (for example) but resized to fit into a container... I wanted the size of the content displayed, not the size of the content loaded. -
Hi everybody,
I'm quite a newbie using AS3 and as first pretentious learning project I'm creating a image multigallery.
At this moment I have two questions (between several future others) relative to the code I'm writing (and suffering):
How to correctly set the buttonMode in a dinamically created buttons?
and
How to get the width of the images that I'm dinamically loading? I'm planning to put them side by side, for this I need to know the width of each one.
In the thread title I wrote that it can be just one doubt despite the totally different purposes of the codes. Maybe.
Let me explain why: until now I could not understand completely the right way to direct the events inside dinamic functions.
Here's my code until now:
//// CREATE CONTAINERS ////
// CREATE MENU CONTAINER //
var menuContainer:MovieClip = new MovieClip();
menuContainer.x=10;
menuContainer.y=300;
addChild(menuContainer);
// CREATE IMAGES CONTAINER //
var imagesContainer:MovieClip = new MovieClip();
imagesContainer.x=100;
imagesContainer.y=10;
addChild(imagesContainer);
// IMAGE LOADERS //
var imagesLoader:Loader;
var bigImagesLoader:Loader;
//// LOAD XML ////
var xmlLoader:URLLoader = new URLLoader();
xmlLoader.addEventListener(Event.COMPLETE, whenLoaded);
xmlLoader.load(new URLRequest("XML/roiaXML.xml"));
var xml:XML;
function whenLoaded(evt:Event):void {
xml=new XML(evt.target.data);
var mySetsList:XMLList=xml.children();
//// MENU BUTTONS ////
// POSITIONING BUTTONS INSIDE MENU CONTAINER//
var rowsQuantity:Number=3;
var columnsQuantity:Number=Math.ceil(mySetsList.length()/rowsQuantity);
var cellWidth:Number=160;
// CREATE BUTTONS //
for (var i:int=0; i< mySetsList.length(); i++) {
var newSetButtonMC:setButtonMC=new setButtonMC();
var imageNodesArray:Array = new Array();
for (var j:int=0; j<mySetsList[i].IMAGE.length(); j++) {
imageNodesArray.push(mySetsList[i].IMAGE[j].attribute("smallURL"));
newSetButtonMC.imageArray=imageNodesArray;
newSetButtonMC.setButtonText.text=mySetsList.attribute("setTitle")[i];
newSetButtonMC.setButtonText.autoSize=TextFieldAutoSize.LEFT;
var cellX:Number=Math.floor(i/rowsQuantity);
var cellY:Number=i%rowsQuantity;
newSetButtonMC.x=cellX*cellWidth;
newSetButtonMC.y=cellY*(newSetButtonMC.height+10);
// I really don't know how to set the newSetButtonMC.buttonMode = true, nothing worked until now
newSetButtonMC.addEventListener(MouseEvent.CLICK, onClickButton);
menuContainer.addChild(newSetButtonMC);
//// MENU BUTTONS ACTIONS ////
function onClickButton(mevt:MouseEvent):void {
// LOAD GALLERY IMAGES //
var targetButton:setButtonMC=setButtonMC(mevt.currentTarget);
for (i=0; i<targetButton.imageArray.length; i++) {
imagesLoader = new Loader();
imagesLoader.load(new URLRequest (targetButton.imageArray[i]));
imagesLoader.addEventListener(Event.INIT, getImageWidth);
imagesLoader.x=i*200;
imagesContainer.addChild(imagesLoader);
// LOAD BIG IMAGE WHEN CLICK IMAGE FROM GALERRY //
imagesLoader.addEventListener(MouseEvent.CLICK, loadBigImage);
function getImageWidth(evtImageWidth:Event):void {// FUNCTION TO GET IMAGE WIDTH //
// I really don't know what to do here, i've tryed a lot
trace(evtImageWidth.target.width);
trace("ok");
function loadBigImage(event:MouseEvent):void {
trace("ok");
I've tryed (and searched for solutions) a lot, maybe someone can help me.
Thanks everybody . AbstratoSomething new happened in my life, and it's called "contentLoaderInfo".
<--- real happiness
With this:
imagesLoader.contentLoaderInfo.addEventListener(Event.INIT, getImageWidth);
plus this:
function getImageWidth(evt:Event):void {
trace(evt.target.width);
I was close to reach the supreme nirvana and I could trace the images widths.
But there is a problem: i don't know what to do with the values to load each image side by side.
Does someone know?
Thanks . Abstrato -
Nikon 5000 camera. I am converting nefs to dng. I am new to this whole area. I am trying to figure out why previews ina given software (IDImager) look different for the dng vs the nef. As an aside I am looking at eh exif data. For the nef the data are:
Image Width:160
Image Length: 120
For the DNG
Image Width: 256
Image Length: 170
Why are they different? And does it matter since as I understand this only for how the RAW data are viewed in any preview and have no effect on the actual "raw" data.
JDIf you're talking about the JPEG preview image contained within the files, I think the DNG converter is simply creating a little bit larger preview image. This does not have any impact on the raw data.
-
How to get blob image width with ordimage?
Hello,
I have trouble getting image width with ordimage. I have quite the same program for processing images as here: http://spendolini.blogspot.com/2005/10/manipulating-images-with-database.html
so I have declared image files as BLOB files. How can I get the width for the them?
There is a sample from ordimage reference:
DECLARE
image ORDSYS.ORDImage;
width INTEGER;
BEGIN
SELECT p.product_photo INTO image FROM pm.online_media p
WHERE p.product_id = 3515;
-- Get the image width:
width := image.getWidth();
DBMS_OUTPUT.PUT_LINE('Width is ' || width);
COMMIT;
END;
the ORDSYS.ORDIMAGE is used instead of BLOB here. when i do the same then i can't select BLOB content into the ORDSYS.ORDIMAGE variable. And otherwise I can't use the getWidth with the BLOB variable.
Can anybody help please?Hi,
the column blob_content is not suitable for storing into v_image2 because variable v_image2 is of type ORDSYS.ORDIMAGE and the column is BLOB.
I used the following method instead:
declare
image blob;
attributes clob;
img_mimeType varchar2(32);
img_width integer;
img_height integer;
img_contentLength integer;
fileFormat varchar2(32);
contentFormat varchar2(32);
compressionFormat varchar2(32);
begin
DBMS_LOB.CREATETEMPORARY(attributes, TRUE, DBMS_LOB.CALL);
select img
into image
from image_repository
where id = 0;
ORDSYS.ORDImage.getProperties(image,
attributes,
img_mimeType,
img_width,
img_height,
fileFormat,
compressionFormat,
contentFormat,
img_contentLength);
dbms_output.put_line(img_mimeType);
dbms_output.put_line(img_width);
dbms_output.put_line(img_height);
dbms_output.put_line(fileFormat);
dbms_output.put_line(compressionFormat);
dbms_output.put_line(contentFormat);
dbms_output.put_line(img_contentLength);
DBMS_LOB.FREETEMPORARY(attributes);
end;
try adapting this code and think about the possibility of "caching" image properties, because it takes some time to retrieve them every time.
Bye,
Flavio
http://oraclequirks.blogspot.com/search/label/Apex -
HI
here's my problem:
I can set a maximum image width glboally in contribute, so if
a uer uploads a pic. the maximum width is let's say 600px. that's
fine, but..
can i put some code in my dreamweaver pages that page A has a
maximum width of 600px and page B a maximum width of 700px?
Love to hear from you!HI
here's my problem:
I can set a maximum image width glboally in contribute, so if
a uer uploads a pic. the maximum width is let's say 600px. that's
fine, but..
can i put some code in my dreamweaver pages that page A has a
maximum width of 600px and page B a maximum width of 700px?
Love to hear from you!
Maybe you are looking for
-
I have installed Russian fonts on my IBM PC, but the characters are displayed as jibberish. The Russian language option does not appear in the Paragraph Designer > Language drop down menu. How do I resolve this issue? I am using FrameMaker 9. Thanks
-
How do I get rid of Registration Window preventing access to Acrobat?
On removing Acrobat XI and re-installing Acrobat 11.0.0, entering my serial number, and updating to 11.0.08, I get a registration window ("Register Your Product") that (1) Pops up anew when you click on "Cancel", (2) Goes away if you click on the cor
-
Get rid of mds virus, not just disabling
I contracted the dreaded mds virus. There is also something called md worker--two files, in fact. There are quite a few posts on here on how to disable it but how do it get rid of it completely? Also will disabling or getting rid of it mean the fil
-
I downloaded ios 7 and now I cant get my phone to sync with itunes. It says my phone needs version 11.1. How do I get this?
-
Windows doesn't repaint properly
I had my computer reformatted recently by a small local PC repair shop. The owner also re-installed windows 7 - he used his own disk. I find now that there is a repaint problem. If I start Outlook, and view some emails, and then close Outlook, It lo