I'm a little rusty on my PHP. Can you please tell me what the @ is preceding a variable name? Thanks
When I wrap all the code in php and leave out the html, I only get the first rotated image, I don't understand why I don't get the last one. I even tried to insert a print line with a line break, but that did not work either.
Here's my code:
When all in php:
<?php
// Content type
header('Content-type: image/jpeg');
$pic1 = 'guitar-1_t.jpg';
$pic2 = 'guitar-7_t.jpg';
$path = 'guitar';
$img_res = imagecreatefromjpeg('images/'.$path.'/'.$pic1 . '');
$img_res2 = imagecreatefromjpeg('images/'.$path.'/'.$pic2 . '');
$pic1_90 = imagerotate($img_res,90,0);
$pic2_180 = imagerotate($img_res2,180,0);
imagejpeg($pic2_180, '', 100);
imagejpeg($pic1_90, '', 100);
?>
Then if I add html code and try to get the image(s), I get nothing and garble or I get an error about headers already being sent.
<?php
$pic1 = 'guitar-1_t.jpg';
$pic2 = 'guitar-7_t.jpg';
$path = 'guitar';
// Content type
header('Content-type: image/jpeg');
$img_res = imagecreatefromjpeg('images/'.$path.'/'.$pic1 . '');
$img_res2 = imagecreatefromjpeg('images/'.$path.'/'.$pic2 . '');
$pic1_90 = imagerotate($img_res,90,0);
$pic2_180 = imagerotate($img_res2,180,0);
?>
<html>
<head></head>
<body>
<?php imagejpeg($pic2_180, '', 100);?>
<br>
<?php imagejpeg($pic1_90, '', 100);?>
</body>
</html>
I've been trying to figure this out for a couple of days now, trying everything I can think of.
What I want is a random order of images which are located on the server and I have identified in a database that I am querying to create the randomness.
I am including other pages, one to login to the server and another for the queries.
I also tried to use this in my html to avoid having to use the header('Content-type: image/jpeg');
<meta http-equiv="content-type" content="image/jpeg" />
but that didn't work at all
.😕