filesize

smallest filesize for transparent single pixel image

I'm looking for the smallest (in terms of filesize) transparent 1 pixel image. Currently I have a gif of 49 bytes which seems to be the most popular. But I remember many years ago having one which was less than 40 bytes. Could have been 32 bytes. Can anyone do better? Graphics format is no concern as long as modern web browsers can di...

What is the lightest way to make a huge chess-like grid?

Hey there I'm working on a browser-game and I can't help but wonder about what's the lightest way to make the grid/board on which the game takes place. Right now, as a mere sample, I'll show you this: -link no longer active, it was basically a 25x25 table+tr+td grid- Now, as the grid gets bigger and bigger, the table and its td's cre...

PHP: Problem with filesize

I need a little help here: I get a file from an HTML upload form. And I have a "target" filename in $File. When I do this: copy($_FILES['binfile']['tmp_name'], $File); echo '<hr>' . filesize($_FILES['binfile']['tmp_name']); echo '<hr>' . filesize($File); Everything works fine. I get the same number twice. However when I delete the ...

Way to reduce size of .ttf fonts?

Hello , Is there any way to reduce the size of the .ttf fonts? i.e. if we want to remove some glyps which we are not using. ...

Finding file size and last modified of SFTP file using Java

I'm using JSch to get files from an SFTP server, but I'm trying to figure out a way to only get the oldest file, and to make sure that it is not currently being written to. The way I imagine myself doing this is first finding which file in the specified remote folder is oldest. I would then check the file size, wait x seconds (probably a...

How can I get file size in Perl before processing an upload request?

I want to get file size I'm doing this: my $filename=$query->param("upload_file"); my $filesize = (-s $filename); print "Size: $filesize ";` Yet it is not working. Note that I did not upload the file. I want to check its size before uploading it. So to limit it to max of 1 MB. ...

How can I check that I downloaded the entire file in Perl?

Does the test of the file-size make sense here? I tried to cut the connection while downloading, but it looks like the size-test is never reached. #!/usr/bin/env perl use warnings; use strict; use 5.012; use LWP::Simple; my $url = 'http://www.kernel.org/pub/linux/kernel/v2.6/next/patch-v2.6.34-rc5-next-20100428.bz2'; my $file = 'next...

iPhone Image Resources, ICO vs PNG, app bundle filesize

My application has a collection of around 1940 icons that are used throughout. They're currently in ICO and new images provided to me come in ICO format too. I have noticed that they contain a 16x16 and 32x32 representation of each icon in one file. Each file is roughly 4KB in filesize (as reported by finder, but ls reports that they v...

Copying files to an encrypted USB drive leads to major fillup

Hi, I have a Kingston Datatraveller Vault privacy edition with 8 GIG of space and I use a home-made program to copy images to it. Thing is, the amount of space needed for the images cab to be high as 3 times the actual size of the file while it's usually almost on par on a PC. It doesn't seem to affect other types of file though. Does...

Query size of block device file in Python

Hello. I have a Python script that reads a file (typically from optical media) marking the unreadable sectors, to allow a re-attempt to read said unreadable sectors on a different optical reader. I discovered that my script does not work with block devices (e.g. /dev/sr0), in order to create a copy of the contained ISO9660/UDF filesyst...

javax.activation.DataSource size question

How do I get the amount of physical memory, consumed by the DataSource (specifically — ByteArrayDataSource)? I use javax.mail.util.ByteArrayDataSource (byte[] bytes, String type) constructor, where I get bytes like this: String str = "test"; byte[] bytes = str.getBytes(); Would that be str.length() in bytes? Any other ideas? ...

How can I find the size of a ELF file/image with Header information?

I need to find the size of an elf image for some computation. I have tried with the readelf utility on linux which gives the informations about the headers and section. I need to have the exact file size of the elf(on the whole). How do I find the size of the ELF from the header information or Is there any other means to find the size o...

How to monitor the size of a XElement

I am creating an XML document line by line and need to keep an eye on how large this file is becoming. The resulting file will need to be sent via MSMQ which has a message size restriction of 4Mb I think. What I need to do is when the document is getting close to this size, is to stop adding data and to add the document to a list and sta...

Converting filesize string to kilobyte equivalent in Rails

Hello, My objective is to convert form input, like "100 megabytes" or "1 gigabyte", and converts it to a filesize in kilobytes I can store in the database. Currently, I have this: def quota_convert @regex = /([0-9]+) (.*)s/ @sizes = %w{kilobyte megabyte gigabyte} m = self.quota.match(@regex) if @sizes.include? m[2] eval("se...

sparse file usage in python

I'm creating sparse files in python as follows: >>> f = open('testfile', 'ab') >>> f.truncate(1024000) >>> f.close() when the file is done, it takes up 0 disk space, but its inode size is set to my truncated value (1000K): igor47@piglet:~/test$ ls -lh testfile -rw-r--r-- 1 igor47 igor47 1000K 2010-07-09 04:02 testfile igor47@piglet:...

Reading remote file size using filesize

Hi, I read the manual that filesize() is able to calculate file size from remote file. However, when I try to do that with snippet below. I got error PHP Warning: filesize(): stat failed for http://someserver/free_wallpaper/jpg/0000122_480_320.jpg in /tmp/test.php on line 5 Here's my snippet: $file = "http://someserver/free_wallpaper...

PHP: get remote file size with strlen? (html)

I was looking at PHP docs for fsockopen and whatnot and they say you can't use filesize() on a remote file without doing some crazy things with ftell or something (not sure what they said exactly), but I had a good thought about how to do it: $file = file_get_contents("http://www.google.com"); $filesize = mb_strlen($file) / 1000; //KBs,...

Calculating the disk space a string would take up without saving it to disk

I'm writing an app where I want to compare two strings' size. By size, I mean the disk space they would take up if they were directly saved to the disk. Is it possible to calculate the size of a string in C# without saving it to disk and checking the file information (unless it is more efficient to save it to disk)? ...

PHP image resizing not working. Is there a file size limit?

I'm using a simple image manager class, and the following code: <?php include('SimpleImage.php'); $image = new SimpleImage(); $image->load($target_path); if($image->getWidth() > 500) { $image->resizeToWidth(500); echo "<p>Image Resized</p>"; } else echo "<p>Image did not need to be resized.</p>"; $image->save($target_path); echo...

Get the size of an image file

Images and script hosted on the same account (one site). We know direct link to each image: $image = "http://site.com/images/full-1091.jpg" How can we get the size of this file? Like: { do something with $image and get $image_size } echo $image_size; Its better to format $image_size like "156,8 Kbytes" or "20,1 Mbytes". Thanks. ...