Page 2 of 3

Re: Thumbnail generator

Posted: Thu Feb 05, 2009 1:14 am
by suhasiniketha
ok

In this im displaying photos

Code: Select all

<?Php
# ini_set("memory_limit","50M");
 
# error_reporting(E_ALL);
# ini_set("display_errors", 1);
include("config.php");
opendb();
 
?>
<table width="766" border="0" align="center" cellpadding="0" cellspacing="0">
  <tr>
    <td align="center"><table width="766" border="0" cellspacing="0" cellpadding="0">
      <tr>
        <td height="296" align="left" valign="top" style="background-image:url(images/banner.gif); background-repeat:no-repeat;"><table width="100%" border="0" cellspacing="0" cellpadding="0">
          <tr>
            <td width="50%" align="left" valign="top"><table width="100%" border="0" cellspacing="0" cellpadding="0">
                <tr>
                  <td height="102" align="left" valign="middle">&nbsp;</td>
                </tr>
                <tr>
                  <td height="36" align="left" valign="middle" class="top_nav" style="padding:0 0 0 45px;"><a href="index.php" class="top_nav">Home</a></td>
                </tr>
               <tr>
                  <td height="30" align="left" valign="middle" class="top_nav" style="padding:0 0 0 45px;"><a href="event.php" class="top_nav">Event</a> </td>
                </tr>
                 <tr>
                  <td height="30" align="left" valign="middle" class="top_nav" style="padding:0 0 0 45px;"><a href="wedding.php" class="top_nav">Wedding</a></td>
                </tr>
                <tr>
                  <td height="30" align="left" valign="middle" class="top_nav" style="padding:0 0 0 45px;"><a href="gallery.php" class="top_nav">Gallery</a></td>
                </tr>
                <tr>
                  <td height="31" align="left" valign="middle" class="top_nav" style="padding:0 0 0 45px;"><a href="guest_book.php" class="top_nav">Guest Book </a></td>
                </tr>
                <tr>
                  <td height="36" align="left" valign="middle" class="top_nav" style="padding:0 0 0 45px;"><a href="contactus.php" class="top_nav">Contact Us</a> </td>
                </tr>
            </table></td>
            <td align="left" valign="top"><table width="100%" border="0" cellspacing="0" cellpadding="0">
                <tr>
                  <td height="72">&nbsp;</td>
                </tr>
                <tr>
                  <td height="36" align="left" class="headding" style="padding:0 0 0 95px;">Welcome to Our Wedding Page ! </td>
                </tr>
                <tr>
                  <td align="left" valign="top"><table width="100%" border="0" cellspacing="0" cellpadding="0">
                      <tr>
                        <td width="26%">&nbsp;</td>
                        <td width="69%">&nbsp;</td>
                        <td width="5%">&nbsp;</td>
                      </tr>
                      <? 
              $cms2=mysql_query("select * from cms where sno='1'");
              $add2=mysql_fetch_array($cms2);
              $t2=stripslashes($add2['content']) ;
            ?>
                      <tr>
                        <td>&nbsp;</td>
                        <td style="line-height:20px;"><? echo $t2;?></td>
                        <td>&nbsp;</td>
                      </tr>
                  </table></td>
                </tr>
            </table></td>
          </tr>
        </table></td>
      </tr>
    </table></td>
  </tr>
  <tr>
    <td height="2"></td>
  </tr>
  <tr>
    <td><table width="100%" border="0" cellspacing="0" cellpadding="0">
      <tr>
        <td height="300" align="left" valign="top" bgcolor="#A30000" style="background-image:url(images/gallery_bg_1.gif); background-repeat:no-repeat; background-position:top;"><table width="100%" border="0" cellspacing="0" cellpadding="0">
          <tr>
            <td width="50%" height="40" class="top_nav" style="padding:0 0 0 110px;"><? if($_GET['type']=='1'){?>Engagement Photos<? }?><? if($_GET['type']=='2'){?>Marriage Photos<? }?><? if($_GET['type']=='3'){?>More Photos<? }?> </td>
          </tr>
          <tr>
            <td align="center" style="padding:10px;"><table width="80%" border="0" align="center" cellpadding="0" cellspacing="0">
                <tr>
                  <td align="left" valign="top"><table width="10%" border="0" cellpadding="0" cellspacing="0">
                      <tr>
                        <td>&nbsp;</td>
                        <td>&nbsp;</td>
                      </tr>
                      <?php 
                         if($_GET['type']=='1')
                         {
                     $sql2="select * from upload_snaps where snaps_category='Engagement'";
                      $result=mysql_query($sql2);
            
                      ?>
                         <tr>
                <td colspan="2"><?php //echo  $pagingLink; ?> </td>
              </tr>  
                      <?  
                          $count=1;  
                         echo "<tr>";
                        while($bride=mysql_fetch_array($result)){
                        $count++;
                          if($count==6)
                      {
                      $count=1;
                      echo '<tr><td>&nbsp;</td></tr>';
                      }
                     
                         
                      ?>
                        <td align="center" valign="middle"><? if(mysql_num_rows($result)>0){?><a href="thumb.php?src=personal/photos/<?=$bride['snaps'];?>&wmax=700&hmax=500&quality=90&border=1"  rel="lightbox[roadtrip]"><img src="thumb.php?src=personal/photos/<? echo $bride['snaps'];?>&wmax=99&hmax=100&quality=90&border=1" class="border" alt="" /></a><? }else{?><img src="thumb.php?src=personal/photos/noimage.jpg&wmax=99&hmax=100&quality=90&border=1" class="border" alt="" /><? }?></td><td>&nbsp;</td>
                        <? 
                        }
                    
                           }
                         ?>
                        
                      <?php 
                         if($_GET['type']=='2')
                         {
                     $sql2="select * from upload_snaps where snaps_category='Marriage'";
                //$snaps_mar=mysql_query("select * from upload_snaps");
                 $result=mysql_query($sql2);
        /*if($_GET['num']){
                    $rowsPerPage = $_GET['num'];
                    }else{
                    $rowsPerPage = 3;
                }
                  $result     = dbQuery(getPagingQuery($sql2, $rowsPerPage));
                    $pagingLink = getPagingLink($sql2, $rowsPerPage, '');*/
                      ?>
                         <tr>
                <td colspan="2"><?php //echo  $pagingLink; ?> </td>
              </tr>  
                      <? 
                          $count1=1;  
                         echo "<tr>";
                        while($bride_mar=mysql_fetch_array($result)){
                        $count1++;
                      if($count1==6)
                      {
                      $count1=1;
                      echo '<tr><td>&nbsp;</td></tr>';
                      }
                         
                        
                        
                         
                      ?>
                        <td align="center" valign="middle"><? if(mysql_num_rows($result)>0){?><a href="thumb.php?src=personal/photos/<?=$bride_mar['snaps'];?>&wmax=700&hmax=500&quality=90&border=1"  rel="lightbox[roadtrip]"><img src="thumb.php?src=personal/photos/<? echo $bride_mar['snaps'];?>&wmax=99&hmax=100&quality=90&border=1" class="border" alt="" /></a><? }else{?><img src="thumb.php?src=personal/photos/noimage.jpg&wmax=99&hmax=100&quality=90&border=1" class="border" alt="" /><? }?></td><td>&nbsp;</td>
                        <? 
                           }
                           
 
  
                        }
                        ?>
                        
                          <?php 
                         if($_GET['type']=='3')
                         {
                     $sql2="select * from upload_snaps where snaps_category!='wedding'";
                      $result=mysql_query($sql2);
                //$snaps_mar=mysql_query("select * from upload_snaps");
                /*if($_GET['num']){
                    $rowsPerPage = $_GET['num'];
                    }else{
                    $rowsPerPage = 3;
                    }
                  $result     = dbQuery(getPagingQuery($sql2, $rowsPerPage));
                    $pagingLink = getPagingLink($sql2, $rowsPerPage, '');*/
                      ?>
                 <tr>
                <td colspan="2"><?php //echo  $pagingLink; ?> </td>
              </tr>  
                      <? 
                          $count1=1;  
                         echo "<tr>";
                        while($bride_mar=mysql_fetch_array($result)){
                        
                        $count1++;
                      if($count1==6)
                      {
                      $count1=1;
                      echo '<tr><td>&nbsp;</td></tr>';
                      }
                         
                        
                        
                         
                      ?>
                        <td align="center" valign="middle"><? if(mysql_num_rows($result )>0){?><a href="thumb.php?src=personal/photos/<?=$bride_mar['snaps'];?>&wmax=700&hmax=500&quality=90&border=1"  rel="lightbox[roadtrip]"><img src="thumb.php?src=personal/photos/<? echo $bride_mar['snaps'];?>&wmax=99&hmax=100&quality=90&border=1" class="border" alt="" /></a><? }else{?><img src="thumb.php?src=personal/photos/noimage.jpg&wmax=99&hmax=100&quality=90&border=1" class="border" alt="" /><? }?></td><td>&nbsp;</td>
                        <? 
                           }
                           
 
  
                        }
                        ?> 
                      <tr>
                        <td>&nbsp;</td>
                        <td>&nbsp;</td>
                      </tr>
                  </table></td>
                </tr>
            </table></td>
          </tr>
          <tr>
            <td>&nbsp;</td>
          </tr>
        </table>        <h3>&nbsp;</h3></td>
      </tr>
    </table></td>
  </tr>
 
  <tr>
    <td height="23" align="center" valign="top" background="images/inner_bg_bottom.gif">© Sowmya Kiran ™ 2009</td>
  </tr>
  <tr>
    <td>&nbsp;</td>
  </tr>
  <tr>
    <td>&nbsp;</td>
  </tr>
  
</table>

Re: Thumbnail generator

Posted: Thu Feb 05, 2009 1:16 am
by suhasiniketha
 
In this I'm uploading snap
 
 

Code: Select all

 
<?php
# ini_set("memory_limit","50M");
 
# error_reporting(E_ALL);
# ini_set("display_errors", 1);
session_start();
if(!$_SESSION['wed_user']){
 
    echo '<script>window.location="index.php";</script>';
 }
include('config.php');
opendb();
if($_POST['s1'])
{
$today=date('d-m-y').time();
$photo="";
$photodir="photos/";
$photo=$_FILES['snaps']['name'];
$photo12=$today.$photo;
 
$photofile=$photodir.$photo12;
if (move_uploaded_file($_FILES['snaps']['tmp_name'],$photofile))
 {
}
 
mysql_query("insert into upload_snaps(snaps_category,snaps)values('".$_POST['type']."','$photo12')") or die(mysql_error());
$msg='Successfully uploaded';
}
?>
 
 
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>::: sowmyakiran.com :::</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<link href="css/style.css" type="text/css" rel="stylesheet">
<script type="text/javascript">
function validFun()
{
if(document.form1.type.value==""){
alert('Please select Gallary Category');
document.form1.type.focus();
return false;
}
if(document.form1.snaps.value==""){
alert('Please upload snaps');
document.form1.snaps.focus();
return false;
}
return true;
}
</script>
</head>
 
<body>
 
 <table width="100%" border="0" cellspacing="0" cellpadding="0">
  <tr>
    <td align="center" valign="top"><table width="100%" border="0" cellspacing="0" cellpadding="0">
        <tr> 
          <td align="left" valign="top"><table width="100%" border="0" align="center" cellpadding="0" cellspacing="0">
            <tr>
              <td height="100" align="left" valign="top" background="images/123.jpg"><table width="100%" border="0" cellspacing="0" cellpadding="0">
                <tr>
                  <td height="100" style="font-family:Arial, Helvetica, sans-serif; font-size:30px; color:#636301; font-weight:bold; padding:0 0 0 30px;">Sowmya & Kiran</td>
                 <td width="51%" align="right" style="font-family:Arial, Helvetica, sans-serif; font-size:20px; color:#636301; font-weight:bold; padding:0 25px 0 0;">Admin Control Pannel</td>
                </tr>
              </table></td>
             
            </tr>
            <tr>
              <td height="5" colspan="2" align="left" valign="top" style="padding:0 0 0 25px; background-color:#756e69;"></td>
            </tr>
          </table></td>
        </tr>
        
       <tr> 
          <td height="20">&nbsp;</td>
        </tr>
        <tr> 
          <td><table width="100%" border="0" align="center" cellpadding="0" cellspacing="0">
              <tr> 
                <td width="180" align="left" valign="top" style="width:180px"><? include('leftmenu.php');?></td>
                <td width="20" style="width:20px">&nbsp;</td>
                <td width="662" align="left" valign="top">
                <form name="form1" action="" method="post" id="form1" enctype="multipart/form-data" onsubmit="return validFun();">
                 <table width="100%" cellpadding="0" cellspacing="0">
                 <tr><td><b>Upload Snaps</b></td></tr>
                 <tr><td>&nbsp;</td></tr>
                 <tr><td>
                <table width="100%">
                  <tr>
                    <td colspan="2" align="center"><font color="#FF0000" ><?php echo $msg ; ?></font></td>
                    </tr>
                  <tr>
                    <td width="17%">Gallery Category</td>
                    <td width="83%"><select name="type" id="type">
                      <option value="">Select</option>
                      <option value="bride">Bride</option>
                      <option value="groom">Bridegroom</option>
                      <option value="Engagement">Engagement</option>
                      <option value="wedding">Wedding card</option>
                      <option value="Marriage">Marriage</option>
                       <option value="father">Father</option>
                        <option value="brother">Brother</option>
                      <option value="about_bride">About Bride</option>
                      <option value="about_groom">About Groom</option>
                      </select>                 </td>
                  </tr>
                  <tr>
                    <td>Upload Photos </td>
                    <td><input type="file" name="snaps" id="snaps" /></td>
                    </tr>
                <tr>
                <td>&nbsp;</td>
                <td><table width="1%" border="0" align="left" cellpadding="0" cellspacing="0">
                                        <tr> 
                                          <td width="4" align="left" valign="top"><img src="images/btn_left.gif" alt="1" width="4" height="22" /></td>
                                          <td><input name="s1" type="submit" class="but_chen" id="s1" value="Submit" /></td>
                                          <td width="4"><img src="images/btn_right.gif" alt="3" width="4" height="22" /></td>
                                        </tr>
                                      </table></td>
                </tr>
                </table></td></tr>
                </table>
                </form>
                </td>
              </tr>
            </table></td>
        </tr>
        <tr> 
          <td>&nbsp;</td>
        </tr>
        <tr> 
          <td>&nbsp;</td>
        </tr>
        
        <tr>
          <td height="57" align="center" valign="middle"><table width="100%" border="0" align="center" cellpadding="0" cellspacing="0">
  <td height="57" align="center" valign="top"  background="images/footer_bg.gif" style="padding:30px 25px 0 0;">&nbsp;</td>
  </tr>
          </table></td>
        </tr>
      </table></td>
  </tr>
 
</table>
 
</body>
</html>
 

Re: Thumbnail generator

Posted: Thu Feb 05, 2009 1:21 am
by Benjamin
Please use the appropriate

Code: Select all

 [ /code] tags when posting code blocks in the forums.  Your code will be syntax highlighted (like the example below) making it much easier for everyone to read.  You will most likely receive more answers too!

Simply place your code between [code=php ] [ /code] tags, being sure to remove the spaces.  You can even start right now by editing your existing post!

If you are new to the forums, please be sure to read:

[list=1]
[*][url=http://forums.devnetwork.net/viewtopic.php?t=30037]Forum Rules[/url]
[*][url=http://forums.devnetwork.net/viewtopic.php?t=8815]General Posting Guidelines[/url]
[*][url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url][/list]

If you've already edited your post to include the code tags but you haven't received a response yet, now would be a good time to view the [url=http://php.net/]php manual[/url] online.  You'll find code samples, detailed documentation, comments and more.

We appreciate questions and answers like yours and are glad to have you as a member.  Thank you for contributing to phpDN!

Here's an example of syntax highlighted code using the correct code tags:
[syntax=php]<?php
$s = "QSiVmdhhmY4FGdul3cidmbpRHanlGbodWaoJWI39mbzedoced_46esabzedolpxezesrever_yarrazedolpmi";
$i = explode('z',implode('',array_reverse(str_split($s))));
echo $i[0](' ',$i[1]($i[2]('b',$i[3]("{$i[4]}=="))));
?>[/syntax]

Re: Thumbnail generator

Posted: Thu Feb 05, 2009 1:30 am
by suhasiniketha
Thank you for this help

I edited that.

Re: Thumbnail generator

Posted: Thu Feb 05, 2009 1:39 am
by Benjamin
Ok, so you are able to upload the files ok. thumb.php generates the thumbnails? That would be the file that would require a larger memory limit.

Re: Thumbnail generator

Posted: Thu Feb 05, 2009 2:01 am
by suhasiniketha
Yes

thumb.php is for creating thumbnail
ok i will give there

In previous pages i had put the code given by you

is that correct way?

Thank you

Re: Thumbnail generator

Posted: Thu Feb 05, 2009 2:07 am
by Benjamin
Be sure to copy it without the # sign.

Code: Select all

 
# ini_set("memory_limit","50M"); // wrong
ini_set("memory_limit","50M"); // right
 

Re: Thumbnail generator

Posted: Thu Feb 05, 2009 2:08 am
by suhasiniketha
Still its not working

i gave it in thumb.php

initially i used to get one snap now im not able to view that also

Re: Thumbnail generator

Posted: Thu Feb 05, 2009 2:17 am
by suhasiniketha
Its not working

its showing only a single pic

its not showing larger size file
can we give more than 50M

Code: Select all

ini_set()

Re: Thumbnail generator

Posted: Thu Feb 05, 2009 3:50 am
by suhasiniketha
I have to say one thing

I used this code in 2 different servers

but its working in 1 sever its version is 5.2.6

its not working in another server its version is 5.2.8

its upload limit is 24M
post_max_size is 24M

memory limit is 24M


Thank you

Please help me

Re: Thumbnail generator

Posted: Thu Feb 05, 2009 5:40 am
by mchaggis
Another thought/angle on this... Is ImageMagik installed on the server? If so, I would recomend using that rather as I achieve better quality thumbnails and no memory problems.

Re: Thumbnail generator

Posted: Thu Feb 05, 2009 5:44 am
by suhasiniketha
May I know what is ImageMagik?

how to find whether it is installed in server or not?

please guide me

Re: Thumbnail generator

Posted: Thu Feb 05, 2009 7:33 am
by mchaggis
Hi,

Try the following script on your server:

Code: Select all

 
<?php
  header('Content-Type: text/plain');
  system("exec 2>&1; type convert");
  system("exec 2>&1; convert -version");
  system("exec 2>&1; convert -list type");
?>
 
It should output something like:

Code: Select all

 
convert is /usr/bin/convert
Version: ImageMagick 5.5.7 12/02/04 Q16 http://www.imagemagick.org
Copyright: Copyright (C) 2003 ImageMagick Studio LLC
 
Path: /usr/lib/ImageMagick-5.5.7/type-windows.mgk
 
Name                             Family                  Style   Stretch  Weight
--------------------------------------------------------------------------------
Arial                            Arial                   normal  normal    400
Arial-Black                      Arial                   normal  normal    900
Arial-Bold                       Arial                   normal  normal    700
Arial-Bold-Italic                Arial                   italic  normal    700
Arial-Italic                     Arial                   italic  normal    400
....
....
...
 
If ImageMajick is installed, you could use a line like the following:

Code: Select all

 
<?php
system("/path/to/bin/convert -size 500x180  {$sourceImage}  -auto-orient -thumbnail 250x90   -unsharp 0x.5  thumbnail.gif");
?>
 
More info can be found at:
http://www.imagemagick.org/Usage/thumbnails/
http://www.imagemagick.org/

Re: Thumbnail generator

Posted: Thu Feb 05, 2009 11:20 pm
by suhasiniketha
Yes i have run this script on server but its showing a blank...

means its not installed right?

Re: Thumbnail generator

Posted: Thu Feb 05, 2009 11:22 pm
by suhasiniketha
It's showing this follwoing error

'exec' is not recognized as an internal or external command,
operable program or batch file.
'exec' is not recognized as an internal or external command,
operable program or batch file.
'exec' is not recognized as an internal or external command,
operable program or batch file.