sambib Posted March 28, 2006 Share Posted March 28, 2006 I've got a function which uses gd2 to resize an image and I know it works within an HTML page:[code]<?php//get the image size of the picture and load it into an array$mysock = getimagesize("images/image001.jpg");?><!-using a standard html image tag, where you would have the width and height, insert your new imageResize() function with the correct attributes --><img src="images/image001.jpg" <?php print imageResize($mysock[0], $mysock[1], 150); ?>>[/code]HOWEVER, I get my images from a database and populate the page using some php and I don't know how to use the print function in this scenario (within the echo statement). the php is below the important bit is the WHAT DO I DO HERE bit......;)[code]echo "<table class=\"table_test\">\n"; }//end of first if //Display each record echo "<tr>\n"; //get the image size of the picture and load it into an array $mysock = getimagesize("rivcms/news/images/image_{$row['upload_id']}06.jpg"); //display the resized image on the screen. echo "<td><img src=\"rivcms/news/images/image_{$row['upload_id']}06.jpg\" WHAT DO I DO HERE imageResize($mysock[0], $mysock[1], 75) />\n"; echo "<td>{$row['t']}</td>\n"; echo "<td>{$row['d']}</td>\n"; echo "</tr>\n"; $first = FALSE; //One record has been returned }[/code]thanks! :) Quote Link to comment https://forums.phpfreaks.com/topic/5985-using-print-within-an-echo-statement/ Share on other sites More sharing options...
Picatta Posted March 28, 2006 Share Posted March 28, 2006 Short answer: You can't.Long Answer: You can just use the period on connect the echo and print commands, like this:echo "<td><img src=\"rivcms/news/images/image_{$row['upload_id']}06.jpg\"" . imageResize($mysock[0], $mysock[1], 75) echo "/>\n"; Quote Link to comment https://forums.phpfreaks.com/topic/5985-using-print-within-an-echo-statement/#findComment-21454 Share on other sites More sharing options...
sambib Posted March 28, 2006 Author Share Posted March 28, 2006 [!--quoteo(post=359150:date=Mar 28 2006, 02:57 PM:name=Picatta)--][div class=\'quotetop\']QUOTE(Picatta @ Mar 28 2006, 02:57 PM) [snapback]359150[/snapback][/div][div class=\'quotemain\'][!--quotec--]Short answer: You can't.Long Answer: You can just use the period on connect the echo and print commands, like this:echo "<td><img src=\"rivcms/news/images/image_{$row['upload_id']}06.jpg\"" . imageResize($mysock[0], $mysock[1], 75) echo "/>\n";[/quote]sorry no go, copy and pasted that but got an error:Parse error: parse error, unexpected T_ECHO, expecting ',' or ';' in D:\Apache\htdocs\riverview\n_latest_test.php on line 58 Quote Link to comment https://forums.phpfreaks.com/topic/5985-using-print-within-an-echo-statement/#findComment-21460 Share on other sites More sharing options...
kenrbnsn Posted March 28, 2006 Share Posted March 28, 2006 There's an echo inside the echo...try this:[code]<?phpecho "<td><img src=\"rivcms/news/images/image_{$row['upload_id']}06.jpg\"" . imageResize($mysock[0], $mysock[1], 75) . "/>\n";?>[/code]Ken Quote Link to comment https://forums.phpfreaks.com/topic/5985-using-print-within-an-echo-statement/#findComment-21463 Share on other sites More sharing options...
sambib Posted March 28, 2006 Author Share Posted March 28, 2006 [!--quoteo(post=359159:date=Mar 28 2006, 03:19 PM:name=kenrbnsn)--][div class=\'quotetop\']QUOTE(kenrbnsn @ Mar 28 2006, 03:19 PM) [snapback]359159[/snapback][/div][div class=\'quotemain\'][!--quotec--]There's an echo inside the echo...try this:[code]<?phpecho "<td><img src=\"rivcms/news/images/image_{$row['upload_id']}06.jpg\"" . imageResize($mysock[0], $mysock[1], 75) . "/>\n";?>[/code]Ken[/quote]superb.......!cheers fellas.......:) Quote Link to comment https://forums.phpfreaks.com/topic/5985-using-print-within-an-echo-statement/#findComment-21466 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.