Jump to content

is this even possible?


mrheff

Recommended Posts

hi guys ive been working on  agellrry thing for a little while now, and its really helped me find myself in php,

im just wondering if it is possible to change a $_FILE that has been uploaded to a normal url within my site via a normal variable,

i want to do a batch thingy with allready uploaded files using a script that currently deals with a fileupload, stright to watermarking....

 

heres the bit im trying to figure out... I need to create the $_File['watermark'] out of a $file variable which is a Url on my server...

 

So currently i only have...

 

$watermark= $_post['file']

// something like '/images/dir/here/whack.jpg' which would be defned earlier

 

this is the part of code im wanting to change...

if(isset($_FILES['watermarkee']) && $_FILES['watermarkee']['error']==0){   

//then it goes on to do the watermarking

 

Can anyone point me in the right direction? i can post the full code if you like but i thought it might be a bit too much....

Heff...

 

 

Link to comment
https://forums.phpfreaks.com/topic/42399-is-this-even-possible/
Share on other sites

i currently am running a small script which uploads then watermarks a file And i really want to access these functions without having to upload from a from, i want to be able to give it a variable ideally a url on my server and get it to water mark that....

 

for example I have a page which lists all images uploaded (unwatermarked), and with each picture it has a submit button, that says Portrait and later it will have a landscape, so as the user may choose which watermark to use.

So when i press submit it send this variable to a copy of the orginal script, but i dont know how to tell it not to use an uploaded file.... i want it to use the file i have selcted from the other page...

 

 

 

This is the form that send s the variable of the file location

 

<td>',"\n",
                     '       <a href="batch/pics/',$file,'" target="_blank"> <img src="show_batch.php?filename=batch/pics/',$file,'&height=100" border="0"','/> </a>',"\n",
				 "<form method=post action=processP.php>";
echo " <input type=hidden name=file value=batch/pics/$file><input type=submit name=process value=portrait></form> " ;
echo                    '      </td>',"\n";

 

 

 

and this is the start of The page that process it ....

   if(isset($_POST['process'])){
        // an image has been posted, let's get to the nitty-gritty
        if(isset($_['watermarkee']) && $_FILES['watermarkee']['error']==0){
        
            // be sure that the other options we need have some kind of value
            if(!isset($_POST['save_as'])) $_POST['save_as']='jpeg';
            if(!isset($_POST['v_position'])) $_POST['v_position']='bottom';
            if(!isset($_POST['h_position'])) $_POST['h_position']='right';
            if(!isset($_POST['wm_size'])) $_POST['wm_size']='1';
            if(!isset($_POST['watermark'])) $_POST['']=$default_watermark;
        
            // file upload success
            $size=getimagesize($_FILES['watermarkee']['tmp_name']);
            if($size[2]==2 || $size[2]==3){
                // it was a JPEG or PNG image, so we're OK so far
                
                $original=$_FILES['watermarkee']['tmp_name'];
                $target_name=date('YmdHis').'_'.
                    // if you change this regex, be sure to change it in generated-images.php:26
                    preg_replace('`[^a-z0-9-_.]`i','',$_FILES['watermarkee']['name']);
                $target=dirname(__FILE__).'/batch/pics/'.$target_name;
                $watermark=dirname(__FILE__).'/watermarks/'.$_POST['watermark'];
                $wmTarget=$watermark.'.tmp';

 

I wont post all of as i think after this it shouldnt need anymore editing...

 

 

Any ideas peeps?

 

 

 

Link to comment
https://forums.phpfreaks.com/topic/42399-is-this-even-possible/#findComment-205766
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.