jordz
Members-
Posts
36 -
Joined
-
Last visited
Never
Profile Information
-
Gender
Not Telling
jordz's Achievements
Member (2/5)
0
Reputation
-
Fixed Solved! Thank you Very Very Much! That's been a problem I've been pondering over for agggeeesss. Jordan
-
Ahhh okay, so is there no way at all to do it without saving to temporary file? edit: Does this delete the temporary file then?
-
I'm still failing to see how this works... Sorry If Im a little thick. $handle->process() outputs the image in raw code, how exactly would I go about taking that raw code and manipulating the image again?
-
I'm sorry I don't understand what you're getting at? I need to take the $handle->process() (this is now raw code) and some how put it into my script below....
-
Taken from PHP.net, the best place to find answers.
-
$this is a pseudo variable used mainly in OOPHP I think.
-
Hey all, I've been having an issue with using two scripts, one is an image manipulation class that does some watermarking for me and has a variety of different functions. Once I've processed the image from that class It comes out in a raw format (requiring a header()). I built another script to add 25 pixels to the bottom off the image but for the life of me can't seem to take the image from the raw format and manipulate it. Does anyone know how I could take the raw image and do something like imagecreatefromjpeg() to it? here's my code: include('class.upload.php'); //get the uploader class header('Content-Type: image/jpeg'); //image header $filename = 'test.jpg'; //source image file $handle = new upload($filename); if ($handle->uploaded) { // process the image $handle->file_new_name_body = 'image_resized'; $handle->image_watermark = 'wm2.png'; $handle->image_watermark_position = 'RM'; //outputs the image as raw format. $handle->process(); } // I can't do $image = $handle->process() then feed it through... // My script starts here and $image should be what comes out of the $handle... //*********** This is where I'm stuck, any help?********** $source = imagecreatefromjpeg($image); list($width, $height) = getimagesize($image); $thumb = imagecreatetruecolor($width, $height+25); // Resize imagecopyresized($thumb, $source, 0, 0, 0, 0, $width, $height, $width, $height); Any help would be much appreciated thanks. Jordan
-
Okay starting from scratch this is how I would do it of the top of my head: $con = mysql_connect('localhost','user','pass,') or die (mysql_error)); mysql_select_db('db_name'); $query = "SELECT * FROM tablename"; $mysql = mysql_query($query); while($row = mysql_fetch_array($mysql, MYSQL_ASSOC)) echo $row['field']; endwhile; I don't usually close the connection, no point really.
-
Take out the curly braces. See what happens? Jordan
-
an over kill?
-
Hey All, I'm re-writing this quickly as my computer had a spaz and I lost my original post :/ I would like to know how to take an image and simply add 25px to the bottom of the image height wise. Not re-sizing the image itself but just add some blank space to the bottom of it? Thanks Jordan
-
Getting Started with a Caching system? How to use it and so on?
jordz replied to jordz's topic in PHP Coding Help
I should have actually mentioned that this would be done on photo views, my bad for not being descriptive enough? So what you're saying is have on record for every photo? -
Hey everyone, I have been pondering over caching, I would just like to know how to use it and where would I start? I need to create a system (Im assuming using caching) that will (in my site) get the Top Photo of the Day, Week, Month, etc? How would I go about this? I understand caching will take some strain of a database if I were query lots all the time? Correct me if I'm wrong? Any help would be appreciated. Many Thanks Jordan
-
Hey Everyone, I'm new to code igniter literally just downloaded it and messing about with it. I know I'm diving head first into the deep end here but all I want to test out is the inclusion of external classes, like a photo manipulation class. For example currently I have a class that Equalises a photo and manipulates it, it does it's business here: Class Equalise{ // Main output function which reads the file and runs it through histogram equalization for the various color channels. function outputimage($filename) { $reds = array(); $blues = array(); $greens = array(); $freqr = array(); $freqb = array(); $freqg = array(); $info = getimagesize($filename); $width = $info[0]; $height = $info[1]; $totalpixels = $width * $height; $img = imagecreatefromjpeg($filename); if ($img) { Equalise::buildHistograms($img, $width, $height, $reds, $greens, $blues); Equalise::buildFrequencies($reds, $greens, $blues, $freqr, $freqg, $freqb); } $alpha = (float)(255.0 / (float)$totalpixels); $newimg = @imagecreatetruecolor($width, $height); $color = imagecolorallocate($newimg, 255, 255, 255); for ($i = 0; $i < $height; $i++) { for ($j = 0; $j < $width; $j++) { $rgb = imagecolorat($img, $j, $i); $r = ($rgb >> 16) & 0xFF; $g = ($rgb >> & 0xFF; $b = $rgb & 0xFF; $adjR = (int)((float)$freqr[$r] * $alpha); $adjG = (int)((float)$freqg[$g] * $alpha); $adjB = (int)((float)$freqb[$b] * $alpha); $color = imagecolorallocate($newimg, $adjR, $adjG, $adjB); imagesetpixel($newimg, $j, $i, $color); } } // This is where the Image comes out. header('Content-Type: image/jpg'); imagejpeg($newimg, NULL, 100); imagedestroy($newimg); } It returns the image then destroys it but after it's been loaded into the browser. I've been messing and added it into the application/libraries, as it said in the CI documentation, and in my Test controller added this code: <?php class Test extends Controller{ function index(){ header('Content-Type: image/jpg'); $this->load->library('Equalise'); $this->equalise->outputimage($_SERVER['DOCUMENT_ROOT']'/3.jpg'); } } ?> This takes 3.jpg and runs it through the class. But I just does't seem to work I can't get an image to come out at all. Anyone have any idea's? Thanks, Jordan
-
The way the databases work is: I get 10 separate databases. Each with 150meg of space. Each database needs different login credentials. Database1 - user: Db1 password: blah Database2 - user: Db2 password: blah Database3 - user: Db3 password: blah See what I mean? I'm using separate databases for everything and each page needs to connect to multiple databases at once. I've got a feeling its slowing my site down quite a bit, could this be the case? I created a class that basically does this: class Db{ function database($name){ $password = 'blah'; $host = 'whatever'; mysql_connect('$host','$name','$password'); mysql_select_db('$name'); } } Each page uses 3 databases + and uses this class many times, is this slowing the site down? Cause it feels like it is. Jordan