andy's php projects
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister   ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 
Script and site usage:
All of the scripts on this site are provided free for non-commerical, personal or non-profit use. If you find these scripts useful to you, appreciate the free support, or are just an all round nice person, then why not donate a little dosh? If you wish to use any of these in a commercial system, please refer to the payment plan.


Crop a Screenshot

 
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    php.amnuts.com Forum Index -> Crop Canvas
View previous topic :: View next topic  
Author Message
Skitso
Newbie


Joined: 28 May 2003
Posts: 4
Location: Tall, FL-USA

PostPosted: Wed May 28, 2003 11:00 pm    Post subject: Crop a Screenshot Reply with quote

Greetings,
I noticed your script as I did my daily run through of Hotscripts.com/PHP.

I've been to your site a million times before, but now I have a valid curiosity to bug you with.

I haven't looked at that script, but I plan to after posting this.

I'm creating a link script, in PHP + Mysql. I wouldn't say I'm new to PHP, but I'd say I do desire to learn more Smile Anyhow, this link script will be simple-Using a database abstraction script (layer, or whatever its called), I'll be simply making entries into a MySQL db. Each entry will be in a category as you can imagine, and each entry will have info about the site.

The question is that would it be effective to use PHP to auto crop screenshots from IE, then thumbnail them and dispose of the original file. Since there would be few of these operations taking place a day, this wouldn't be cause for my hosts to kick me for CPU use, but I'm wondering how I might attain this effect using some methods in the script you released.

If I simply zoomed in on a screenshot and counted the pixels to remove the top file+button navigation, the status bar, the taskbar and the pixels on the left & right, I think I could do this because the Screenshot will always be mine, from IE, and 1280*1024.

I'm thinking this would save me time, and maybe make this script a little more popular than otherwise.

I just thought I'd bounce the idea off of someone who knows alot more about PHP than I do.

Your thoughts, & ideas are welcome!

-Skitso.com
Back to top
View user's profile Send private message Send e-mail Visit poster's website AIM Address Yahoo Messenger
amnuts
Site Admin


Joined: 01 Sep 2002
Posts: 662
Location: East Sussex, England

PostPosted: Thu May 29, 2003 3:55 pm    Post subject: Reply with quote

Hi Skitso, and welcome to the board!

I like the idea.. If you're going to be taking the screenshots yourself and uploading them, then so long as they are always taken the same, with your browser window in the same position, same size, same toolbars, etc., then it's totally fesible to do! Infact, it reminds me a little of something I did recently... I had a bunch of images of varying sizes that all had the drop shadow on them created with the dropshadow class. What I wanted to do was remove the drop shadow and just have the image. The images were different sizes, but this didn't matter because the dropshadow was a constant. So I could determine where to crop based on the image size - the dropshadow size. Here's the code I used:

Code:
<?php

   set_time_limit(500);

   require './www/includes/class.cropcanvas.php';
   $cc = new canvasCrop();

   $count = 0;
   if (($dir = @opendir("./www/images/gallery")))
   {
      while ($file = @readdir($dir))
      {
         if (ereg("^\.$",$file) || ereg("^\.\.$",$file)) continue;
         $name = basename($file);
         ++$count;

         $cc->loadImage('./www/images/gallery/'.$name);
         $width  = ImageSX($cc->_imgOrig);
         $height = ImageSY($cc->_imgOrig);
         $cc->cropToDimensions(6, 5, $width-10, $height-11);
         $cc->saveImage('./www/images/gallery/'.$name, 100);
         $cc->flushImages();
      }
      @closedir($dir);
      echo "<p>Processed $count file(s)</p>\n";
   }
   else
   {
      echo "<p>Cannot open directory for reading</p>\n";
   }

?>


Doesn't that seem to be what you're thinking? Infact, the need to remove the dropshadows is the reason this crop canvas class exists! Smile

Andy
Back to top
View user's profile Send private message Send e-mail Visit poster's website AIM Address Yahoo Messenger MSN Messenger
Skitso
Newbie


Joined: 28 May 2003
Posts: 4
Location: Tall, FL-USA

PostPosted: Thu May 29, 2003 11:29 pm    Post subject: Reply with quote

From the looks of it, I could indeed use that script Smile Thats cool, you made a script for almost the exact same purpose, and here I stumble upon it. Very coincidental Very Happy

Your script has caused me to address a problem I've been too lazy to fix. For some reason or another GD hasn't been functioning with my current version of PHP, the problem I don't know...because it should work. So, and this is prefect timing, I have downloaded4.2.3. GD should work now with no problem. Only thing is, Because I'm on windows, and I used an installer to get a bunch of "cool" features (extensions installed "for me") I have to put everything in place myself. So, I was working on a marketing project for selling Petro.us earlier today, now its 12.22am here and I can finally learn more about GD!

I give great thanks for the scripts you have provided! Finally I have a reason to learn more about GD, rather than saying "I wanna learn more about GD".

Anyhow, great work on the class and everything else you release for the community Smile We enjoy it, and otherwise I probably would have put off upgrading PHP, and learning more about GD for another few months!

After I install the new version of PHP, I'll work a little on this screen shot cropper, and I've already begun an idea of how to configure a script to work for all resolutions, with version 6 of IE. It'd be rather bothersome, but if I were to release anything I'd want it to be able to be used by others.

When I finish my current task, I'll be back to let you know about it.

Thanks for everything!!!
[/url]
Back to top
View user's profile Send private message Send e-mail Visit poster's website AIM Address Yahoo Messenger
Skitso
Newbie


Joined: 28 May 2003
Posts: 4
Location: Tall, FL-USA

PostPosted: Fri May 30, 2003 12:55 am    Post subject: Reply with quote

I'm back...

Installed new php version, GD working great, I'm so happy!

I don't know why I had to think over complicated before, but I found a quick fix.

For all users on IE 6, go to fullscren (F11).
Right click on the top bar, a menu will appear, turn "auth hide" on.
Nothing but the scrollbar will be impeding your scrollbar.
Print screen, or use your screenshot manager program, etc.
The scrollbar, as far as I could tell is approximately 15 pixels wide, the crop class required me to input 30, as 15 simply cropped half of the scrollbar.

Based on the examples given in the code:
Code:

<?
/*
1280*1024 | Internet Explorer V.6
31 Pixels on top
15 on the right side
...wait, theres an easier way to do this!
---------------------------------------------
?For all users on IE 6, go to fullscren (F11).
?Right click on the top bar, a menu will appear, turn "auth hide" on.
?Nothing but the scrollbar will be impeding your scrollbar.
?Print screen, or use your screenshot manager program, etc.
?The scrollbar, as far as I could tell is approximately 15 pixels wide, the crop class required me to input 30, as 15 simply cropped half of the scrollbar.
*/
   set_time_limit(500);
   require 'class.cropcanvas.php';
   $cc = new canvasCrop();
       $cc->loadImage('Screenshot.png');
         $cc->cropBySize('30', ccRIGHT);
       $cc->showImage('png');
         $cc->saveImage('CroppedScreenshot.png');
         $cc->flushImages();
?>

***By the way, you need to implement [php][/php] tags

I simply used your example, after I thought about it:)

However, on alternative browsers like Opera, and Netscape, the first method would probably have to be utilized.

I'm going to create a script that crops like I was originally thinking anyways, afterall, you've pretty much done the work for me, it'd be a waste not to learn how to use this leet class.
Back to top
View user's profile Send private message Send e-mail Visit poster's website AIM Address Yahoo Messenger
amnuts
Site Admin


Joined: 01 Sep 2002
Posts: 662
Location: East Sussex, England

PostPosted: Fri May 30, 2003 4:58 pm    Post subject: Reply with quote

GD is fun!! Right now I'm just playing around with a selective blur algorithm that was written in C and I've moved over to PHP (shame it takes about 10 minutes to blur a decent sized image! Laughing) and also adjusting the threshold of an image so it's only black and white based on the threashold level. I'm hoping to combine the two to produce a dynamic drop-shadow.

I hear you about having a reason to learn GD! It was always like that for me too; "GD seems cool.. I should learn it!" and never did... But then I wanted to create an image gallery so dove stright in. In the end I came up with an admin class that would allow you to retoate and flip the images (before the built in GD function to rotate the images was in PHP!) Sloppy code, now I look back at it, but ahh... it was fun!!

Oh, and seeing as you asked, you now have 'php' tags as well as the standard 'code' tags.

Cheers!

Andy
Back to top
View user's profile Send private message Send e-mail Visit poster's website AIM Address Yahoo Messenger MSN Messenger
Skitso
Newbie


Joined: 28 May 2003
Posts: 4
Location: Tall, FL-USA

PostPosted: Sun Jun 01, 2003 1:05 am    Post subject: Reply with quote

Lol,
Cool, the more experianced board surfers can now make their code available in an array of colors Very Happy

Nother late night too. Bad habit of mine. I have drive though Smile 11am-3/4am "shifts".

Though, majority of that is design n such, not to mention the few hours worth of diverts Smile
Back to top
View user's profile Send private message Send e-mail Visit poster's website AIM Address Yahoo Messenger
Display posts from previous:   
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    php.amnuts.com Forum Index -> Crop Canvas All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group