flex - check image dimensions before upload using filereference - apache-flex

In my Flex application, I use a FileReferenceList that the user can populate with multiple files using fileList.browse() before upload.
I check each file's size and use fileList[i].upload() to upload to my server, this works fine.
I have a suspicion that this is not possible, but before upload I would like to convert each FileReference into an Image in order to check it lies within certain dimension tolerances.
I realise I can do this server side, but ideally I would like the check to appear on both client and server. Can anyone offer any help?
Thanks!

Take a look at this post at the Yahoo! Flash Blog. Flash 10 lets you work with images locally. They give a nice example with code of how you can process FileReference objects, specifically image files.

Related

Multiple image upload with asp.net

How to upload multiple images to the web server with single button.I know there are couple of options available like flash,j query and silverlight.The problem is that there are many others things I want to do with images like upload the same image with different size (thumbnail) and want to change the image file name something like a GUID and want to store the path in database.
You can use uploadify.js for the same.
It is light weight as it contains jquery code.
Easy to implement.
Here is the link for the same. Uploadify

Client side images in Flex

I am developing an application that includes JPG and TIFF image size validation.
The backend is done is done in PHP. I am wondering if there is anyway to
validate the minimum width and height of those images in Flex or if they have to
be uploaded to PHP and validated there.
Thank you in advance for any assistance,
Orville
In Flash Player 10 the application can gain direct access to data on the client's machine. The new API methods are FileReference.load() and save(); you'll want to use load() to access the file off the user's machine and examine its properties. Details here:
http://livedocs.adobe.com/flex/3/langref/flash/net/FileReference.html#load()
After the FileReference dispatches its complete event, the "data" property will be populated with a ByteArray of the file's contents. If you can find or write suitable libraries for JPEG and TIFF files then you should be able to examine the dimensions.
For Flash Player 9 and earlier, FileReference is limited to upload() and download().
Assuming you're talking about client-side validation, you could always load the image to an object in flex and test the width and height of the loaded image object manually.
However, this should be done in addition to server-side checking if this limit is important, as client-side checks can be circumvented by crafty users.

Capture screenshot of website on the client (Javascript or flash)

Is there some method to issue a screen capture(browser window content only) from the browser with javascript or a embedded flash object etc so that a full quality image of the page content be saved or printed or an alternative approach.
I have a web app (asp.net 3.5) with google maps and other ajax operations client side like a custom tile server. I have been trying to implement a way for the user to print good quality captures of the webpage.
I have used the basic Window.Print() but in both IE and FF there many artifacts within the google maps and some items such as the popped up bubble doesnt print. I have experimented with save pdf thru cutepdf(just to post an example here) and the quality thru window.print() is low too.
For example, A screenshot with FireShot addon is perfect and what I want the client to have. however that is FF only and I cant ask the clients to install addons/activex controls on their browsers.
Have a look at this download example zip file(4mb) with:
Example screen shot using FireShot
(example of what I want to achieve
thru a html/JS button with in the
page)
Firefox Window.Print() result
(cutepdf used to save as pdf)
IE Window.Print() result (cutepdf
used to save as pdf)
note in 2,3 the little bubble is not printed even when open.
For now, I have added the function on my site to go fullscreen and guide the user to take a screenshot or call the window.print() function.
I am still looking for a method to print/capture my page.
are there any flash/activex controls that I can include in my page and thru them provide a quality print mechanism?
Thanks again for all the help but I still need more. :)
Thank you in advance.
http://rapidshare.com/files/311849636/Print_examples.zip.html
You'll go to all that work only to find that a simple app like Snagit will do the job. Building a SnagIt Screen Capture Plugin
The only way to reliably provide a high-quality print version of whats on-screen in a rich web application is to use the client-side, say JavaScript, to send the server precise information about the current state (where bubbles are, etc.) and use that to generate an image that mimics the positioning. Convert that image to a PDF or what-have-you, then send to the client for download.
Google also has a Static Maps API that might give you good results. I looked into it myself once, and only didn't go with it since (at the time) there were limitations on how many points they could support in a polyline.
I don't think this is possible. It would be quite a security risk to be able to capture the user's screen through scripting (imagine bad sites capturing screen information).
No there is not, though it would come in quite handy at times for bug reporting etcetera.
You will probably get the best result by creating a separate version of the page as a PDF have that being generated. It's no quick fix by all means, but you'll get superb print quality and total control over everything. The map part will probably be a bit tricky though as you need to get the map as a bitmap on the server somehow, and if it's not in flash on the client I don't know how you'd do that.

ASP.net: Display PDF in a asp.net web page

User click on a link button and it will direct them to a url that is dynmaically generated which a pdf file. The browser will prompt the user to either save or open it.
I want to know if it is possible to downlaod the pdf file to the server then show the pdf file in the asp.net web page. When i google on this question, 99% of top link are some third party component. Is it a way to do this without purchase any 3rd party component?
thank
I use itextsharp, its a free open source c# port of the java itext library.
Makes generating dynamic pdfs in asp.net a breeze and there is lots of documentation/examples floating around.
I don't think that you'll have much luck without a 3rd party component. First, the issue isn't showing the PDF, it is generating it. For that, you'll need a library to help. Rolling one yourself would not be cheaper unless you have an enormous amount of unpaid time on your hands.
With respect to third-party controls, I recommend and use DynamicPDF from CeTe.
Yes there is a way to do this without a 3rd party tool, but it involves coding a PDF-to-html translator.
If this is something for a business, the RoI for the 3rd party control is that you don't have to spend hundreds of hours coding & testing this component, when you could buy one for just a few hundred dollars.
Now, an alternative is to code a page which displays the data in the same way which the PDF file generates it (this could actually be handled by RDLC). So that when the user clicks the link button, they are taken to this display page, from which they can download the PDF version if they want a local copy.
Regardless of how you generate the PDF, I have found a better user experience if you open the PDF in an IFRAME instead of the full browser window. You can give users instructions and maintain the browser navigation.
I think what you want to do is by going to: http://my_site.com/generate-pdf.aspx?=someId
this should in fact just show the PDF file?
What you need to do is change the Response type.
See here for how to do this with images.
Look up the Content-Disposition HTTP header. You can send back a value that requests the content be displayed inline instead of downloaded.

How do I show an embedded excel file in a WebPage?

I want to allow an Excel report to be viewed embedded in a WebPage... is there a way?
I don't want to use an ActiveX, or OWC (Office Web Components), I just want to open an existing file from the internet explorer application.
I don't want users to download and then open it.
Using an iframe wouldn't be a problem, but my preliminary tests weren't successful
Any ideas? Is it at all possible?
This has to do with the local person's browser set up and not really anything you can do on your end. If they click a link with the .xls(x) extension, the browser determines if it wants to open it itself or in a new window.
Here 2 microsoft pages on how to change these settings:
http://support.microsoft.com/.../how-to-configure-internet-explorer-to-open-office-documents-in-the-app
http://support.microsoft.com/.../embed-your-excel-workbook-on-your-web-page-or-blog-from-sharepoint-or-onedrive-for-business
You should try using the Excel Web App Embed feature that lets you embed tables and charts from Excel directly on your Web Page. You can even let users interact with the spreadsheet so that they can sort and filter data and use your spreadsheets formulas to calculate make their own calculations all without altering the source.
The Excel Web App and storage is all free from Microsoft. Any data you embed on your Web page can be viewed by all the major destkop and mobile browsers and when you update your spreadsheet the data on your web pages is automatically updated as well.
I think your best bet is going to be extracting the data out of the Excel file and displaying it in a regular HTML table. Excel isn't exactly safe to invoke from a web page and not everyone has it anyway.
Take a look at scribd iPaper Viewer - this is a Flash based Viewer of XLS (and other) docs.
MOSS 2007 has a nifty feature called Excel Services which might fit the bill...
Excel Web App allows embedding "live" interactive spreadsheets on a web page. For an example, see http://datawiz.wordpress.com/2011/01/10/how-to-embed-excel-on-a-web-page/
in your comments you say that the Excel file is on the client's filesystem, not on the webserver. i think the security model of sane browsers forbid this; but wouldn't be surprised if setting high permissions to your pages could allow this.
<iframe src="file:\\yourpath\yourfile.xls" width="100%" height="500"></iframe>
Well this is a bit crude but sort of fits the bill.
Select the area of the spreadsheet you wish to display.
Copy this area into MS Paint.
Select the area in Paint and use the Edit/Copy to/ function to save this as a bitmap.
Now load the bitmap as you would any other pic.

Resources