Zubrag.com
January 16, 2018, 11:20:35 PM *
Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
 
   Home   Help Search Login Register  
Pages: [1]
  Print  
Author Topic: How to capture a web image via my WEB page???  (Read 25469 times)
Charlie123
Newbie
*
Posts: 4


« on: March 29, 2007, 12:43:27 PM »

Hello,

His somebody can answer me,  Cry
as I'm working on this issue since march 25 and did not resovle it still.
Of course I'm a newbies but I don't give up  Wink I learn a lot but not enough to make it
work as I wish.

I can run IECapt.exe not problem from the DOS command:

C:\>iecapt.exe http://www.pepsi.com mypepsiImage.png

and all is OK, file is saved in the same dir used by IECapt.exe (image_thumbnail)

Now I have tried to use IECapt via a web page. Here my last steps;

1) in the htdocs(Apache) I create a form.php
2) from this form.php I call (with include command) another php page;  execute.php located in IECapt folder =  image_thumbnail
3) in this execute.php I'm putting the following script(this only line of command) just for testing:

----------------------------------------------------------------------------------------------------
<?php

// Get website image and save it on the server.
  @exec('IECapt.exe ' . escapeshellarg('http://www.cisco.com/') . ' ' . escapeshellarg('cisco.pgn'));
?>
---------------------------------------------------------------------------------------------------

but nothing is working. DOS window appear half a second and dissapear...

What am I doing wrong ?
I want a user from my web page to capture a thumnail and save images to my server.
Please can you help me and provide me brieftly(as I don't want to anoye you) the steps to follow properly, I did try everything since... Angry mmmmmm.....  !!!

prior to what I did above (from a form.php located in htdocs), I tried the following by  inserting an image_type value = 3 to start the webthumb.php as a default hiden value (don't want the user to select any selection box) I want png by defaut... and of course I put an URL text box ;

form.php (in htdocs);
------------------------------------------------------------------------------------------------
<body>
<p>&nbsp;</p>
<form id="form1" name="form1" method="post" action="webthumb.php">
<label>
<p>Pls Enter WEB site:                                                       <-------------
  <input name="textfield" type="text" value="" />
</p><p> <input type="submit" name="url" value="Submit" />      <-------------???
<input type='hidden' name='image_type' value='3' />                 <-------------???
  </p>
</p>
</form>
-------------------------------------------------------------------------------------------------

and I put this at the beggining of
the webthumb.php:

------------------------------------------------------------------------------------------------

if(isset($_POST['url']) && isset($_POST['image_type'])){
$website_url = $_POST['url'];
$image_type = $_POST['image_type'];
} else {
die("Site URL must be specified.");
}

------------------------------------------------------------------------------------------------
this last input gives me:
Thumbnail Generation Error. Thumbnail not created.
problem seems to be at the image_type selection !!!

I did put in webthumb.php my path(where my images and my IECapt are located):

$thumbnails_folder = 'C:/Program Files/Apache Group/Apache2/htdocs/image_thumbnail/';

(I'm using a Locally;  Apache 2.0.59, PHP 4.3.10 running on Windows XP sp 2 and MYSQL). 


Brgds/Charlie123

Logged
zubrag
Administrator
Hero Member
*****
Posts: 785


WWW
« Reply #1 on: March 29, 2007, 12:51:38 PM »

Do you have gdiplus.dll in the folder where you placed iecapt.exe?

Try saving this as php file, and run from browser. Does it show some errors?
<?php
$arr = array();
exec('IECapt.exe http://www.cisco.com cisco.png', $arr);
echo "<pre>"; print_r($arr);
?>
Logged
Charlie123
Newbie
*
Posts: 4


« Reply #2 on: March 29, 2007, 03:36:46 PM »

Hello,

yes I did put gdiplus.dll in IECapt.exe folder and name it: gdiplus.php
than I opened a new page in Dreamweaver (new, php) and put the following into my form.php;

-------------------------------------------------------------
<?php
$arr = array();
exec('IECapt.exe http://www.cisco.com cisco.png', $arr);
echo "<pre>"; print_r($arr);
?>
-------------------------------------------------------------

and I did received as response:

     Array
     (
     )


What this suppose to mean Huh

Brgds/Charlie123










Logged
zubrag
Administrator
Hero Member
*****
Posts: 785


WWW
« Reply #3 on: March 29, 2007, 04:16:01 PM »

this means iecapt did not produce any error. could you search your system for cisco.png? Maybe it is created somewhere...
Logged
Charlie123
Newbie
*
Posts: 4


« Reply #4 on: March 29, 2007, 06:36:13 PM »

Hello sir,

don't want to give up  Grin

I did look into all my file and IECapt...and this was duplicated in a directory above htdocs..think that was one of the problem because when I cleaned it, my form was able to open DOS for half a second and than closed. with your script provided to me;                   

-----------------------------------------------------------------------------------------------------------
<?php
$arr = array();
exec('IECapt.exe http://www.cisco.com cisco.png', $arr);
echo "<pre>"; print_r($arr);
?>
-----------------------------------------------------------------------------------------------------------
looked after several minute to see if cisco.png existed but nothing in my PC at all.

than, I executed: this form.php;
(I think that my problem is here: (check the arrow below <----?Huh??));
so what I'm trying to do, it is to have a text box to send the URL + png format (per default) sent to:
webthumb.php

here is my form.php; 
-----------------------------------------------------------------------------------------------------
<body>
<p>&nbsp;</p>
<form id="form1" name="form1" method="post" action="webthumb.php">
<label>
<p>Pls Enter WEB site:
  <input name="textfield" type="text" value="" />
</p><p> <input type="submit" name="url" value="Submit" />
<input type="hidden" name="image_type" value="3"/>  <----------?HuhHuh??

</p>
</p>
</form>

<p>&nbsp;</p>
</body>
----------------------------------------------------------------------------------------------------

My URL is passing, but this Image_type is giving my error msg IMAGE TYPE PBM (that I put for troubleshooting);

if ($image_type == 1) $output_format = 'gif';
if ($image_type == 2) $output_format = 'jpg';
if ($image_type == 3) $output_format = 'png';
die("IMAGE TYPE PBM");                               <-------------------------- giving me this error msg.

----------------------------------------------------------------------------------------------------------

Here below is the script that I use; 
Is line no. 7($image_type = 3; should be remove or Huh?)


webthumb.php;
-------------------------------------------------------------------------------------------
$thumbnails_folder = 'C:/Program Files/Apache Group/Apache2/htdocs/image_thumbnail/';

// thumbnails expiration time in minutes
$cache_expire_time = 60;

// quality (for jpeg only)
$image_quality = 100;

// resulting image type (1 = GIF, 2 = JPG, 3 = PNG)
$image_type = 3;                     <-------------------------??? should be removed???

// maximum thumb side size
$max_x = 100;
$max_y = 100;

// If not equal 0 then cut original image size before resizing (in pixels).
// Long page will have bad thumbnail, its better to cut page length first.
$cut_x = 0;
$cut_y = 1024;

###############################################################################
# END OF SETTINGS. DO NOT EDIT BELOW
###############################################################################

if(isset($_POST['url']) && isset($_POST['image_type'])){
$website_url = $_POST['url'];
$image_type = $_POST['image_type'];      <--?Huh is it OK?Huh ---is value= 3 (from my form.php will go there)??
} else {
die("Site URL must be specified.");   <-------this seem OK as I don't have any error msg for this one.
}
if ($image_type == 1) $output_format = 'gif';
if ($image_type == 2) $output_format = 'jpg';
if ($image_type == 3) $output_format = 'png';
die("IMAGE TYPE PBM");                               <-------------------------- giving me this error msg.

$website_url_md5 = md5($website_url);

$cached_filename = $thumbnails_folder . $website_url_md5 . '.' . $output_format;

// See if we have cached website screenshot image (to minimize server load)
if (!file_exists($cached_filename)
|| filemtime ($cached_filename) + $cache_expire_time * 60 < time() ) {

  // Get website image and save it on the server.
  @exec('IECapt.exe ' . escapeshellarg($website_url) . ' ' . escapeshellarg($cached_filename));

} // if (!file_exists

if (!file_exists($cached_filename)) {
  die("Thumbnail Generation Error. Thumbnail not created.");
}

// create class instance
include("file:///C|/Program Files/Apache Group/Apache2/A1 Thumnail generator/image.class.php");
$img = new Zubrag_image;

// get parameters
$img->image_type   = $image_type;
$img->quality      = isset($_REQUEST['q']) ? intval($_REQUEST['q']) : $image_quality;
$img->max_x        = isset($_REQUEST['x']) ? intval($_REQUEST['x']) : $max_x;
$img->max_y        = isset($_REQUEST['y']) ? intval($_REQUEST['y']) : $max_y;
$img->save_to_file = false;
$img->cut_x        = $cut_x;
$img->cut_y        = $cut_y;

// generate thumbnail and show it
$img->GenerateThumbFile($cached_filename, '');

?>
---------------------------------------------------------------------------------------------------------

I have a question for you....Is this scritp is writing automatiquely a file name according to the URL name Huh
Or should I put a picture+format name in my form.php Huh? maybe that's my mistake ??

Will wait for tomorrow for an answer as I'm very tired sir...

Brgds/Charlie.





Logged
zubrag
Administrator
Hero Member
*****
Posts: 785


WWW
« Reply #5 on: March 30, 2007, 09:51:47 AM »

Please try saving following as php file and open it in browser. Does it show some errors? Any output at all?

<?php
ini_set('display_errors', 1);
ini_set('error_reporting', E_ALL);

$arr = array();
exec('IECapt.exe http://www.cisco.com cisco.png', $arr);
echo "<pre>"; print_r($arr);
?>


Do you have safe_mode enabled in php?
Logged
Charlie123
Newbie
*
Posts: 4


« Reply #6 on: March 30, 2007, 11:44:09 AM »

Hello you!,


safe_mode = Off in php.ini

result form your query is the same as yesterday:

Array
(
)

 Huh


Logged
brightonpark
Newbie
*
Posts: 1


« Reply #7 on: January 08, 2009, 09:29:08 AM »

I'm having exactly the same problem. I'm guessing the fault is in my hosting set up rather than in the thumbnail generator. Is there a simple way I can check if I have permission to run exe files? I dont get any php errors or server errors, just the 'Thumbnail Generation Error. Thumbnail not created' one.
Logged
Pages: [1]
  Print  
 
Jump to:  

Powered by SMF 1.1.11 | SMF © 2006-2009, Simple Machines LLC