rmccarter721's Profile User Rating: -----

Reputation: 8 Worker
Group:
Contributor w/DIC++
Active Posts:
139 (0.07 per day)
Joined:
10-September 07
Profile Views:
5,884
Last Active:
User is offline Jun 28 2012 05:44 AM
Currently:
Offline

Previous Fields

Country:
IE
OS Preference:
Windows
Favorite Browser:
Chrome
Favorite Processor:
AMD
Favorite Gaming Platform:
PC
Your Car:
Who Cares
Dream Kudos:
75

Latest Visitors

Icon   rmccarter721 has not set their status

Posts I've Made

  1. In Topic: unexpected T_VARIABLE

    Posted 25 Jun 2012

    I changed the structure of the function and now it works. For reference new structure.

    		function saveImage($loc,$name,$ref,$caption){
    			// *** Get extension
    			
    			$db = new DB();
    				
    			$checkName = $db->Query("SELECT * FROM `lik_photos` WHERE `lik_photos`.`ptName` = \"".clean_input($ref)."\"");
    				
    			if(mysql_num_rows($checkName) == 0){
    				
    				$extension = strrchr($loc.$name, '.');
    				$extension = strtolower($extension);
    				
    				$name = date(zY) . hash('crc32',$name);
    				
    				switch($extension)
    				{
    					case '.jpg':
    					case '.jpeg':
    						if (imagetypes() & IMG_JPG) {	
    							imagejpeg($this->thumb, $loc.'/thumb/'.$name.$extension, 70);
    							imagejpeg($this->image, $loc.'/full/'.$name.$extension, 100);
    						}
    						break;
    				
    					case '.gif':
    						if (imagetypes() & IMG_GIF) {
    							imagegif($this->thumb, $loc.'/thumb/'.$name.$extension);
    							imagegif($this->image, $loc.'/full/'.$name.$extension);
    						}
    						break;
    				
    					case '.png':
    							
    						if (imagetypes() & IMG_PNG) {
    							imagepng($this->thumb, $loc.'/thumb/'.$name.$extension, 3);
    							imagepng($this->image, $loc.'/full/'.$name.$extension, 0);
    						}
    						break;
    				
    					default:
    						break;
    				}
    				
    				#TODO:ERROR Check for Same named image
    				
    
    				$db->Query("INSERT INTO `lik_photos` (`ptName`,`ptCaption`,`ptURL`) VALUES (\"".clean_input($ref)."\", \"".clean_input($caption)."\", \"".$name.$extension."\")");
    					
    				imagedestroy($this->thumb);
    				imagedestroy($this->image);
    			}
    			else{
    				imagedestroy($this->thumb);
    				imagedestroy($this->image);
    				
    				header('Location: page/admin/uploadPhotos/errorNameAlreadyUsed');
    				exit;
    			}
    
    		}
    
  2. In Topic: unexpected T_VARIABLE

    Posted 25 Jun 2012

    Here is the entire function

    		function saveImage($loc,$name,$ref,$caption){
    			// *** Get extension
    			$extension = strrchr($loc.$name, '.');
    			$extension = strtolower($extension);
    			
    			$name = date(zY) . hash('crc32',$name);
    			
    			switch($extension)
    			{
    				case '.jpg':
    				case '.jpeg':
    					if (imagetypes() & IMG_JPG) {	
    						imagejpeg($this->thumb, $loc.'/thumb/'.$name.$extension, 70);
    						imagejpeg($this->image, $loc.'/full/'.$name.$extension, 100);
    					}
    					break;
    			
    				case '.gif':
    					if (imagetypes() & IMG_GIF) {
    						imagegif($this->thumb, $loc.'/thumb/'.$name.$extension);
    						imagegif($this->image, $loc.'/full/'.$name.$extension);
    					}
    					break;
    			
    				case '.png':
    						
    					if (imagetypes() & IMG_PNG) {
    						imagepng($this->thumb, $loc.'/thumb/'.$name.$extension, 3);
    						imagepng($this->image, $loc.'/full/'.$name.$extension, 0);
    					}
    					break;
    			
    				default:
    					break;
    			}
    			
    			#TODO:ERROR Check for Same named image
    				
    			$db = new DB();
    			
    			$checkName = $db->Query("SELECT * FROM `lik_photos` WHERE `lik_photos`.`ptName` = \"".clean_input($ref)."\"");
    			
    			if(mysql_num_rows($checkName) == 0){
    				$db->Query("INSERT INTO `lik_photos` (`ptName`,`ptCaption`,`ptURL`) VALUES (\"".clean_input($ref)."\", \"".clean_input($caption)."\", \"".$name.$extension."\")");
    					
    				imagedestroy($this->thumb);
    				imagedestroy($this->image);
    			}
    			else{
    				imagedestroy($this->thumb);
    				imagedestroy($this->image);
    				
    				header('Location: page/admin/uploadPhotos/errorNameAlreadyUsed');
    				exit;
    			}
    
    		}
    


    ps. The next step I plan to do is change my queries to PDO ones
  3. In Topic: Turning Blog/Forum Posts into Packets to store

    Posted 30 Sep 2011

    Ah ok, that makes sense now..

    Cheers
  4. In Topic: Recommended Technology Sites/Articles/Blogs

    Posted 5 Jun 2011

    Thanks for placing this in the correct place, but I am actually looking for more the likes of sites that other users check regularly for industry related articles etc.

My Information

Member Title:
D.I.C Head
Age:
20 years old
Birthday:
May 13, 1993
Gender:
Location:
Ireland
Full Name:
Ryan McCarter
Years Programming:
4
Programming Languages:
html, css, php, mysql

Contact Information

E-mail:
Click here to e-mail me

Friends

Comments

rmccarter721 has no profile comments yet. Why not say hello?