Jump to content

Reseting sessions


Suchy

Recommended Posts

<?php foreach($entriesResults as $temp_img) { 
session_start();
$url = $temp_img['url'];
$_SESSION['link'] = $url;

$max = 75;
$_SESSION['x_max'] = $max;
?>
      <img src="show.php"> </img>	  	  
<? } ?>

 

 

show.php

<?php
session_start();
$link = $_SESSION['link'];
$x_max = $_SESSION['x_max'];

$photo = open (  $link );

function open ($temp) {
        $im = @imagecreatefromjpeg($temp);
        if ($im !== false) { return $im; }

        $im = @imagecreatefromgif($temp);
        if ($im !== false) { return $im; }

        $im = @imagecreatefrompng($temp);
        if ($im !== false) { return $im; }

        return false;
}

$x = imagesx($photo);
$y = imagesy($photo);
$y_max = $y * ($x_max/$x);

$resize = imagecreatetruecolor($x_max, $y_max);
imagecopyresampled($resize, $photo, 0, 0, 0, 0, $x_max, $y_max, $x, $y);

imagejpeg($resize);
?>

 

The problem is that the $_SESSION['link'] is not set to the next url, thus the page prints out the same image multiple times. How can I reset the $_SESSION['link'] to the next url.

Link to comment
https://forums.phpfreaks.com/topic/53791-reseting-sessions/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.