Jump to content

hellrisisng

Members
  • Posts

    10
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

hellrisisng's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Did you use the code i supplyed to solve it?
  2. thanks for all your help guys, but it was human error (I was not populating on of the arrays)! DEERRRRR lol
  3. This is correct, place this under your querry and it should report the problem!
  4. I know what your getting at! Its the number that is the problem ive used greater than and equal too at other times with dates an so forth its just this damd tens not showing as higher than units (10 > 1) its doing my head in. Like if you where to have 152 it would not show higher than 16... Why is this?
  5. PASS! I dont see why you would not want it in a database it is so much easyer to handle, so I couldent help!! All I can sujest is try implamenting the script i supplyed using the 'for' command after counting the number of files in your directory???
  6. // This is the temporary file created by PHP $uploadedfile = $_FILES['uploadfile']['tmp_name']; // Create an Image from it so we can do the resize $src = imagecreatefromjpeg($uploadedfile); // Capture the original size of the uploaded image list($width,$height)=getimagesize($uploadedfile); // For our purposes, I have resized the image to be // 600 pixels wide, and maintain the original aspect // ratio. This prevents the image from being "stretched" // or "squashed". If you prefer some max width other than // 600, simply change the $newwidth variable $newwidth=600; $newheight=($height/$width)*600; $tmp=imagecreatetruecolor($newwidth,$newheight); // this line actually does the image resizing, copying from the original // image into the $tmp image imagecopyresampled($tmp,$src,0,0,0,0,$newwidth,$newheight,$width,$height); // now write the resized image to disk. I have assumed that you want the // resized, uploaded image file to reside in the SchoolImages directory. $filename = "SchoolImages/". $_FILES['uploadfile']['name']; imagejpeg($tmp,$filename,100); imagedestroy($src); imagedestroy($tmp); // NOTE: PHP will clean up the temp file it created when the request // has completed. For more info on how to use the function try here: http://php.net/manual/en/function.imagecreatefromjpeg.php you can also find out about the getimagesize() function as well, you should be able to intergrate your script into this!
  7. Are you wanting to resize the image resolution before it is saved onto the server or just resize it when you are displaying it?
  8. The best way I know to do this is to use num_rows to calculate your items in a database then do a simple math to calculate how many to display on each page, you can see by the code ive written for you below, you will need to add to it to make it work like the starting number and amount to limit your resualts by befor you have created a query with a dynamic URL (?page=number). //state how many to display on each page $per_page = 4; //calculating no of pages $pageresult = mysql_query("SELECT * FROM your_table"); $count = mysql_num_rows($pageresult); $pages = ceil($count/$per_page); // display items for this page $start = ($page-1)*$per_page; $result = mysql_query("SELECT * FROM your_table LIMIT $start,$per_page"); Then using CSS to create your page numbers you could try doing somthing with jQuery to funck it up <ul id="pagination"> <? //pagination Numbers for($i=1; $i<=$pages; $i++) {?> <li><a href="your-page.php?page=<? echo $i;?>"><? echo $i;?></a></li> <? }?> </ul> Hope this helps!
  9. The best way to do this would be to use somthing like PHPThumb() that uses the GD2 library available on most linux servers. http://phpthumb.sourceforge.net/ or something like this: *// Note : - GD must Enabled - Autodetect file extension (.jpg/jpeg, .png, .gif, .wbmp) but some server can't generate .gif / .wbmp file types - If your GD not support 'ImageCreateTrueColor' function, change one line from 'ImageCreateTrueColor' to 'ImageCreate' (the position in 'show' and 'save' function) */ class thumbnail { var $img; function thumbnail($imgfile) { //detect image format $this->img["format"]=ereg_replace(".*\.(.*)$","\\1",$imgfile); $this->img["format"]=strtoupper($this->img["format"]); if ($this->img["format"]=="JPG" || $this->img["format"]=="JPEG") { //JPEG $this->img["format"]="JPEG"; $this->img["src"] = ImageCreateFromJPEG ($imgfile); } elseif ($this->img["format"]=="PNG") { //PNG $this->img["format"]="PNG"; $this->img["src"] = ImageCreateFromPNG ($imgfile); } elseif ($this->img["format"]=="GIF") { //GIF $this->img["format"]="GIF"; $this->img["src"] = ImageCreateFromGIF ($imgfile); } elseif ($this->img["format"]=="WBMP") { //WBMP $this->img["format"]="WBMP"; $this->img["src"] = ImageCreateFromWBMP ($imgfile); } else { //DEFAULT echo "Not Supported File"; exit(); } @$this->img["lebar"] = imagesx($this->img["src"]); @$this->img["tinggi"] = imagesy($this->img["src"]); //default quality jpeg $this->img["quality"]=75; } function size_height($size=100) { //height $this->img["tinggi_thumb"]=$size; @$this->img["lebar_thumb"] = ($this->img["tinggi_thumb"]/$this->img["tinggi"])*$this->img["lebar"]; } function size_width($size=100) { //width $this->img["lebar_thumb"]=$size; @$this->img["tinggi_thumb"] = ($this->img["lebar_thumb"]/$this->img["lebar"])*$this->img["tinggi"]; } function size_auto($size=100) { //size if ($this->img["lebar"]>=$this->img["tinggi"]) { $this->img["lebar_thumb"]=$size; @$this->img["tinggi_thumb"] = ($this->img["lebar_thumb"]/$this->img["lebar"])*$this->img["tinggi"]; } else { $this->img["tinggi_thumb"]=$size; @$this->img["lebar_thumb"] = ($this->img["tinggi_thumb"]/$this->img["tinggi"])*$this->img["lebar"]; } } function jpeg_quality($quality=75) { //jpeg quality $this->img["quality"]=$quality; } function show() { //show thumb @Header("Content-Type: image/".$this->img["format"]); /* change ImageCreateTrueColor to ImageCreate if your GD not supported ImageCreateTrueColor function*/ $this->img["des"] = ImageCreateTrueColor($this->img["lebar_thumb"],$this->img["tinggi_thumb"]); @imagecopyresized ($this->img["des"], $this->img["src"], 0, 0, 0, 0, $this->img["lebar_thumb"], $this->img["tinggi_thumb"], $this->img["lebar"], $this->img["tinggi"]); if ($this->img["format"]=="JPG" || $this->img["format"]=="JPEG") { //JPEG imageJPEG($this->img["des"],"",$this->img["quality"]); } elseif ($this->img["format"]=="PNG") { //PNG imagePNG($this->img["des"]); } elseif ($this->img["format"]=="GIF") { //GIF imageGIF($this->img["des"]); } elseif ($this->img["format"]=="WBMP") { //WBMP imageWBMP($this->img["des"]); } } function save($save="") { //save thumb if (empty($save)) $save=strtolower("./thumb.".$this->img["format"]); /* change ImageCreateTrueColor to ImageCreate if your GD not supported ImageCreateTrueColor function*/ $this->img["des"] = ImageCreateTrueColor($this->img["lebar_thumb"],$this->img["tinggi_thumb"]); @imagecopyresized ($this->img["des"], $this->img["src"], 0, 0, 0, 0, $this->img["lebar_thumb"], $this->img["tinggi_thumb"], $this->img["lebar"], $this->img["tinggi"]); if ($this->img["format"]=="JPG" || $this->img["format"]=="JPEG") { //JPEG imageJPEG($this->img["des"],"$save",$this->img["quality"]); } elseif ($this->img["format"]=="PNG") { //PNG imagePNG($this->img["des"],"$save"); } elseif ($this->img["format"]=="GIF") { //GIF imageGIF($this->img["des"],"$save"); } elseif ($this->img["format"]=="WBMP") { //WBMP imageWBMP($this->img["des"],"$save"); } } }
  10. Hi im pritty new to PHP used to using ASP but found PHP to be more resourcful! Anyway, Im trying to work out how to get my script to define if a prduct fee is higher than an available account balance, but hitting brick walls! CODE BELOW: $Credits = 10; $Fee = 5; if ($Fee > $Credits){ //NEED MORE CREDITS }else{ //YOU CAN PURCHASE THIS ITEM } But returns that 10 is not greater than 5, i guess this is because it is only taking the first digit into consideration, even if it is 12 or 15 is still says its not higher than 5 ??? Ive been at it for hours searched google and come up with nothing... please help I may be acting thick and it may be really simple but im lost! Thanks in advance!
×
×
  • 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.