Page 1 of 1

TRying to ech image but with specific size

Posted: Sun Dec 11, 2016 5:25 pm
by Georgezx9
Hi again

I am trying to scroll through a set of photos, mwhich if I click will open up a full screen version of the photo.

the first one works, but is not set to a certain size.

Code: Select all

echo '<div><img src="'.$this_file.'" /></div>'; // This is the actual image

My attempt number 1, but does not work
echo '<div><img src="'.$this_file.'"/></div>' width='200', height='300' onclick="openFullSize(this.src,'This is a description')">

My attempt number 2
echo <IMG SRC="<?php echo $this_file ?>" WIDTH="268" HEIGHT="176" BORDER="0" ALT="" />

Re: TRying to ech image but with specific size

Posted: Sun Dec 11, 2016 8:59 pm
by requinix
#1 won't work because the markup is all wrong. #2 will show the resized version but obviously doesn't have anything to display the full version when clicked.

Assuming you have an openFullSize() function somewhere already, the corrected markup for #1 is

Code: Select all

<div><img src="..." width="200" height="300" onclick="openFullSize(this.src,'This is a description');"/></div>

Code: Select all

echo '<div><img src="'.$this_file.'" width="200" height="300" onclick="openFullSize(this.src,\'This is a description\');"/></div>';