PHP远程图像处理,使用Picup应用程序在我的服务器上保存图像,用于移动狩猎


PHP Remote Image Process to save image on my server using the Picup App for mobile safari

我无法将图像保存在/image_upload/uploads/文件夹中(然后我有望解决其余问题)。

这是我从parorrey.com 得到的代码

<?php
//remote image to copy
 $remoteImageURL = 'http://www.mywebsite.com/image.jpg';  //I'm not sure what URL should be here
 //local directory to store image
$dir_path = 'http://www.mywebsite.com/image_upload/uploads/'; 
if($remoteImageURL)
{ 
    require_once('class.get.image.php');
    // initialize the class
    $image = new GetImage;
    // just an image URL
    $image->source = $remoteImageURL;
    $image->save_to = $dir_path; // with trailing slash at the end
    $get = $image->download('curl'); // using cURL
    $pic = $dir_path.basename($remoteImageURL);
    //you can use the picture path e.g. Insert into DB from this variable $pic
 ?>

这是PICUP应用程序的一些代码

<script> 
    var currentParams = {}
    document.observe('dom:loaded', function()
    {
        $(document.body).addClassName('iphone');
        // We'll check the hash when the page loads in-case it was opened in a new page
        // due to memory constraints
        Picup.checkHash();  
        // Set some starter params  
        currentParams = {
        'callbackURL'       : 'http://mywebsite.com/upload_pic5.php',   
        'postURL'           :       'http://www.mywebsite.com/image_upload/picup_remote_image.php', 
        'referrername'      : escape('mywebsite'),
        'referrerfavicon'   : escape('http://mywebsite.com/kwboat.ico'),
        'purpose'               : escape('Select your photo for our App.'),
        'debug'         : 'false',
        'returnThumbnailDataURL': 'true',
        'thumbnailSize'         : '150'
        };
        Picup.convertFileInput($('photo'), currentParams);
    });
</script>   
<script type="text/javascript">
    window.name = "fileupload";
</script>

这是我的表单代码

<form action="save.php" method="post" id="add_boat">
<div class="step_bar_info">Upload a Picture of your boat</div>
<div id="image_box">
<div id="upload_area">
<?php if (isset($image_url))
{
    echo '<img src="' . $image_url .'" />';
}
else
{
    echo '<img src="images/boat.png" width="150px"/>';  
} ?>
</div>
<input type="file" name="photo" id="photo"/><br />
Please select your photo to upload, you will need to <a   href="http://itunes.apple.com/us/app/picup/id354101378?mt=8" target="_blank">install Picup App (Free) from iTunes.</a> <br /><br /> Picup is a free iPhone app that facilitates photo uploads to our web app. Since Mobile Safari doesnt support file-upload form fields
<?php $image_url=($pic); ?><!--  gets from image processor though maybe should just change $pic  -->    
</div><!--image box-->
<input type="hidden" id="image_url" name="image_url" value="images/boat.png"/>
<div id="titlebox">Boats name<br/><input name="title" type="text" size="24"   maxlength="60" value="" tabindex="1"></div><!--endtitlebox-->
<div id="info_box">Info<br/><textarea name="info" cols="20" maxlength="100" rows="2"    tabindex="6"></textarea></div>
<input id="add_boat" type="submit" name="add_boat" value="save " alt="submit" title="Save item in our secure database system " />
</form>

我想说的是,看看你的代码。如果您的选择文件按钮没有显示在您的表单上。在picup currentParams中。Picup.convertFileInput($('photo'), currentParams);"photo"是您的id="" name="",而不是"image_url"

尝试

// initialize the class
$image = new GetImage();

还是打字错误?