Jump to content

flambo

New Members
  • Posts

    9
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

flambo's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Hi, I have a website that in part requires people to upload images - problem is not everyone is going to be photo savvy, so I will need a way to dynamically organise the images. People will be uploading web friendly images to those taken straight from a digital camera. They are going to be different dimensions, different compressions, different sizes (kb - mb), portrait, landscape etc. My biggest concern is holding large images that consume a lot of server space. Having a copy of the Hi-res image is not important. I probably will just want to save the image with a flexible height but constrained to around a 640 width and create 2 or 3 different thumbnails from it. (Which will hopefully sort my image size concern?) Would be nice to give the option to upload multiple images and crop them. Probably will only ever deal with jpeg but gif, bmp and PNG might be good too. Ive been looking at a script here http://www.mjdigital.co.uk/blog/php-upload-and-resize-image-class/ which looks very nice and have implemented it for simple things, but gets a little complicated for me when introducing Jquery (jcrop) and multiple image uploads. Wondered what other (simple) options are out there for a newbie like me or if that script is pretty much as good as it gets? :-) Many thanks.
  2. Thank you very much for both bits of advise, it helped greatly.
  3. Hi, Apologies if this is rather easy but wondered how you would get around the following problem. I have a post being sent on a checked form that has the name set to a value used in my DB, for example: <input type="checkbox" name="<?PHP echo $rows ["catID"] ?>"> Where name would equal something like 11. I'm trying to right some code that inserts data from the rows that have been checked, bit like the below: while($rows = $database->fetch_array($result)){ $strSQL='INSERT INTO affiliate_join_cat (ajcCatID, ajcAffID) VALUES ('.$rows["catID"].', '.$_POST["affID"].')'; if ($_POST($rows["catID"])=="on"){ $database->query($strSQL); so my post will look something like 11 = on, dependent on the row checked. But there is something wrong with this part of the code: $_POST($rows["catID"])=="on" my thoughts are that until catID actually equals 11 this does not evaluate to anything? So have tried using empty and isset to handle it without any success. Not sure what to do next? Thanks in advance
  4. Hi Psycho, Thanks for posting and for the advise. Have learned something new regarding best practice so have taken that on board. The code is the way it is as I am converting an old ASP site to PHP and just mirrored the code - agreed, its not right and I will have to change it. For what its worth the reason why my escape \ did not work was because I had the echo encased in apostrophe, instead of quotes. Also changed the code for the following and it worked: public function pageNmLoop ($pageCnt, $pageStartListings, $filter) { for ($n=1; $n<=$pageCnt; $n++){ if ($n > $this->recordLimit) { break; } $s = $n+1; if ($n*$this->recordLimit==intval($pageStartListings)){ echo '| <a href="?pageStartListings=' . $n*$this->recordLimit . '&filter=' . rawurlencode($filter). ' " style="border: 1px solid #aaaaaa; background-color: #CCCCCC; padding: 3px; ">' . $s . '</a>'; } else { echo '| <a href="?pageStartListings=' . $n*$this->recordLimit . '&filter=' . rawurlencode($filter). ' ">' . $s . '</a>'; } } }
  5. After do some searching I wondered whether the problem might be because I am not escaping the speech marks in the HTML with a \, but on doing this I just get the error The requested URL /masteradmin/\" was not found on this server. Maybe I'm close, not sure why I should get that error. Looks like its trying reference my root directory instead of escape the character?
  6. Hi, Possibly, I did read your post and wonder the same thing. basically this: <a style="border: 1px solid #aaaaaa; background-color: #CCCCCC; padding: 3px; " href="?pageStartListings=300&filter=listingStatus%3D0">3</a> should be echo'ing this: <a href="?pageStartListings=300&filter=listingStatus%3D0" style="border: 1px solid #aaaaaa; background-color: #CCCCCC; padding: 3px;" >3</a>
  7. Hi, I have the following method but I can not work out why the html it echo's comes out in reverse? public function pageNmLoop ($pageCnt, $pageStartListings, $filter) { for ($n=1; $n<=$pageCnt; $n++){ if ($n > $this->recordLimit) { break; } if ($n*$this->recordLimit>=intval($pageStartListings)){ $stylePg = '" style="border: 1px solid #aaaaaa; background-color: #CCCCCC; padding: 3px; ">' . $n . '</a>'; } else { $stylePg = '">' . $n . '</a>'; } echo '| <a href="?pageStartListings=' . $n*$this->recordLimit . '&filter=' . rawurlencode($filter) . $stylePg ; } } The HTML it produces is as follows: Page: <a href="?pageStartListings=0&filter=listingStatus=0">1</a> | <a style="border: 1px solid #aaaaaa; background-color: #CCCCCC; padding: 3px; " href="?pageStartListings=100&filter=listingStatus%3D0">1</a> | <a style="border: 1px solid #aaaaaa; background-color: #CCCCCC; padding: 3px; " href="?pageStartListings=200&filter=listingStatus%3D0">2</a> | <a style="border: 1px solid #aaaaaa; background-color: #CCCCCC; padding: 3px; " href="?pageStartListings=300&filter=listingStatus%3D0">3</a> Probably some obvious newbie error but be grateful for a pointer. Many thanks
  8. Hi, Thank you for replying. I was about to post the below in response to the first reply but the second reply looks like a much better way to do it - thanks! Sorry if the answer seems obvious - but I have interpreted what you have said, which seems obvious to me now, to do define / test the $_GET var as a variable first - that way I can replace all the $_GET['filter'] with the variable I have just set, that way I will no longer get an error that $_GET['filter'] is not set, and so have to test it at every point. Can do something like the following if (isset($_GET["filter"])){$filter = $_GET["filter"];} else {$filter = "";} that way I can always use $filter without getting an error. Would that be right? Thanks.
  9. Hi, New to coding so pls bear with me.... I am running into a continual issue that wonder if there is a better way to handle it. When writing code that handles GET variables that have not been set I use the isset function with if statements to handle it, but my code looks like it is getting sloppy and I am having to repeat it a lot - for example: Every time I simply want to call a class / function that I want to pass avGET i have to do the following: if (isset($_GET["filter"])){$theFilter = $pageination->filter($_GET["filter"]);} else {$theFilter = $pageination->filter();} Here is a copy of the class I have created (note sure if it works yet as not fully tested it) class pageination { private $recordLimit=100; public function filter ($filter="") { if ($filter!=""){ $theFilter=" AND ".$filter; return $theFilter; } else { return $theFilter=""; } } private function pageCnt ($pageCntRst) { $pageCnt=intval($results[$pageCntRst]); return $pageCnt; } public function pageNmLnk () { echo 'Page: <a href="?pageStartListings=0&filter='. $_GET['filter'].'">1</a>'; } //This loops through every 100 pages public function pageNmLoop ($pageCnt) { for ($n=1; $n<=$pageCnt; $n++){ if ($n > $recordLimit) { break; } if ($n*$recordLimit==intval($_GET["pageStartListings"])){ $stylePg = 'style="border: 1px solid #aaaaaa; background-color: #CCCCCC; padding:3px; "> ' . $n+1 . '</a>'; } else{ $stylePg = ''; } echo '| <a href="?pageStartListings=' . $n*$recordLimit . '&filter=' . rawurlencode($_GET["filter"]) . ' " ' . $stylePg; } } } $pageination = new pageination (); ?> I use the GET a few times in the code and I have to write a lot of code around the isset and if statements to handle it all the time - thinking there must be a better way to do this or a function that can be built to test it? Any help is grateful in advance.
  10. Hi all, My name is Martin and just thought I would say hello! I've decided it was about time I learn some dynamic programming and chose PHP as the way forward! My main reasons are that I currently have a website that has been built by other developers and thought I should learn to code this myself, not only that, I just find it interesting and fun :-) So my current project is to convert the old ASP site to PHP and hope to contribute and seek help to the community along the way. Look forward to posting to you all :-)
×
×
  • 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.