note 76917 deleted from function.session-start by bobby
| From: | bobby@php.net | Date: | Mon, 06 Aug 2007 14:28:44 +0000 |
| Subject: | note 76917 deleted from function.session-start by bobby | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-129211@lists.php.net to get a copy of this message | ||
Note Submitter: devin at share pics now dot com
----
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.