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
https://forums.phpfreaks.com/topic/258032-display-image/
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
https://forums.phpfreaks.com/topic/258032-display-image/#findComment-1322670
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
https://forums.phpfreaks.com/topic/258032-display-image/#findComment-1322675
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
https://forums.phpfreaks.com/topic/258032-display-image/#findComment-1322714
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.