Jump to content

aebstract

Members
  • Posts

    1,105
  • Joined

  • Last visited

Everything posted by aebstract

  1. s = height, right? Anyway, I played around a little and made a big thumbnail just to see save quality, did a 600 width on mine and (I guess 600 height) on yours. Check out how mine came out: http://outlawracing.com/gallery/Flyers/thumbs/huntsvillecard.jpg
  2. Could you start with something as basic as making a random number 1-12 and if its 1-5 bob wins, 6-9 sue wins and 10-12 andy wins? Of course it's gonna change up depending on number of people pooling in I suppose, but something along that very basic idea should do this?
  3. <- before | after ->
  4. imagejpeg($dimg, "$tdir" . $url, 100); // Saving The Image this seems to actually look a bit better as far as save quality, maybe now it's a resizing (size) issue?
  5. Sure, you can try this one: http://outlawracing.com/gallery/Flyers/huntsvillecard.jpg be cool if you got it to do 200 width just for testing.
  6. My script looks just about the same, and my max is 200 width, no max height. So I am resizing dependent on the width. Here is an update: $idir = "gallery/$_POST[category]/"; // Path To Images Directory $tdir = "gallery/$_POST[category]/thumbs/"; // Path To Thumbnails Directory $twidth = "200"; // Maximum Width For Thumbnail Images $theight = "900"; // Maximum Height For Thumbnail Images // Uploading/Resizing Script $url = $_FILES['imagefile']['name']; // Set $url To Equal The Filename For Later Use if ($_FILES['imagefile']['type'] == "image/jpg" || $_FILES['imagefile']['type'] == "image/jpeg" || $_FILES['imagefile']['type'] == "image/pjpeg") { $file_ext = strrchr($_FILES['imagefile']['name'], '.'); // Get The File Extention In The Format Of , For Instance, .jpg, .gif or .php $copy = copy($_FILES['imagefile']['tmp_name'], "$idir" . $_FILES['imagefile']['name']); // Move Image From Temporary Location To Permanent Location if ($copy) { // If The Script Was Able To Copy The Image To It's Permanent Location print 'Image uploaded successfully.<br />'; // Was Able To Successfully Upload Image $simg = imagecreatefromjpeg("$idir" . $url); // Make A New Temporary Image To Create The Thumbanil From $currwidth = imagesx($simg); // Current Image Width $currheight = imagesy($simg); // Current Image Height $newwidth = 200; $deci = 200 / $currwidth; $newheight = $currheight * $deci; $dimg = imagecreate($newwidth, $newheight); // Make New Image For Thumbnail imagetruecolortopalette($simg, false, 256); // Create New Color Pallete $palsize = ImageColorsTotal($simg); for ($i = 0; $i < $palsize; $i++) { // Counting Colors In The Image $colors = ImageColorsForIndex($simg, $i); // Number Of Colors Used ImageColorAllocate($dimg, $colors['red'], $colors['green'], $colors['blue']); // Tell The Server What Colors This Image Will Use } imagecopyresampled($dimg, $simg, 0, 0, 0, 0, $newwidth, $newheight, $currwidth, $currheight); // Copy Resized Image To The New Image (So We Can Save It) imagejpeg($dimg, "$tdir" . $url); // Saving The Image imagedestroy($simg); // Destroying The Temporary Image imagedestroy($dimg); // Destroying The Other Temporary Image print 'Image thumbnail created successfully.'; // Resize successful } else { print '<font color="#FF0000">ERROR: Unable to upload image.</font>'; // Error Message If Upload Failed } } else { print '<font color="#FF0000">ERROR: Wrong filetype (has to be a .jpg or .jpeg. Yours is '; // Error Message If Filetype Is Wrong print $file_ext; // Show The Invalid File's Extention print '.</font>'; } } I changed the imagecopyresized to imagecopyresampled and it didn't affect anything.
  7. Where are you setting new heights? $w and $h?
  8. Is there a way to make the image quality better after resize? Here is the script I am using: $idir = "gallery/$_POST[category]/"; // Path To Images Directory $tdir = "gallery/$_POST[category]/thumbs/"; // Path To Thumbnails Directory $twidth = "200"; // Maximum Width For Thumbnail Images $theight = "900"; // Maximum Height For Thumbnail Images // Uploading/Resizing Script $url = $_FILES['imagefile']['name']; // Set $url To Equal The Filename For Later Use if ($_FILES['imagefile']['type'] == "image/jpg" || $_FILES['imagefile']['type'] == "image/jpeg" || $_FILES['imagefile']['type'] == "image/pjpeg") { $file_ext = strrchr($_FILES['imagefile']['name'], '.'); // Get The File Extention In The Format Of , For Instance, .jpg, .gif or .php $copy = copy($_FILES['imagefile']['tmp_name'], "$idir" . $_FILES['imagefile']['name']); // Move Image From Temporary Location To Permanent Location if ($copy) { // If The Script Was Able To Copy The Image To It's Permanent Location print 'Image uploaded successfully.<br />'; // Was Able To Successfully Upload Image $simg = imagecreatefromjpeg("$idir" . $url); // Make A New Temporary Image To Create The Thumbanil From $currwidth = imagesx($simg); // Current Image Width $currheight = imagesy($simg); // Current Image Height if ($currheight > $currwidth) { // If Height Is Greater Than Width $zoom = $twidth / $currwidth; // Length Ratio For Height $newwidth = $twidth; // Width Is Equal To Max Width $newheight = $currheight * $zoom; // Creates The New Height } else { // Otherwise, Assume Width Is Greater Than Height (Will Produce Same Result If Width Is Equal To Height) $zoom = $twidth / $currwidth; // Length Ratio For Height $newwidth = $twidth; // Width Is Equal To Max Width $newheight = $currheight * $zoom; // Creates The New Height } $dimg = imagecreate($newwidth, $newheight); // Make New Image For Thumbnail imagetruecolortopalette($simg, false, 256); // Create New Color Pallete $palsize = ImageColorsTotal($simg); for ($i = 0; $i < $palsize; $i++) { // Counting Colors In The Image $colors = ImageColorsForIndex($simg, $i); // Number Of Colors Used ImageColorAllocate($dimg, $colors['red'], $colors['green'], $colors['blue']); // Tell The Server What Colors This Image Will Use } imagecopyresized($dimg, $simg, 0, 0, 0, 0, $newwidth, $newheight, $currwidth, $currheight); // Copy Resized Image To The New Image (So We Can Save It) imagejpeg($dimg, "$tdir" . $url); // Saving The Image imagedestroy($simg); // Destroying The Temporary Image imagedestroy($dimg); // Destroying The Other Temporary Image print 'Image thumbnail created successfully.'; // Resize successful } else { print '<font color="#FF0000">ERROR: Unable to upload image.</font>'; // Error Message If Upload Failed } } else { print '<font color="#FF0000">ERROR: Wrong filetype (has to be a .jpg or .jpeg. Yours is '; // Error Message If Filetype Is Wrong print $file_ext; // Show The Invalid File's Extention print '.</font>'; } }
  9. Hey thanks I was able to get both the directories and list of files in them separate with this.
  10. $dir = 'gallery/'; $categories = scandir($dir); $categories = array_slice($categories, 2); The reason I am slicing is because it returns 2 extra values "." and ".." that I do not need. When I run this, I'm getting back folders and files, obviously. How can I get a list of only the directories? I'm going to need to be able to do the same and get only files as well. Working with nothing but .jpg and folders here.
  11. What's the method for creating a variable using another variable in the name of it? For instance: for ($variable = 1; $variable <= 9; $variable++) { I want to create the following: $var1 $var2 $var3 etc The number being generated off of "$variable"
  12. It's really hard to help without seeing the code in subject.
  13. <?php ini_set('display_errors',1); error_reporting(E_ALL); ?> Put that at the very top and see if you get anything. You're getting a white page? Sometimes if you don't get errors you can check your server's error logs and get them that way. Some white screens don't get to show a message as I've encountered.
  14. I think I was mistaken and this was correct, but what about the error? Fatal error: Cannot redeclare compare() (previously declared in /home/orsca/public_html/ladders.php:183) in /home/orsca/public_html/ladders.php on line 183 It appears once it gets through the first array "4.70 Index" and moves on to the next "5.30 Index".
  15. $query = mysql_query("SELECT r.firstname, r.lastname, IF(above.et IS NOT NULL, above.et, below.et) FROM registrations as r LEFT JOIN (SELECT regid, MIN(et) AS et FROM index_q WHERE et >= 4.7 AND eventid = '{$_GET['event']}' GROUP BY regid) AS above USING (ON r.id = above.regid) LEFT JOIN (SELECT regid, MAX(et) AS et FROM index_q WHERE et < 4.7 AND eventid = '{$_GET['event']}' GROUP BY regid) AS below USING (ON r.id = below.regid) WHERE r.class = '$var'") or DIE(mysql_error()); You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'ON r.id = above.regid) LEFT JOIN (SELECT regid, MAX(et) AS et FROM index_q WHE' at line 7
  16. Can't post the full array due to it being too long, but. It's moving people out of their index in to another. So this array has 4: 4.70 index, 5.30 index, 6.00 index, 7.00 index. My final output was: Array ( [4.70 Index] => Array ( [7] => Array ( [firstname] => Mike [lastname] => Ghee [q1] => 99.999 [q2] => 5.045 [q3] => 5.045 [regid] => 120 [eventid] => 1 [bq] => 5.045 ) [2] => Array ( [firstname] => Jeremy [lastname] => Ellis [q1] => 5.044 [q2] => 5.044 [q3] => 5.044 [regid] => 114 [eventid] => 1 [bq] => 5.044 ) [6] => Array ( [firstname] => Jody [lastname] => Voyles [q1] => 99.999 [q2] => 4.973 [q3] => 4.973 [regid] => 123 [eventid] => 1 [bq] => 4.973 ) [8] => Array ( [firstname] => Jeff [lastname] => Wilkerson [q1] => 5.026 [q2] => 4.902 [q3] => 4.902 [regid] => 217 [eventid] => 1 [bq] => 4.902 ) [3] => Array ( [firstname] => Randy [lastname] => Alexander [q1] => 4.822 [q2] => 4.755 [q3] => 4.755 [regid] => 119 [eventid] => 1 [bq] => 4.755 ) [5] => Array ( [firstname] => Isreal [lastname] => Deraney [q1] => 4.794 [q2] => 4.732 [q3] => 4.732 [regid] => 122 [eventid] => 1 [bq] => 4.732 ) [0] => Array ( [firstname] => Kenny [lastname] => Acree [q1] => 4.730 [q2] => 4.730 [q3] => 4.730 [regid] => 117 [eventid] => 1 [bq] => 4.730 ) [4] => Array ( [firstname] => Scott [lastname] => Underwood [q1] => 4.730 [q2] => 4.706 [q3] => 4.706 [regid] => 28 [eventid] => 1 [bq] => 4.706 ) [1] => Array ( [firstname] => Blake [lastname] => Wilder [q1] => 4.685 [q2] => 5.161 [q3] => 5.023 [regid] => 121 [eventid] => 1 [bq] => 4.685 ) ) ) Fatal error: Cannot redeclare compare() (previously declared in /home/orsca/public_html/ladders.php:183) in /home/orsca/public_html/ladders.php on line 183 Not just the error, but the people are being put in to 4.70 when they are in other classes.
  17. [quote[Kenny Acree 4.730 Blake Wilder 4.685 Jeremy Ellis 5.044 Randy Alexander 4.822 Scott Underwood 4.730 Isreal Deraney 4.794 Jody Voyles 0.000 Mike Ghee 0.000 Mike Herring 4.616 Jeff Wilkerson 5.026 Kenny Acree 4.730 Blake Wilder 5.161 Jeremy Ellis 5.044 Randy Alexander 4.755 Scott Underwood 4.706 Isreal Deraney 4.732 Jody Voyles 4.973 Mike Ghee 5.045 Mike Herring 4.669 Jeff Wilkerson 4.902 Kenny Acree 4.730 Blake Wilder 5.023 Jeremy Ellis 5.044 Randy Alexander 4.755 Scott Underwood 4.706 Isreal Deraney 4.732 Jody Voyles 4.973 Mike Ghee 5.045 Mike Herring 4.686 Jeff Wilkerson 4.902 It's just showing their q1, q2, q3 times. So it's showing all the times not just the one needed for ordering, it's just clumping them in groups.
  18. This orders based on bq, but it's moving them out of their array's main name to another. foreach ($indexH[$var] as $key => $value) { uasort($indexH[$var], 'compare'); } $index contains 4 arrays, set by $var. I also ran in to an error, which is odd. After it ran through the first array of the 4, it cut the script short and produced: Fatal error: Cannot redeclare compare() (previously declared in /home/orsca/public_html/ladders.php:183) in /home/orsca/public_html/ladders.php on line 183
  19. Array ( [4.70 Index] => Array ( [0] => Array ( [firstname] => Kenny [lastname] => Acree [q1] => 4.730 [q2] => 4.730 [q3] => 4.730 [regid] => 117 [eventid] => 1 [bq] => 4.730 ) [1] => Array ( [firstname] => Blake [lastname] => Wilder [q1] => 4.685 [q2] => 5.161 [q3] => 5.023 [regid] => 121 [eventid] => 1 [bq] => 4.685 ) [2] => Array ( [firstname] => Jeremy [lastname] => Ellis [q1] => 5.044 [q2] => 5.044 [q3] => 5.044 [regid] => 114 [eventid] => 1 [bq] => 5.044 ) [3] => Array ( [firstname] => Randy [lastname] => Alexander [q1] => 4.822 [q2] => 4.755 [q3] => 4.755 [regid] => 119 [eventid] => 1 [bq] => 4.755 ) [4] => Array ( [firstname] => Scott [lastname] => Underwood [q1] => 4.730 [q2] => 4.706 [q3] => 4.706 [regid] => 28 [eventid] => 1 [bq] => 4.706 ) [5] => Array ( [firstname] => Isreal [lastname] => Deraney [q1] => 4.794 [q2] => 4.732 [q3] => 4.732 [regid] => 122 [eventid] => 1 [bq] => 4.732 ) [6] => Array ( [firstname] => Jody [lastname] => Voyles [q1] => 99.999 [q2] => 4.973 [q3] => 4.973 [regid] => 123 [eventid] => 1 [bq] => 4.973 ) [7] => Array ( [firstname] => Mike [lastname] => Ghee [q1] => 99.999 [q2] => 5.045 [q3] => 5.045 [regid] => 120 [eventid] => 1 [bq] => 5.045 ) [8] => Array ( [firstname] => Jeff [lastname] => Wilkerson [q1] => 5.026 [q2] => 4.902 [q3] => 4.902 [regid] => 217 [eventid] => 1 [bq] => 4.902 ) ) )
  20. I can look at a normal sort all day and not know how to apply it to something that needs to be sorted in a more specialized way. With this array being $indexH, my $var = Index 4.70. I'm trying to change their order in Index 4.70, the [0],[1],[2], etc. Based on the value of the bq field in that array.
  21. array: $indexH foreach ( $indexH[$var] as $val ){ array holds id, regid, eventid, q1, q2, q3, bq Is there a way to take each item from $indexH[$var] and reorder their index based on bq ordering from least to greatest? Is there some sort of order function?
  22. Winner: foreach ( $indexL[$var] as $val ){ $content .= "$val[firstname] $val[lastname] $val[q1] $val[q2]<br />"; }
  23. foreach ( $indexL[$var] as $val ){ foreach ( $val as $final_val ){ $content .= "$final_val[firstname]<br>"; } } I don't see what in this would cause only the first character of each value to be returned?
  24. Okay, I've got this query working sort of: $query = mysql_query("SELECT i.regid, i.eventid, i.et, r.firstname, r.lastname, IF(above.et IS NOT NULL, above.et, below.et) FROM index_q as i LEFT JOIN (SELECT regid, MIN(et) AS et FROM index_q WHERE et >= 4.7 GROUP BY regid) AS above USING (regid) LEFT JOIN (SELECT regid, MAX(et) AS et FROM index_q WHERE et < 4.7 GROUP BY regid) AS below USING (regid) LEFT JOIN registrations AS r ON r.id = i.regid WHERE r.class = '$var' && i.eventid = '$_GET[event]'") or DIE(mysql_error()); if(mysql_num_rows($query)!=0){ while($r=mysql_fetch_array($query)) { $content .= "$r[firstname] $r[lastname] $r[et]<br />"; } } With an output of this: This doesn't seem to have any ordering to it though, and is there any way to loop through each person individually so I can put their times beside eachother when I loop through? firstname lastname et1 et2 et3
  25. I'm going to be putting them in a specific order, once I figure out how to get that information. Why all the questions instead of getting the value to display?
×
×
  • 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.