note 76917 added to function.session-start

From: Date: Sun, 05 Aug 2007 08:36:21 +0000
Subject: note 76917 added to function.session-start
Groups: php.notes 
Request: Send a blank email to php-notes+get-129190@lists.php.net to get a copy of this message
I've been trying to display a negated thumbnail but no luck. This <img src='thumb.php'> displays a thumbnail just fine when thumb.php is: <? session_start(); session_register("session"); ?> <?php $tempfile = 'user_files/' . $session[userid] . '/1.jpg'; header('Content-type: image/jpeg'); list($width, $height) = getimagesize($tempfile); $ratio = $width / $height; if ( 1 > $ratio) { $newwidth = floor(300 * $ratio); $newheight = 300; } else { $newheight = floor(400 / $ratio); $newwidth = 400; } $image_p = imagecreatetruecolor($newwidth, $newheight); $image = imagecreatefromjpeg($tempfile); imagecopyresampled($image_p, $image, 0, 0, 0, 0, $newwidth, $newheight, $width, $height); imagejpeg($image_p, null, 100); ?> But this: <img src='php5/negate.php'> does not when negate.php is: <? session_start(); session_register("session"); ?> <?php $tempfile = '../user_files/' . $userid . '/1.jpg'; header('Content-type: image/jpeg'); list($width, $height) = getimagesize($tempfile); $ratio = $width / $height; if ( 1 > $ratio) { $newwidth = floor(100 * $ratio); $newheight = 100; } else { $newheight = floor(100 / $ratio); $newwidth = 100; } $image_p = imagecreatetruecolor($newwidth, $newheight); $image = imagecreatefromjpeg($tempfile); imagefilter($image, IMG_FILTER_NEGATE); imagecopyresampled($image_p, $image, 0, 0, 0, 0, $newwidth, $newheight, $width, $height); imagejpeg($image_p, null, 100); ?> Since my server uses PHP4 I have the second script in a folder 'php5' with a .htaccess file containing 'AddType x-mapp-php5 .php' so I can use the imagefilter function. Also, this script only works when I use my actual userid instead of the variable $userid. Hence I am assuming this is a PHP5 session problem as $userid works for the first script when I start session. ---- Server IP: 64.71.164.2 Probable Submitter: 71.202.154.114 ---- Manual Page -- http://www.php.net/manual/en/function.session-start.php Edit -- https://master.php.net/note/edit/76917 Del: integrated -- https://master.php.net/note/delete/76917/integrated Del: useless -- https://master.php.net/note/delete/76917/useless Del: bad code -- https://master.php.net/note/delete/76917/bad+code Del: spam -- https://master.php.net/note/delete/76917/spam Del: non-english -- https://master.php.net/note/delete/76917/non-english Del: in docs -- https://master.php.net/note/delete/76917/in+docs Del: other reasons-- https://master.php.net/note/delete/76917 Reject -- https://master.php.net/note/reject/76917 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#129190) next »