compression

compress/archive folder using php script

安稳与你 提交于 2019-11-26 16:10:13
问题 Is there a way to compress/archive a folder in the server using php script to .zip or .rar or to any other compressed format, so that on request we could archive the folder and then give the download link Thanks in advance 回答1: Here is an example: <?php // Adding files to a .zip file, no zip file exists it creates a new ZIP file // increase script timeout value ini_set('max_execution_time', 5000); // create object $zip = new ZipArchive(); // open archive if ($zip->open('my-archive.zip',

How to Compress/Decompress tar.gz files in java

自作多情 提交于 2019-11-26 15:45:27
问题 Can anyone show me the correct way to compress and decompress tar.gzip files in java i've been searching but the most i can find is either zip or gzip(alone). 回答1: My favorite is plexus-archiver - see sources on GitHub. Another option is Apache commons-compress - (see mvnrepository). With plexus-utils, the code for unarchiving looks like this: final TarGZipUnArchiver ua = new TarGZipUnArchiver(); // Logging - as @Akom noted, logging is mandatory in newer versions, so you can use a code like

Deflate compression browser compatibility and advantages over GZIP

佐手、 提交于 2019-11-26 15:41:31
UPDATE Feb 10 2012: zOompf has completed some very thorough research on this very topic here . It trumps any findings below. UPDATE Sept 11 2010: A testing platform has been created for this here HTTP 1.1 definitions of GZIP and DEFLATE (zlib) for some background information: " 'Gzip' is the gzip format, and 'deflate' is the zlib format . They should probably have called the second one 'zlib' instead to avoid confusion with the raw deflate compressed data format. While the HTTP 1.1 RFC 2616 correctly points to the zlib specification in RFC 1950 for the 'deflate' transfer encoding, there have

Compress camera image before upload

坚强是说给别人听的谎言 提交于 2019-11-26 15:26:17
问题 I am using this code (from www.internetria.com) to take a photo and upload to a server: onCreate: Intent intent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE); Uri output = Uri.fromFile(new File(foto)); intent.putExtra(MediaStore.EXTRA_OUTPUT, output); startActivityForResult(intent, TAKE_PICTURE); onActivityResult: ImageView iv = (ImageView) findViewById(R.id.imageView1); iv.setImageBitmap(BitmapFactory.decodeFile(foto)); File file = new File(foto); if (file.exists()) { UploaderFoto nuevaTarea

How do I enable gzip compression when using MVC3 on IIS7?

谁说我不能喝 提交于 2019-11-26 15:01:14
问题 Does anybody know how to enable gzip compression in MVC 3? I'm using IIS7. Google Chrome Audit's result: Enable gzip compression (4) Compressing the following resources with gzip could reduce their transfer size by about two thirds (~92.23KB): /mydomain/ could save ~1.53KB jquery-1.4.4.min.js could save ~51.35KB Cufon.js could save ~11.89KB Futura.js could save ~27.46KB 回答1: You can configure compression through your web.config file as follows: <system.webServer> <urlCompression

Gzip versus minify

天大地大妈咪最大 提交于 2019-11-26 14:59:47
I had a somewhat lively discussion the other day about minifying Javascript and CSS versus someone who prefers using Gzip. I'll call this person X. X said that Gzip allready minifies the code, since it zips your files. I disagree. Zip is a lossless method of shrinking filesize. Lossless means the original must be restored perfectly, meaning info must be stored to be able to restore the spaces, the un-needed characters, commented code and everything else. That takes up more space, since more must be compressed. I have no method of testing, but I believe that the Gzip of this code: .a1 {

LSB-DCT based Image steganography

我是研究僧i 提交于 2019-11-26 14:53:04
问题 I'm working on LSB-DCT based Image steganography in which i have to apply LSB to DCT coefficients of the image for data embedding to JPEG.i'm new to all this.so searched and read some research papers they all lack a lot of information regarding the process after DCT.i also read many questions and answers on stackoverflow too and got more confused. here are the questions: 1-reasearch paper and in question on the web they all are using 8x8 block size from image for DCT..what i should do if the

How to compress an image via Javascript in the browser?

我与影子孤独终老i 提交于 2019-11-26 14:03:31
TL;DR; Is there a way to compress an image (mostly jpeg, png and gif) directly browser-side, before uploading it ? I'm pretty sure JavaScript can do this, but I can't find a way to achieve it. Here's the full scenario I would like to implement: the user goes to my website, and choose an image via an input type="file" element, this image is retrieved via JavaScript, we do some verification such as correct file format, maximum file size etc, if every thing is OK, a preview of the image is displayed on the page, the user can do some basic operations such as rotate the image by 90°/-90°, crop it

Best JavaScript compressor [closed]

痴心易碎 提交于 2019-11-26 13:58:40
What is the the best JavaScript compressor available? I'm looking for a tool that: is easy to use has a high compression rate Produce reliable end results (doesn't mess up the code) mishoo I recently released UglifyJS , a JavaScript compressor which is written in JavaScript (runs on the NodeJS Node.js platform, but it can be easily modified to run on any JavaScript engine, since it doesn't need any Node.js internals). It's a lot faster than both YUI Compressor and Google Closure , it compresses better than YUI on all scripts I tested it on, and it's safer than Closure (knows to deal with "eval

Read whole text files from a compression in Spark

强颜欢笑 提交于 2019-11-26 13:45:57
I have the following problem: suppose that I have a directory containing compressed directories which contain multiple files, stored on HDFS. I want to create an RDD consisting some objects of type T, i.e.: context = new JavaSparkContext(conf); JavaPairRDD<String, String> filesRDD = context.wholeTextFiles(inputDataPath); JavaPairRDD<String, String> filesRDD = context.wholeTextFiles(inputDataPath); JavaRDD<T> processingFiles = filesRDD.map(fileNameContent -> { // The name of the file String fileName = fileNameContent._1(); // The content of the file String content = fileNameContent._2(); //