Jump to content

Display image


freakunleash

Recommended Posts

I have a doubt that I’m doing something wrong in the below code but I’m not able to figure it out. As of now I’m getting the correct result which I’m expecting. Please check below code & let me know if there are any mistakes:

 

 

<div class='imgs'><a href='movies.php?movieid=<?php echo $id;?>'><img src='<?php if(!empty($poster)){echo $poster;}else{echo $dft_img;}?>' width='214' height='314' alt='<?php echo $title;?>' </a></div>

 

 

regards

Bhaskar

Link to comment
Share on other sites

whats the actual problem?

 

I am guessing its the image not displaying, if after checking your html output the paths look correct double check and make sure the images you are specifying in those variables actually exist in the same path on the server you are loading the script form. The syntax is fine except you have crammed it all together I would evaluate the variables earlier and then just echo the correct ones in place.

Link to comment
Share on other sites

I had a similar problem.

 

Mine was when uploading a document and checking the database to see if it existed.

 

There doesn't look to be any problem in your code and you say "... I’m getting the correct result which I’m expecting..."

 

Just ensure you're passing the variables properly and you shouldn't have an issue.

Link to comment
Share on other sites

Aside...

 

By hard coding the image dimensions, your are either:

A) presuming all the images are that size; or

B) forcing a resize.

 

If "B", unless the images are some "equal" proportion of the hard coded sizes, you will end up with distorted images.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.