TRying to ech image but with specific size

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
Georgezx9
Forum Newbie
Posts: 6
Joined: Sat Dec 10, 2016 3:29 am

TRying to ech image but with specific size

Post 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="" />
User avatar
requinix
Spammer :|
Posts: 6617
Joined: Wed Oct 15, 2008 2:35 am
Location: WA, USA

Re: TRying to ech image but with specific size

Post 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>';
Post Reply