Jump to content

scott212

Members
  • Posts

    58
  • Joined

  • Last visited

    Never

Everything posted by scott212

  1. Is it alot more overhead to resize an image when the page loads than just loading it as is? I'm trying to decide wether to make a fixed size thumbnail along with the users image upload or just take one image and resize it each time. Any thoughts?
  2. using your current setup - does the page load end up giving you an error or just not displaying it at all? If it at least shows the page, view the source of the page and look at what the it is spitting out. That should help you narrow it down or post it up here if you can't get it (just the relevant parts). If it gives you an error - tell us that too.
  3. it's  fairly simple really, you've already done the hard parts if you have the entries in a database you would do a SELECT statement with an asterisk (*) for an identifier. Here is a great tutorial to get things from your database. http://www.tizag.com/mysqlTutorial/mysqlfetcharray.php Other than that, you were on the right track. Loop over the array and print your links into the thumbnails or list or whatever. For the html you can do like you suggested, for the source of the href tag, use: <? echo "<a href=\"page.php?image=".$array[$n]."\">Link to $array[$n]</a>\n"; ?> Then on the page you link to place at the beginning something like: <? if (isset($_GET['image'])) {   $image = $_GET['image']; } ?> and then later on down the page where you want the image to be displayed, just use: <img src="<? echo $image; ?>" /> I've done something just like this on my personal page www.scottwillmanvfx.com you can check out my urls
  4. It may have fixed it but unless you specifically need that, it's not your best option. You'll have more server overhead now since php will process ALL of the web requests if your site is made up of html and php files.
  5. I would do a foreach loop over the array (or while or for). That way you have a value to work with. Chances are it's not finding it due to the file's line returns on each line. If you could trim(value) before comparing the current line to what you want, I think you'd find it.
  6. why don't you just change the file extension to .php? I'm quite surprised you've come this far and are not aware of this. Pretty fundamental
  7. I think it's generally better to focus on what you DO want in the blank, that will help you weed out the unknown attack. What are you trying to except? Is it a name? number? email? Regular expressions are key in data validation. I generally work it something like this: $error = 0; $test_alpha = "[a-zA-Z]{1,25}"; // regular expression: must only be upper or lower case letters and at least 1 and no more than 25 if (ereg($test_alpha, $input)) { // if the input meets the conditions of the regular expression, do stuff   do stuff; }
  8. If your looking into regex as a noob, I would highly suggest Expresso -> it's free and a hell of a tutor/tool
  9. Doing some more experimenting: 2500x865 @ 758K - pass 3000x990 @ 1099K - pass 5000x1650 @ 865K - fail So it's the extreme resolutions that are causing the fail and not the file size. That really leads me to believe that it's is ram available for processing. I could see putting in a condition for max width and height, I've just never seen anyone do that before.
  10. I checked the max upload size and it's 20MB. The jpg in question has a very large resolution (8000x8000) as a test but file size is only 1.05 MB. Do I need the 'memory_limit' in the php.ini increased? Is there any way to handle this if I can't get it upped?
  11. I can't figure it out and I can't get a decent error out of it. In a class I have a basic routine to handle an uploaded image and resize it. It works fine on images less than 1MB but anything over just gives a silent death. I've narrowed it down to the specific 'imagecreatefromjpeg' line by putting prints above and after it and only the top one prints. The line is: $this->src_image = imagecreatefromjpeg($this->in_image) or die("could not open image"); Please - I'm pulling my hair out!
  12. Both of these are excellent suggestions. Thorpe- So would you treat your way similar to throwing exceptions by having a corresponding if-else for each possibility of true or false? I suppose otherwise you might not have any idea which method it came from making debugging a pain in the arse.
  13. I have some code in a function that has a die statement with a message. I want it to give me back an error message on fail but I don't want it to stop loading the rest of the page. What should I do?
  14. excellent information! thank you all very much
  15. [quote]In php5 you should throw exceptions and have your client code handle them.[/quote] not sure what he means by 'throw exceptions'
  16. thanks for your reply Thorpe - and pardon the newbieism, but could you give any kind of example?
  17. I just noticed I missed the $this-> preceding the err_handler calls
  18. I've had a few rounds with some classes and I'm loving it. But I've gotten to the point where I've got some theory questions. When I purposely make a mistake inside one of the functions below, the error doesn't report if the die statement is on the function call like below. How would err handling usually be handled inside of a class? Also, does anyone see anything I'm doing majorly wrong or innefficient? Here's the class structure that sparked it: [code]<?php class do_stuff {   var error = 0;   var message; function get_input ($input_1, $input_2) {   $this->var_1 = $input_1;   $this->var_2 = $input_2; } function method_1() {   do stuff here; } function method_2() {   do stuff here; } function err_handler($message) {   $this->error = 1;   $this->message = $message; } function main() {   $this->method_1() or die(err_handler("error on method_1"));   $this->method_2() or die(err_handler("error on method_2"));   $output = array($this->error, $this->message);   return $output } } ?>[/code] and of course the call: [code]<?php $doClass = new do_stuff; $doClass->get_input($a, $b); $return = $doClass->main; echo $return[0]."<br>".$return[1]; ?>[/code]
  19. wow - I can't believe how quick to respond this community is. You suggestions are great, thank you! (I think I like the regular way for clarity reasons)
  20. is there any way to evaluate multiple values in an 'if' condition? Example: if ($value != 1,2,3,4)  or if ($value == 1||2||3||4||) Do you know of anything like this? I can't seem to find anything on google. Sure would clean up some code
  21. $accountnum=$row['accountnum']; echo '<center>'; echo "<a href=\"descrip.php?accountnum=$accountnum\">"; As with Perl, I'm pretty sure php does variable interpolation within double quotes and remains verbatim with single quotes. In this case it would be just as easy to stay with double quotes on your last statement and escape the inner html qoutes. Your $accountnum will still be replaced.
  22. That's what crayon mentioned earlier, but how would [i]you [/i]address the logged out status?
  23. well you obviously have the internet... Never seen a bigger book!  ;D
  24. I agree with said patience level and don't want to be the shmuck that encourages this type of forum use. But given what you said previously about your own patience level, hopefully he gets the point. [b]Point:[/b] Google is your friend. A search for 'php redirect' gave a perfect answer to your question about redirection in the first return. Try it out (read step 2). I would recommend to save face in future posts and not get flamed, indicate that you have done some research on your question before you exceedingly reply with more questions about the same problem. Good replies like those given here should be more than enough to get you on your way. If a topic lasts more than a couple pages, it's generally something very interesting or someone getting flamed. Best of luck - don't be discouraged
×
×
  • 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.