Reputation: 1
Neutral
- Group:
- Members
- Active Posts:
- 90 (0.09 per day)
- Most Active In:
- PHP (36 posts)
- Joined:
- 16-July 10
- Profile Views:
- 1638
- Last Active:
May 09 2013 04:57 PM- Currently:
- Offline
My Information
- Age:
- 18 years old
- Birthday:
- February 25, 1995
- Gender:
-
Male
- Location:
- Sinaai, Belgium
- Expertise:
-
HTML
CSS
PHP
Javascript
SQL
Contact Information
- E-mail:
- Private
Latest Visitors
-
Koen 
05 Mar 2012 - 04:58 -
AbrarSyed 
26 Dec 2010 - 18:36 -
LoopingAround 
10 Dec 2010 - 15:12
Topics I've Started
-
Hydrogen setup
16 December 2012 - 02:47 PM
Hi everyone,
I'm trying to install hydrogen!
I'm getting this error after going through all the steps of Kyek's tutorial:
Fatal error: Class 'hydrogen\config\Config' not found in /var/www/tweelow/lib/hydrogen/hydrogen.autoconfig.php on line 23
Help?
Thanks in advance,
Maxim -
MySQL LIKE in a prepared statement
25 August 2012 - 05:25 AM
Hi everyone,
I'm having some troubles with the 'LIKE' part of a mysql statement.
Is it possible to use LIKE and prepared statements together because according to me that is where it goes wrong...
if(!$this->month && !$this->year) { $query = $this->db->prepare('SELECT * FROM nieuws ORDER BY id DESC LIMIT 5'); }else{ $query = $this->db->prepare('SELECT * FROM nieuws WHERE submitTime LIKE "?-?-%"'); } $query->execute(array($this->year, $this->month)); $posts = $query->fetchAll(); return $posts;
$this->month and $this->year are numbers. eg. 3 and 2012.
It goes wrong on the end of line 4.
Thanks in advance!
Maxim -
Extended classes
30 July 2012 - 07:52 AM
Hi everyone,
While learning to use classes in PHP I came across extending classes. But I think I've got it wrong
Is what i'm trying to do underneath even possible? Cause I don't get it to work...
<?php class blog { public $db; public function __construct() { $this->db = new PDO('********************','************','**************'); } public function __get($q) { return $this->$q; } } class blog_c extends blog { private $titel; private $bericht; private $image; public function __construct($titel, $bericht, $image) { $this->titel = $titel; $this->bericht = $bericht; $this->image = $image; } } ?>
<?php session_start(); require_once('controllers/submitter.lib.php'); $blog_c = new blog_c($_GET['titel'],$_GET['bericht'],$_SESSION['image']; echo $blog_c->__get('db');
And if you know of any good PHP OOP tutorials, I'd be glad to hear!
Thanks in advance,
Maxim -
Image resizing issues
28 July 2012 - 05:36 AM
Hi everyone,
For the website I am currently developing I need the user to be able to upload images. When the dimensions are too large, the image is scaled. Everything works fine (the image is resized and appears in the directory I saved it to), except for one thing. The browser outputs this: "The image [image name] cannot be displayed because it contains errors". Which is really weird since I can just download the image from my server and view it without any problems...
This is the code:
<?php class file { private $tmp; private $err; private $size; private $type; private $name; private $key = array(true,false,true); private $width; private $newwidth; private $height; private $maxheight = 175; private $newimg; public function __construct() { $this->tmp = $_FILES[file][tmp_name]; $this->err = $_FILES[file][error]; $this->size = $_FILES[file][size]; $this->type = $_FILES[file][type]; $this->name = "/var/www/bikeplus/img/nieuws/".$_FILES[file][name]; $this->name = explode(".",$this->name); $this->name = $this->name[0].".jpg"; list($this->width, $this->height) = getimagesize($_FILES[file][tmp_name]); } public function __get($q) { return $this->$q; } public function error_check() { if($this->size>2097152) $this->key[0] = false; if($this->type == 'image/jpeg' || $this->type == 'image/png' || $this->type == 'image/jpg' || $this->type == 'image/gif') $this->key[1] = true; if($this->height >= 175) $this->key[2] = false; } public function imagecreatefrom() { if($this->type == 'image/jpeg' || $this->type == 'image/jpg') return imagecreatefromjpeg($this->tmp); if($this->type == 'image/png') return imagecreatefrompng($this->tmp); if($this->type == 'image/gif') return imagecreatefromgif($this->tmp); } public function resize() { header('Content-Type: image/jpeg'); $factor = $this->maxheight / $this->height; $this->newwidth = round($factor * $this->width, 0, PHP_ROUND_HALF_DOWN); $image_p = imagecreatetruecolor($this->newwidth, $this->maxheight); $image = self::imagecreatefrom(); imagecopyresampled($image_p, $image, 0, 0, 0, 0, $this->newwidth, $this->maxheight, $this->width, $this->height); imagejpeg($image_p,$this->name,100); } public function move() { move_uploaded_file($this->tmp, $this->name); } public function upload() { self::error_check(); if(!$this->key[0]) { echo "De afbeelding is de groot. (>2MB)"; exit(); } if(!$this->key[1]) { echo "Dit bestandstype wordt niet ondersteund. (enkel jpeg, jpg, png en gif)"; exit(); } if(!$this->key[2]) { self:: resize(); } if($this->key[0] && $this->key[1] && $this->key[2]) self::move(); echo "De afbeelding werd met succes geupload."; } }
Also, I just started using classes. So if you see any ridiculous things in the code, I'm all ears.
Thanks in advance,
Maxim






Cartoon Clouds
Mountains
Sunrise
Clouds
Green Clouds
None
Find My Content
Display name history
Help
Comments
mlippie has no profile comments yet. Why not say hello?