Jump to content

ginger76

Members
  • Posts

    10
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

ginger76's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Nevermind, got it sorted now.
  2. Hi, Need a little help with a script. I have a set of scripts for showing events. The scripts create and display thumbnail images but they are all set at the same height, with different widths. I want to reverse that and have the same uniformed width with different heights. The script that handles the thumbnail sizes is as follows: function thumb($file, $save, $width, $height) { //GD-Lib > 2.0 only! @unlink($save); //get sizes else stop if (!$infos = @getimagesize($file)) { return false; } // keep proportions $iWidth = $infos[0]; $iHeight = $infos[1]; $iRatioW = $width / $iWidth; $iRatioH = $height / $iHeight; if ($iRatioW < $iRatioH) { $iNewW = $iWidth * $iRatioW; $iNewH = $iHeight * $iRatioW; } else { $iNewW = $iWidth * $iRatioH; $iNewH = $iHeight * $iRatioH; } //Don't resize images which are smaller than thumbs if ($infos[0] < $width && $infos[1] < $height) { $iNewW = $infos[0]; $iNewH = $infos[1]; } if($infos[2] == 1) { /* * Image is typ gif */ $imgA = imagecreatefromgif($file); $imgB = imagecreate($iNewW,$iNewH); //keep gif transparent color if possible if(function_exists('imagecolorsforindex') && function_exists('imagecolortransparent')) { $transcolorindex = imagecolortransparent($imgA); //transparent color exists if($transcolorindex >= 0 ) { $transcolor = imagecolorsforindex($imgA, $transcolorindex); $transcolorindex = imagecolorallocate($imgB, $transcolor['red'], $transcolor['green'], $transcolor['blue']); imagefill($imgB, 0, 0, $transcolorindex); imagecolortransparent($imgB, $transcolorindex); //fill white } else { $whitecolorindex = @imagecolorallocate($imgB, 255, 255, 255); imagefill($imgB, 0, 0, $whitecolorindex); } //fill white } else { $whitecolorindex = imagecolorallocate($imgB, 255, 255, 255); imagefill($imgB, 0, 0, $whitecolorindex); } imagecopyresampled($imgB, $imgA, 0, 0, 0, 0, $iNewW, $iNewH, $infos[0], $infos[1]); imagegif($imgB, $save); } elseif($infos[2] == 2) { /* * Image is typ jpg */ $imgA = imagecreatefromjpeg($file); $imgB = imagecreatetruecolor($iNewW,$iNewH); imagecopyresampled($imgB, $imgA, 0, 0, 0, 0, $iNewW, $iNewH, $infos[0], $infos[1]); imagejpeg($imgB, $save); } elseif($infos[2] == 3) { /* * Image is typ png */ $imgA = imagecreatefrompng($file); $imgB = imagecreatetruecolor($iNewW, $iNewH); imagealphablending($imgB, false); imagecopyresampled($imgB, $imgA, 0, 0, 0, 0, $iNewW, $iNewH, $infos[0], $infos[1]); imagesavealpha($imgB, true); imagepng($imgB, $save); } else { return false; } return true; } function flyercreator($image, $type= 'venue') { $settings = & ELHelper::config(); jimport('joomla.filesystem.file'); //define the environment based on the type if ($type == 'event') { $folder = 'events'; } else { $folder = 'venues'; } if ( $image ) { //Create thumbnail if enabled and it does not exist already if ($settings->gddisabled == 1 && !file_exists(JPATH_SITE.'/images/eventlist/'.$folder.'/small/'.$image)) { $filepath = JPATH_SITE.'/images/eventlist/'.$folder.'/'.$image; $save = JPATH_SITE.'/images/eventlist/'.$folder.'/small/'.$image; ELImage::thumb($filepath, $save, $settings->imagewidth, $settings->imagehight); } //set paths $dimage['original'] = 'images/eventlist/'.$folder.'/'.$image; $dimage['thumb'] = 'images/eventlist/'.$folder.'/small/'.$image; //get imagesize of the original $iminfo = @getimagesize('images/eventlist/'.$folder.'/'.$image); //if the width or height is too large this formula will resize them accordingly if (($iminfo[0] > $settings->imagewidth) || ($iminfo[1] > $settings->imagehight)) { $iRatioW = $settings->imagewidth / $iminfo[0]; $iRatioH = $settings->imagehight / $iminfo[1]; if ($iRatioW < $iRatioH) { $dimage['width'] = round($iminfo[0] * $iRatioW); $dimage['height'] = round($iminfo[1] * $iRatioW); } else { $dimage['width'] = round($iminfo[0] * $iRatioH); $dimage['height'] = round($iminfo[1] * $iRatioH); } } else { $dimage['width'] = $iminfo[0]; $dimage['height'] = $iminfo[1]; } if (JFile::exists(JPATH_SITE.'/images/eventlist/'.$folder.'/small/'.$image)) { //get imagesize of the thumbnail $thumbiminfo = @getimagesize('images/eventlist/'.$folder.'/small/'.$image); $dimage['thumbwidth'] = $thumbiminfo[0]; $dimage['thumbheight'] = $thumbiminfo[1]; } return $dimage; } return false; } The $infos[0]; and $infos[1]; are both 100px, set in an admin section. I already tried making a few changes but just made a mess of it (I'm not very good). I got the right width I wanted but the images were out of proportion. So, any help would be appreciated, thanks.
  3. Hi, I have a membership site, and I'd like to stop people from certain areas from signing up. What I've done is add an htaccess file with <Files *> order deny,allow followed by a list of country based IPs. However, I'd like instead to only block the countries from the registration and login page, rather than the whole site. So would I use <Files register.php login.php> or do I need to have a comma or something to separate the two files?
  4. Hi, Could someone tell me what this means? What is the number and what is the difference between - + before the number? time() - 7776000
  5. Hi, I have a set of scripts that use a catchpa on the login form, but it just uses a background colour. How can I change the following to make it use a background image (catchpa.png) and a different font? <?php /*************************************************************************** * * Filename : image.php * Began : 2005/04/04 * Modified : * Copyright : (c) 2005 xkare.com * Version : 1.0 * Written by : Mert ÖÐÜT in istanbul / TURKEY * * You are encouraged to redistribute and / or modify this program under the terms of * the GNU General Public License as published by the Free Software Foundation * (www.fsf.org); any version as from version 2 of the License. * ***************************************************************************/ session_start(); function strrand($length) { $str = ""; while(strlen($str)<$length){ $random=rand(48,122); if( ($random>47 && $random<58) ){ $str.=chr($random); } } return $str; } $text = $_SESSION['string']=strrand(5); $img_number = imagecreate(47,17); $backcolor = imagecolorallocate($img_number,244,244,244); $textcolor = imagecolorallocate($img_number,0,0,0); imagefill($img_number,0,0,$backcolor); imagestring($img_number,50,1,1,$text,$textcolor); header("Content-type: image/png"); imagejpeg($img_number); ?>
  6. Hi, I have a set of ptc scripts that I can't get working properly. There are two types of membership, free and upgraded. When a buyer purchases advertising they can choose to display their ad to all members or just the upgraded. There is then a page with a list of ads that can be clicked. If the member is upgraded they will see the extra ads, or rather that is how it is supposed to be. For some reason the extra ads are not showing up for the upgraded members. The script for the list of ads is below. Can anyone see anything wrong? <? include "header.php";?> <h1>Surf Ads - Visit Websites</h1> <div align=center>Current Ad Count: <strong><?php $currentads = ($loggedin == 1 and $rowe["status"]=="upgraded") ? "" : " AND premium=0"; $currentads = mysql_query("SELECT COUNT(*) AS cnt FROM ads WHERE active='1'".$currentads); $currentads = mysql_fetch_array($currentads); $currentads = $currentads["cnt"]; print $currentads; ?></strong> New Ads Today: <strong> <?=$set["newadstoday"];?></strong> Total Ads Served: <strong> <?=$set["totalads"];?></strong><br><br></div> <?php $cats = array( "1" => "Arts & Entertainment", "2" => "Business & Money", "3" => "Computers & Internet", "4" => "Health & Recreation", "5" => "Reference & Education", "6" => "Shopping & Spending", "8" => "Travel & Accommodation", "9" => "Charity & Nonprofit" ); foreach($cats as $k=>$v) { print ' <table width="99%" border="0" align="center" cellpadding="0" cellspacing="0"> <tr> <td width="70%" class="surfcat"><span style="margin-left: 3px;"><strong>'.$v.'</strong></span></td><td width="10%" class="surfheader"><span style="margin-left: 3px;"><strong>Member</strong></span></td><td width="10%" class="surfheader"><span style="margin-left: 3px;"><strong>Outside</strong></span></td><td width="10%" class="surfheader"><span style="margin-left: 3px;"><strong>Total</strong></span></td></tr>'; $premium = ($loggedin == 1 and $rowe["status"]=="upgraded") ? "" : " AND premium=0"; $ads = mysql_query("SELECT COUNT(*) AS cnt FROM ads WHERE active='1' AND cat='$k'". $premium); $ads = mysql_fetch_array($ads); $ads = $ads['cnt']; if($ads == 0) { print '<tr> <td colspan="4" class="surfnoads"><span style="margin-left: 3px;">No Current Ads</span></td></tr>'; } else { $premium = ($loggedin == 1 and $rowe["status"]=="upgraded") ? "" : " AND premium=0"; $quer = mysql_query("SELECT * FROM ads WHERE active='1' AND cat='$k'". $premium); while($ad = mysql_fetch_array($quer)) { if($loggedin==1) { $checkvisit = mysql_query("SELECT COUNT(*) AS cnt FROM ad_clicks WHERE user='{$r['id']}' AND ad='{$ad['ad_id']}'") or die(mysql_error()); $checkvisit = mysql_fetch_array($checkvisit); $checkvisit = $checkvisit["cnt"]; } if($checkvisit > 0 and $loggedin ==1) { print ' <tr> <td width="70%" class="surfads"><span style="margin-left: 3px; text-decoration:none; color: #787878;"><font color=#660000><strike>'.$ad['ad_description'].'</strike></font> </span></td> <td width="10%" class="surfadsdetails"><span style="margin-left: 3px;">'.$ad['clicks'].'</span></td><td width="10%" class="surfadsdetails"><span style="margin-left: 3px;">'.$ad['outside'].'</span></td> <td width="10%" class="surfadsdetails"><span style="margin-left: 3px;">'.($ad['outside']+$ad['clicks']).'</span></td></tr>'; } else { print ' <tr> <td width="70%" class="surfads"><span style="margin-left: 3px; text-decoration:none; color: #787878;"><a href=view.php?ad='.$ad['ad_id'].' target=_blank style="text-decoration:none; color: #787878;">'.$ad['ad_description'].'</a> </span></td><td width="10%" class="surfadsdetails"><span style="margin-left: 3px;">'.$ad['clicks'].'</span></td><td width="10%" class="surfadsdetails"><span style="margin-left: 3px;">'.$ad['outside'].'</span></td><td width="10%" class="surfadsdetails"><span style="margin-left: 3px;">'.($ad['outside']+$ad['clicks']).'</span></td> </tr>'; } } } print "</table><br />"; } ?> <? include "footer.php";?>
  7. Hi, Can the mod-rewrite be used to display a different domain name in the address bar, eg. if a domain name is on one server but the website is on another. The DNS can't be changed, so a simple redirect is being used. But instead of name.otherserver.com/ in the address bar I'd like to display www.domain.com/ If not, is there any other way to get the domain name to show on the other server without changing the DNS or using frames?
×
×
  • 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.