Jump to content

mtylerb

Members
  • Posts

    69
  • Joined

  • Last visited

    Never

Everything posted by mtylerb

  1. I want to take a list of image files that I have transferred to a local server and compress them into one file. So: image1.jpg image2.jpg image3.jpg image4.jpg into images.gz or images.tar.gz Whatever is easier.
  2. Thanks corbin! I haven't found any information on php.net regarding the creation of tarballs. Is it only available through PEAR? Is there a good site for information on using this?
  3. Anyone? I suppose I could deal with a .zip file, if someone's able to help out, but I'd still prefer a .gz file.
  4. The current code looks like: function createArchive() { $archive = gzopen($_SERVER['DOCUMENT_ROOT'].'/grab/files/'.$this->year.'-'.$this->month.'-'.$this->day.'.gz','wb9'); $x=0; foreach($this->images as $url) { $x++; $parsed = parse_url($url); $host = $parsed["host"]; $fp = @fsockopen($host, 80, $errno, $errstr, 20); if(!$fp)return false; else { @fputs($fp, "HEAD $url HTTP/1.1\r\n"); @fputs($fp, "HOST: $host\r\n"); @fputs($fp, "Connection: close\r\n\r\n"); $headers = ""; while(!@feof($fp))$headers .= @fgets ($fp, 128); } @fclose ($fp); $return = false; $arr_headers = explode("\n", $headers); foreach($arr_headers as $header) { $s = "Content-Length: "; if(substr(strtolower ($header), 0, strlen($s)) == strtolower($s)) { $return = trim(substr($header, strlen($s))); break; } } $imgsize = $return; $fp = explode('/',$url); copy($url, $_SERVER['DOCUMENT_ROOT'].'/grab/files/'.$fp[count($fp)-1]); //unlink($_SERVER['DOCUMENT_ROOT'].'/grab/files/'.$fp[count($fp)-1]); } gzclose($archive); //unlink($_SERVER['DOCUMENT_ROOT'].'/grab/files/'.$this->year.'-'.$this->month.'-'.$this->day.'.gz'); } Probably should have posted that before. The unlinks are just there so I can uncomment them and delete the relevant files. Is anyone able to help?
  5. Ok, I've changed it up a bit and, instead, copied the files to the local server. Now how would I go about placing those files into a gz archive?
  6. Hey guys (and gals), I'm trying to call files from one of my servers to another. They are all image files and I'm mostly doing this as a learning experiment. Right now I have it so that it is reading the contents of the files, but the .gz file it creates only has one file and the image in it is about the first 10 pixels deep, and then nothing. So, assuming $contents is the fread of the file and $imagesize is just that, how would I put multiple files into a .gz compressed archive? I'm currently trying: $archive = gzopen($_SERVER['DOCUMENT_ROOT'].'/grab/files/'.$this->year.'-'.$this->month.'-'.$this->day.'.gz','wb9'); foreach($this->images as $url) { $parsed = parse_url($url); $host = $parsed["host"]; $fp = @fsockopen($host, 80, $errno, $errstr, 20); if(!$fp)return false; else { @fputs($fp, "HEAD $url HTTP/1.1\r\n"); @fputs($fp, "HOST: $host\r\n"); @fputs($fp, "Connection: close\r\n\r\n"); $headers = ""; while(!@feof($fp))$headers .= @fgets ($fp, 128); } @fclose ($fp); $return = false; $arr_headers = explode("\n", $headers); foreach($arr_headers as $header) { $s = "Content-Length: "; if(substr(strtolower ($header), 0, strlen($s)) == strtolower($s)) { $return = trim(substr($header, strlen($s))); break; } } $imgsize = $return; $fp = fopen($url,'r'); $contents = fread($fp, $imgsize); echo $imgsize."\r\n"; gzwrite($archive,$contents); } gzclose($archive); with no success. Any ideas? Thanks in advance! EDIT: That echo near the end is just for debugging.
  7. Ok, after playing around, I got it. Changed my .htaccess to: Options +FollowSymLinks AddDefaultCharset UTF-8 <IfModule mod_rewrite.c> RewriteEngine On RewriteBase / RewriteRule ^plugins.xhtml articles/plugins.xhtml [R=permanent,L] RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_FILENAME} !-l # Administration URL rewriting. RewriteRule ^admin(.*)$ admin/index.php?$1 [L,QSA] RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_FILENAME} !-l # Main URL rewriting. RewriteRule ^(.*)$ index.php?$1 [L,QSA] </IfModule> Adding that first RewriteRule in. While you're reading this, could someone tell me what the !-l, !-f, and !-d mean?
  8. I noticed this has been moved to a new board. Does anyone over here have any ideas?
  9. I posted that last addition as an Edit, this is just to let you know I replied.
  10. Ok, thank you, I figured out the .htaccess thing. Just placed the following code in and it worked perfectly: redirect 301 /plugins.xhtml http://www.tbeckett.net/articles/plugins.xhtml I don't know why it didn't work before. Thanks for your help Mchl and premiso! EDIT: Actually, I just noticed that it's now sending me to: http://www.tbeckett.net/articles/plugins.xhtml?plugins.xhtml My .htaccess looks like: Options +FollowSymLinks AddDefaultCharset UTF-8 redirect 301 /plugins.xhtml http://www.tbeckett.net/articles/plugins.xhtml <IfModule mod_rewrite.c> RewriteEngine On RewriteBase / RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_FILENAME} !-l # Administration URL rewriting. RewriteRule ^admin(.*)$ admin/index.php?$1 [L,QSA] RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_FILENAME} !-l # Main URL rewriting. RewriteRule ^(.*)$ index.php?$1 [L,QSA] </IfModule> Any ideas?
  11. Is there a way to fix this? The other files are all xhtml as well, for example, http://www.tbeckett.net/articles/libertarianism.xhtml Redirects to http://www.tbeckett.net/articles/politics/libertarianism.xhtml With no trouble. EDIT: Ok, you've offered ways to fix it, sorry, missed that. How would I do that with mod_rewrite? I already use mod_rewrite to remove the question mark from the url. I didn't design it though and the original 301 redirects that were put in the .htaccess never worked.
  12. Hey guys, I have a file that has moved and I'm trying to set up, what should be, a simple PHP header redirect. In my file at http://www.tbeckett.net/plugins.xhtml I'm using the following code: <?php header("HTTP/1.0 301 Moved Permanently"); header("Status: 301 Moved Permanently"); header("Location: http://www.tbeckett.net/articles/plugins.xhtml"); ?> But I only seem to get an error when I try to open that: Can anyone help me with this? I have the exact same script running in a number of other files, since I changed the structure of my page, they all work fine, it's just this one.
  13. http://www.tbeckett.net/ I thought it was in enough of the code. I went with BlueBoden's first solution in his last post and it works wonderfully! Thanks guys!
  14. I've also tried changing the second part with the RSS link and image to be a span instead of a div and the result is the same. It's broken in IE. The code with span instead of div looks like: <div class="path"> <div class="breadcrumb"> <a href="http://www.tbeckett.net/" title="Home Page">Home Page</a> <span class="breadcrumb-separator">-></span> <a href="http://www.tbeckett.net/articles.xhtml" title="Articles">Articles</a> <span class="breadcrumb-separator">-></span> <a href="http://www.tbeckett.net/articles/politics.xhtml" title="Politics">Politics</a> <span class="breadcrumb-separator">-></span> <span class="breadcrumb-current">Political Leaning</span><span style="float:right;position: relative;top:-16px;"><a href="http://www.tbeckett.net/rss"><img src="http://www.tbeckett.net/public/stylesheets/img_dirtylicious/rss.png" alt="rss" style="vertical-align:middle;border: 0px;" /> RSS Feed</a></span></div> </div> <!-- end #path--> I'll leave it like that for now so you can see it, if you want. It only affects IE, I only have access to IE7, so I don't know about other versions.
  15. I did, that's what the str_replace accomplished. After the str_replace, the code looked like: <div class="path"> <div class="breadcrumb"> <a href="http://www.tbeckett.net/" title="Home Page">Home Page</a> <span class="breadcrumb-separator">-></span> <a href="http://www.tbeckett.net/articles.xhtml" title="Articles">Articles</a> <span class="breadcrumb-separator">-></span> <a href="http://www.tbeckett.net/articles/politics.xhtml" title="Politics">Politics</a> <span class="breadcrumb-separator">-></span> <span class="breadcrumb-current">Political Leaning</span><div style="float:right;position: relative;top:-16px;"><a href="http://www.tbeckett.net/rss"><img src="http://www.tbeckett.net/public/stylesheets/img_dirtylicious/rss.png" alt="rss" style="border: 0px;" /> RSS Feed</a></div></div> </div> <!-- end #path--> As soon as this was in place, IE no longer worked. FF and Opera did, but IE started displaying the left hand menus below the main content. After I removed it, IE reverted back to normal. I'm sure it has something to do with the float.
  16. Ok, major problems now in IE7. *Sigh*, I don't know what I did wrong. It works perfectly in FF!
  17. Ok, this was my solution, but please feel free to tell me if there's a better way of doing this. The function creating the breadcrumbs was $this->breadcrumbs(). So, I str_replaced it like: <?php echo str_replace('</div>','<div style="float:right;position: relative;top:-16px;"><a href="'.BASE_URL.'rss"><img src="'.BASE_URL.'public/stylesheets/img_dirtylicious/rss.png" alt="rss" style="border: 0px;" /> RSS Feed</a></div></div>', $this->breadcrumbs('->')); ?> It seems to be doing what I want it to do, though I'm sure there's better ways to do this. The page is a fixed width, so I don't think there's going to be too many bugs.
  18. Hi (again), I'm trying to make my "Breadcrumb" section in my site display like this: Instead, it keeps showing up like: My div's look like: <div class="path"> <div class="breadcrumb"> <a href="http://www.tbeckett.net/" title="Home Page">Home Page</a> <span class="breadcrumb-separator">-></span> <a href="http://www.tbeckett.net/articles.xhtml" title="Articles">Articles</a> <span class="breadcrumb-separator">-></span> <a href="http://www.tbeckett.net/articles/politics.xhtml" title="Politics">Politics</a> <span class="breadcrumb-separator">-></span> <span class="breadcrumb-current">Political Leaning</span></div> </div> <!-- end #path--> <div class="path" style="text-align: right;"> <a href="http://www.tbeckett.net/rss"><img src="http://www.tbeckett.net/public/stylesheets/img_dirtylicious/rss.png" alt="rss" style="border: 0px;" /> RSS Feed</a> </div> I realize div's tend to put a line break after each, but is there a way to override that? Is there another solution? The Breadcrumb is hard coded as part of the CMS and so I cannot, easily, change the div class breadcrumb. So how can I align the RSS link to be on the same line? The site with that exact code is at: http://www.tbeckett.net/articles/politics/2008/11/09/political-leaning.xhtml Any help is greatly appreciated!
  19. Yeah, my problem is I was only looking at the CSS, not the inline styles. I totally missed that in the page's code.
  20. Thank you BoltZ! You rock! I fixed 2/3 of those issues and it validates without issue. The second one, from what I understood, was an IE fix for the suckerfish drop down menus, in conjunction with one of the js scripts in the head of the page. I didn't really design the CSS and menu design, so I'm kind of guessing with that. It validates fine without fixing it, though. Thanks again!
  21. http://jigsaw.w3.org/css-validator/validator?uri=http%3A%2F%2Fwww.tbeckett.net%2Farticles%2Fplugins%2Ftagger.xhtml&profile=css21&usermedium=screen&warning=2&lang=en Ok, maybe this would be better as it includes the URI.
  22. Hey, I'm having trouble with the following piece of code: .fb_share_link a { padding : 2px 0 0 20px; height : 16px; width : 125px; color : #4444ff; } When I try to validate the CSS, I get the following error: That is the only section that uses 125 and 16 for its values and there is a unit after the numbers. I can't figure out what's wrong. Any ideas? For reference, the remainder of the CSS is: /*############################################################# Name: Dirtylicious Date: 2007-03-10 Description: A soft-colored, bright and somewhat dirty two-column template. Author: Viktor Persson URL: http://templates.arcsin.se Feel free to use and modify but please provide credits. Ported to Frog CMS by: David Reimer - erajad.byethost10.com Frog version: 1.0[20080329] #############################################################*/ /* standard elements */ html {min-height: 100%;} * { margin: 0; padding: 0; } a {color: #048;} a:hover {color: #06C;} body { background: #E7E7E2 url('img_dirtylicious/body.jpg') no-repeat center top; color: #444; font: normal 62.5% Tahoma,sans-serif; padding-top: 64px; } p,code,ul,ol { padding-bottom: 0.6em; padding-top: 0.6em; } li { list-style: none; padding: 5px 0px 5px 0px; } h1 {font: normal 1.8em Tahoma,sans-serif;} h2 {font: bold 1.4em sans-serif;} h3 {font: bold 1.2em Tahoma,sans-serif;} h4 {font: bold 1em Tahoma,sans-serif;} form,input {margin: 0; padding: 0; display: inline;} pre { background: #FFF; border: 1px solid #EEE; border-left: 6px solid #CCC; color: #666; display: block; font: normal 1em Tahoma,sans-serif; line-height: 1.6em; margin-bottom: 12px; padding: 8px 10px; white-space: pre; } code { background: #FFF; font: normal 1em "Courier New",monospace; } blockquote { background: #E7E7E2 url('img_dirtylicious/quote.gif') no-repeat; display: block; padding: 0px 10px 0px 28px; margin: 10px 0px 10px 0px; } blockquote.essay { background: #E7E7E2 url('img_dirtylicious/quote.gif') no-repeat; display: block; font-weight: 600; line-height: 150%; text-indent: 28px; padding-left: 28px; margin: 10px 0px 10px 0px; } h1,h2,h3,h4 {padding-top: 6px; color: #553; margin-bottom: 4px;} /* misc */ .clearer {clear: both; font-size: 0;} .footerLeft {float: left;} /* changed names to prevent conflict with admin css */ .footerRight {float: right;} /* original here is simply ".left" and ".right" */ /* structure */ .inner-container { border: 2px solid #D7D7D2; background: #FFF; font-size: 1.2em; margin: 0 auto; padding: 10px; width: 780px; } .outer-container { background: url('img_dirtylicious/container.jpg') no-repeat center bottom; padding-bottom: 64px; } /* header & title */ .header { background: #222 url('img_dirtylicious/header.jpg') no-repeat; height: 160px; margin-bottom: 5px; text-align: center; } .header .title { color: #FFF; padding-top: 50px; } .header .title .sitename a { border-bottom: 1px dashed #657382; color: #FFF; font: normal 3em sans-serif; padding-bottom: 2px; text-decoration: none; } .header .title a:hover {border-color: #F60;} .header .title .slogan { font: normal 1.1em Verdana,sans-serif; padding-top: 6px; } /* path */ .path { background: #949490; color: #FFF; font: normal 1.1em Verdana,sans-serif; padding: 8px 12px; } .path a { color: #FAFAFA; text-decoration: none; } .path a:hover { color: #FFE; text-decoration: underline; } /* main */ .main { background: url('img_dirtylicious/main.gif') repeat-y; border-top: 4px solid #FFF; padding: 8px 12px 0 0; } /* content */ .content { float: right; width: 538px; } .content .info { /* .descr */ color: #664; font-size: 0.9em; margin-bottom: 6px; } .content ul li { list-style: url('img_dirtylicious/li.gif'); margin-left: 18px; } .content ol li { list-style: decimal; margin-left: 18px; } .content p {font-family: "Lucida Sans Unicode",sans-serif;} .content .comment-form-body { width: 450px; } /* navigation */ .navigation { float: left; width: 210px; } .navigation h2,.navigation h3 { color: #5A5A43; font: bold 1.1em Tahoma,sans-serif; line-height: 30px; margin: 0; padding-left: 12px; } .navigation ul, .navigation ol { padding: 0; border-top: 1px solid #EAEADA; } .navigation li {border-bottom: 1px solid #EAEADA;} .navigation li a { display: block; list-style: none; font-size: 1.1em; color: #554; text-decoration: none; padding: 8px 0 8px 5%; width: 95%; } .navigation li a:hover { background: #F0F0EB; color: #654; } .navigation p { border-top: 1px solid #EAEADA; border-bottom: 1px solid #EAEADA; line-height: 1.6em; font-size: 1.1em; color: #554; display: block; padding: 8px 0 8px 5%; width: 95%; } /* footer */ .footer { background: #949490; color: #F7F7F2; font: bold 1em sans-serif; margin-top: 5px; padding: 10px 12px; } .footer a { color: #F7F7F2; text-decoration: none; } .footer a:hover {color: #FFC;} .contactForm { width:308px; } .contactForm p { padding:10px; } .contactForm input { width:240px; } .contactForm textarea { width:281px; height:120px; } .submit { width:45px!important; } .fb_share_link a { padding: 2px 0 0 20px; height: 16px; width: 125px; color: #4444FF; }
  23. I appreciate the help, that comment was from a plugin that I have installed in the Frog CMS running the site. As soon as I moved that further down into the head, IE snapped back to working. Thanks again BlueBoden!
  24. Hey guys. I seem to be having a problem with my site not displaying correctly in IE. I only have access to IE7, but I'm going to assume the problem is apparent in all versions of IE. The site displays correctly in Firefox and Opera. The only CSS I have added is for a suckerfish implementation of the menus. That CSS is: <style type="text/css"> #nav-m { } #nav-m ul { float: left; list-style: none; line-height: 1.6em; background: #f7f7f2; border-bottom: 1px solid #EAEADA; padding: 0; border-top: 1px solid #EAEADA; } #nav-m a { display: block; font-size: 1.1em; color: #554; text-decoration: none; padding: 8px 0 8px 5%; width: 95%; w\idth: 57%; } #nav-m a.daddy { } #nav-m li { float: left; padding: 5px 0px 5px 0px; width: 100%; border-bottom: 1px solid #CACABA; } #nav-m li ul { position: absolute; left: -999em; height: auto; width: 14.4em; w\idth: 13.9em; font-weight: normal; border: 2px solid #CACABA; margin: -3em 0 0 12em; } #nav-m li li { padding-right: 1em; width: 13em } #nav-m li ul a { width: 13em; w\idth: 9em; } #nav-m li ul ul { margin: -3em 0 0 12em; border: 2px solid #EAEADA; } #nav-m li:hover ul ul, #nav-m li:hover ul ul ul, #nav-m li.sfhover ul ul, #nav-m li.sfhover ul ul ul { left: -999em; } #nav-m li:hover ul, #nav-m li li:hover ul, #nav-m li li li:hover ul, #nav-m li.sfhover ul, #nav-m li li.sfhover ul, #nav-m li li li.sfhover ul { left: auto; } #nav-m li:hover, #nav-m li.sfhover { background: #F0F0EB; } </style> <script type="text/javascript"><!--//--><![CDATA[//><!-- sfHover = function() { var sfEls = document.getElementById("nav-m").getElementsByTagName("LI"); for (var i=0; i<sfEls.length; i++) { sfEls[i].onmouseover=function() { this.className+=" sfhover"; } sfEls[i].onmouseout=function() { this.className=this.className.replace(new RegExp(" sfhover\\b"), ""); } } } if (window.attachEvent) window.attachEvent("onload", sfHover); //--><!]]></script><title>Tyler's Site - Home Page</title> <script src="/js/jquery.packed.js" type="text/javascript" charset="utf-8"></script> <script type="text/javascript" charset="utf-8"> $(document).ready( function() { $('a.external_link').click( function() { window.open(this.href); return false; }); }); </script> After I put that in, it stopped working in IE, but I have no idea where to start looking. The page should be in the middle of the layout, but in IE, it's stuck to the left side. Any ideas?
  25. Hey everyone, I have a plugin for a CMS that searches out multiple "archives" of articles and then sorts/limits (according to whatever the user says) then displays them as one array. One of the users has had a problem with an error: Fatal error: Maximum execution time of 30 seconds exceeded in /usr/home/web/user/frog/plugins/adv-find/index.php on line 45 The offending lines are: <?php private function trimc($limit) { $this->children = array_slice($this->children, 0, $limit); //Line 45 } ?> The whole class is: <?php Plugin::setInfos(array( 'id' => 'adv-find', 'title' => 'Advanced Find', 'description' => 'Allows you to search many different archives and sort them by date.', 'version' => '1.0.1', 'license' => 'AGPL', 'author' => 'Tyler Beckett', 'website' => 'http://www.tbeckett.net/articles/plugins/adv-find.xhtml', 'update_url' => 'http://www.tbeckett.net/fpv.xhtml', 'require_frog_version' => '0.9.4' )); error_reporting(E_ALL^E_NOTICE); class adv_find extends Page { private $search; private $vars; private $sortAttribute; public $children; private function sorty($attribute) { $this->sortAttribute = $attribute; usort($this->children, array($this, 'cmpVals')); } private function cmpVals($val1, $val2) { $search = $this->sortAttribute['0']; $order = $this->sortAttribute['1']; if (strtoupper($order) == 'DESC') { return (strcasecmp($val1->$search, $val2->$search)*-1); } return strcasecmp($val1->$search, $val2->$search); } private function trimc($limit) { $this->children = array_slice($this->children, 0, $limit); } public function adv_where($search, $vars) { // Use Frog's built in find function to search for each of the arguments provided foreach ($search as $sought) { $results[] = parent::find($sought); } // Use Frog's built in children function to get all children of the above searched for archives foreach ($results as $parent) { $children[] = $parent->children($vars); } // Count the number of archive variables in the array $total = count($children); // Count the number of children variables to each of the archive variables above for ($x = 0; $x <= $total; $x++) { $ctotal[$x] = count($children[$x]); } // Combine all the search results into one $combine variable $combine = array(); for ($x = 0; $x < $total; $x++) { for ($y = 0; $y < $ctotal[$x]; $y++) { array_unshift($combine,$children[$x][$y]); } } unset($children); $this->children = $combine; unset($combine); // If the user has chosen an order that they'd like the results in, order like so if (isset($this->vars['order'])) { $sve = explode(' ', $this->vars['order']); adv_find::sorty($sve); } // If the user wants to limit their results, trim the remaining off if (isset($this->vars['limit'])) { adv_find::trimc($this->vars['limit']); } return $this->children; } public function __construct($search,$vars) { // Instantiate all the variables necessary to do the search $this->search = $search; $this->vars = $vars; // Do the search and then save the results to $this->results $this->results = $this->adv_where($this->search,$this->vars); } } function adv_find($query, $args = '') { // Begin the process $found = new adv_find($query, $args); // Pass the results back to the user! return $found->children; } ?> I cannot, for the life of me, figure out why he'd have a max execution time problem. I currently display 16 articles on my RSS feed with no problems. Can anyone else here point me in a possible direction? Could it just be the user's server? Thanks in advance for any help.
×
×
  • 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.