Board index   FAQ   Search  
Register  Login
Board index php forum :: php coding PHP coding => Images

image spoils page, need max size

images php coding issues or problems here.

Moderators: macek, egami, gesf

image spoils page, need max size

Postby meowski » Wed Jan 25, 2012 6:45 am

Hi!

I wonder if there is a quick fix to an existing page, so user doesn't have to reduce size of an image manually before uploading. Big images totally wrecks the page, and I would really like to just put in some code to set the max size. I don't really know much about php, but promised a friend to try to find a simple solution.

Code is like this today:

Code: Select all
<?
/* Display all news */

// Retrieve all published 'news' articles. */
$articles = article::search("news", "", 99, TRUE); // category, keyword, limit, published

// Print each article.
foreach($articles AS $article_id) {
   $art = new article($article_id);
   // Get all pictures
   $media_ids = $art->get_media();
   $cover = new media($media_ids[0]);
   // Get all links
   $links_ids = $art->get_links(); ?>


   <tr><td>
   <h2><?= $art->get("heading"); ?></h2>
   <img class="inlineright" src="<?= URL_UPLOAD . $cover->get("file_name"); ?>" alt="" title="" align="right">
   <?= $art->get("text"); ?>
   <br />
   <? foreach($links_ids AS $link_id) {
      $link = new link($link_id); ?>
         <br /><a target="<?=$link->get("target");?>" href="<?=$link->get("url");?>" title="<?=$link->get("description");?>"><?=$link->get("text");?></a>
   <? } ?>
   </td></tr>




EDIT: Sorry, I mean of course MAX WIDTH!
meowski
New php-forum User
New php-forum User
 
Posts: 1
Joined: Wed Jan 25, 2012 6:34 am

Return to PHP coding => Images

Who is online

Users browsing this forum: No registered users and 1 guest

Sponsored by Sitebuilder Web hosting and Traduzioni Italiano Rumeno and antispam for cPanel.