ext Antônio Gomes wrote:

hi,

a simple question: what is the best way to get the size of images ? I am trying with both nsDOMHTMLImageElement->GetLenght/Width and imgIContainer->GetLenght|Width and sometimes they get me wrong value (comparing to the ones firefox gets me - page info) ..

regards

Humm, it seems like the image size is not the same as the size of its container. e.g.

               (...)

            imgList->Item(i, getter_AddRefs(node));
           nsCOMPtr<nsIDOMHTMLImageElement> img;
           img = do_QueryInterface(node);

           /// testing imgl* interfaces (from imglib2 - modules/libpr0n/) out 
instead of nsIDOMHTMLImage->GetHeight|Width/
           nsCOMPtr<nsIImageLoadingContent> imageLoader = 
do_QueryInterface(img);
           *if* (imageLoader) {
               nsCOMPtr<imgIRequest> imgRequest;
               rv = 
imageLoader->GetRequest(nsIImageLoadingContent::CURRENT_REQUEST, 
getter_AddRefs(imgRequest));
*if* (imgRequest) { nsCOMPtr<imgIContainer> imgContainer;
                   rv = imgRequest->GetImage(getter_AddRefs(imgContainer));
*if* (imgContainer) {
                       rv = imgContainer->GetHeight( &heigth);
                       rv = imgContainer->GetWidth( &width);

                           }
                     }
               }
               (...)

So, before start loading the image, its container (imgContainer) size might be different from the real image size ? Is it ? Does mozilla supposes its (container) initial size ?

regards
_______________________________________________
dev-tech-layout mailing list
[email protected]
https://lists.mozilla.org/listinfo/dev-tech-layout

Reply via email to