Jump to content

AdrianBV

New Members
  • Posts

    3
  • Joined

  • Last visited

AdrianBV's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. not really ... you have one other option ... another table that will record every change. For example: your master table is: id, name, address, phone you could make a second table with the following structure: id, id_changed, changed_var, prev_value, current_value, changed_date, ip or user_id ( etc ) and for every update of a row you could insert a line in the second table like this: 2, address, Lake City, Lake City 3, 2013-03-03 12:32:23, 232.23.223.23 for every new row added in the master table you could do the same but leave empty the prev_value ( or maybe add a TINYINT in the second table to set as 1 or 0 if it's a new row or a update ) If there are a lot of changes the second table could get big but if you really want to track everything this is the ONLY way you can. With this implementation you can see every modification to each id or even the whole table at a precise moment in time. If you have any other questions feel free to ask.
  2. hi to all. I've been beating my head against the wall for a couple of days now trying to save a image as a valid ICNS file ( ICNS is the icon format for Mac OS ). Let's say I have a image of 128 x 128. I've managed to get the color and opacity for each pixel but I'm not really sure how the ICNS file format wants this data compressed. I found some pseudo-code but i can't figure out from that what I have to do: http://www.macdisk.com/maciconen.php3#RLE More info about icns file can be found on wiki: http://en.wikipedia.org/wiki/Apple_Icon_Image Does anybody have any good ideeas about this ? As wiki says, ( for example ) the 128 x 128 icns file should have the header it32, the 48x48 ih32, the 32x32 - il32 and the 16x16 - is32 $im = imagecreatefrompng("128.png"); $width = imagesx( $im ); $height = imagesy( $im ); $pixel_data = array(); $opacity_data = array(); $current_opacity_val = 0; for ( $y = $height - 1; $y >= 0; $y-- ) { for ( $x = 0; $x < $width; $x++ ) { $color = imagecolorat( $im, $x, $y ); $alpha = ( $color & 0x7F000000 ) >> 24; $alpha = ( 1 - ( $alpha / 127 ) ) * 255; $color &= 0xFFFFFF; $color |= 0xFF000000 & ( $alpha << 24 ); $pixel_data[] = $color; $opacity = ( $alpha <= 127 ) ? 1 : 0; $current_opacity_val = ( $current_opacity_val << 1 ) | $opacity; if ( ( ( $x + 1 ) % 32 ) == 0 ) { $opacity_data[] = $current_opacity_val; $current_opacity_val = 0; } } if ( ( $x % 32 ) > 0 ) { while ( ( $x++ % 32 ) > 0 ) $current_opacity_val = $current_opacity_val << 1; $opacity_data[] = $current_opacity_val; $current_opacity_val = 0; } } Thanks in advance for any help you can offer.
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.