pixel resize without blur

It should do both, I think the empty cells are caused by the “.” and “…”.

Yes. That did fix the count and the one empty cell.

I need to move the Items in table: 322. Table is sorted alphabetically. table above the icons. For the last two empty cells, I’ll add two more icons, unless there is a simple solution.

I got the items-count (almost) where I wanted it. The alphabetical version is now live. And hey, even two more icons!

Now I’m thinking about draw function (in the large grid). Like http://tinyiconfactory.com. And flip, save, preview, invert and stuff like that comes to mind.

As of now I must wait until I have 36 more icons to upload them due to the collapsing cells issue. Anyone got a simple solution / suggestion for this?

Most important part of mission accomplished. Mostly by you. :wink:

This should solve the collapsing cell issue:

[php]<?php
$arrFiles = array_diff(scandir(“ico”, 0), array(".", “…”));
$arrFiles = array_values($arrFiles);
$intCountFiles = count($arrFiles);
for ($intCount = 0; $intCount < $intCountFiles; $intCount++) {
$strImage = str_ireplace(".gif", “”, $arrFiles[$intCount]);
echo ‘

' . $strImage . '’ . “\n”;
if (($intCount+1) % 36 == 0) { // each 36th line
echo ‘’ . “\n\t” . ‘’ . “\n”;
}
}
$intRemainder = 36-($intCountFiles % 36);
for ($intCount = 0; $intCount < $intRemainder; $intCount++) {
echo ’ ';
}
?>[/php]

This will allow you to modify the number of columns in each row by setting the value of one variable:

[php]<?php
$arrFiles = array_diff(scandir(“ico”, 0), array(".", “…”));
$arrFiles = array_values($arrFiles);
$intCountFiles = count($arrFiles);
$intColumns = 36; // The number of columns in each row
for ($intCount = 0; $intCount < $intCountFiles; $intCount++) {
$strImage = str_ireplace(".gif", “”, $arrFiles[$intCount]);
echo ‘

' . $strImage . '’ . “\n”;
if (($intCount+1) % $intColumns == 0) { // each $intColumns line
echo ‘’ . “\n\t” . ‘’ . “\n”;
}
}
$intRemainder = $intColumns-($intCountFiles % $intColumns);
for ($intCount = 0; $intCount < $intRemainder; $intCount++) {
echo ’ ';
}
?>[/php]

True that. But also adds extra line when not needed.

http://www.flamencopeko.net/icons_3.php

That happens if it’s an exact match. I can sort that, but I’m just off out now, so it’ll have to wait. ;D

Very cool. No rush.

Here you go:

[php]<?php
$arrFiles = array_diff(scandir(“ico”, 0), array(".", “…”));
$arrFiles = array_values($arrFiles);
$intCountFiles = count($arrFiles);
$intColumns = 22; // The number of columns in each row
for ($intCount = 0; $intCount < $intCountFiles; $intCount++) {
$strImage = str_ireplace(".gif", “”, $arrFiles[$intCount]);
echo ‘

' . $strImage . '’ . “\n”;
if ((($intCount+1) % $intColumns == 0)&&($intCount+1 != $intCountFiles)) { // each $intColumns line
echo ‘’ . “\n” . ‘’ . “\n”;
}
}
if ($intCountFiles % $intColumns != 0) {
$intRemainder = $intColumns-($intCountFiles % $intColumns);
for ($intCount = 0; $intCount < $intRemainder; $intCount++) {
echo ‘’;
}
}
?>[/php]

Thanks. I changed 22 back to 36. Then everything seemed fine. 22 messed up the table and the count. Where did you get 22 from? Then I added three more icons, and the empty cells didn’t collapse. That’s great. But it also caused the count to say 33.

This is what I have now:

[php]

<?php $arrFiles = array_diff(scandir("ico", 0), array(".", "..")); $arrFiles = array_values($arrFiles); $intCountFiles = count($arrFiles); $intColumns = 36; // The number of columns in each row for ($intCount = 0; $intCount < $intCountFiles; $intCount++) { $strImage = str_ireplace(".gif", "", $arrFiles[$intCount]); echo '' . $strImage . '' . "\n"; if ((($intCount+1) % $intColumns == 0)&&($intCount+1 != $intCountFiles)) { // each $intColumns line echo '' . "\n" . '' . "\n"; } } if ($intCountFiles % $intColumns != 0) { $intRemainder = $intColumns-($intCountFiles % $intColumns); for ($intCount = 0; $intCount < $intRemainder; $intCount++) { echo ''; } } ?>
<?php // show number of icons print("
\n"); print("Items in table: $intCount. Table is sorted alphabetically.\n"); print("

\n"); ?>

[/php]

What does that last line [php]echo ‘

’;[/php] do?

Change this line to use $intCountFiles:

[php]print(“Items in table: $intCountFiles. Table is sorted alphabetically.\n”);[/php]

What this bit does is look for the remainder and produce the empty table cells with no image in them necessary so that the table has the same number of cells in every row:

[php]
if ($intCountFiles % $intColumns != 0) {
$intRemainder = $intColumns-($intCountFiles % $intColumns);
for ($intCount = 0; $intCount < $intRemainder; $intCount++) {
echo ‘

’;
}
}
[/php]

So if you have 322 files and there are 36 columns, or table cells per row:

322/36 = 8.9444… which is 9 rows, 8 rows of 36 and 34 in the last row, so we need two extra empty cells.

This line [php]$intRemainder = $intColumns-($intCountFiles % $intColumns);[/php] works this out:

322 modulo 36 = 34
36 - 34 = 2
$intRemainder = 36-(322 modulo 36)

I did change $intCountFiles and nothing happened. But now that you told me to it did. Sorry. Everything seems fine now. :slight_smile: And thanks for the in-depth explanations.

Hi. I’m back. :wink: Still working fine at http://flamencopeko.net/icons.php. But it blurs in Google Chrome. Any solution for this?

Sponsor our Newsletter | Privacy Policy | Terms of Service