Forum Index
RegisterSearchFAQMemberlistUsergroupsLog in
Image from URL Copied to Cutenews Image Folder
Goto page 1, 2  Next
 
Reply to topic    Forum Index » Suggestions View previous topic
View next topic
Image from URL Copied to Cutenews Image Folder
Author Message
typeman



Joined: 17 Oct 2009
Posts: 92

Post Image from URL Copied to Cutenews Image Folder Reply with quote
Hey guys,

Just a quick suggestion and was hoping that someone out there with great PHP knowledge would be able to do this Very Happy

Basically, I was hoping that maybe it would be possible to add another field to the image upload section that would allow users to copy an image url, and after clicking submit, the image would then be copied to your cutenews database. This would save having to download/upload an image as it would be pretty much instant.

Hopefully someone can muster this up! Very Happy
Tue Nov 24, 2009 6:38 pm View user's profile Send private message
Guest








Please login to hide the ads.

DarkSlim



Joined: 06 Aug 2009
Posts: 286
Location: IL

Post Reply with quote
Hmm I would try that but my images.mdu still isn't working properly :\

_________________
Portfolio: www.Yaniv.tk

Some of my Plugins and Mods and more in the CuteNewsRU Index!

Donations Accepted, Thank you
Wed Nov 25, 2009 9:54 am View user's profile Send private message Visit poster's website
eberswine



Joined: 26 Apr 2007
Posts: 268

Post Reply with quote
I think I understand.

Try this:

Find this in images.mdu (around line 629 or so)
Code:
<a target="_blank" title="<?=$echo['imageTitle']; ?>" href="<?=$config_path_image_upload.'/'.$file; ?>"><?=$file; ?></a>


Change it to this:
Code:
<a target="_blank" title="<?=$echo['imageTitle']; ?>" href="<?=$config_path_image_upload.'/'.$file; ?>"><?=$file; ?></a><br /><input name="textfield" size="15" id="textfield" style="border: 2px solid rgb(204, 204, 204);" value="<?=$config_path_image_upload.'/'.$file; ?>" onclick="select()" type="text">


and you will get this:



Now you can just select it and copy and paste it. Smile
Wed Nov 25, 2009 5:57 pm View user's profile Send private message Visit poster's website
typeman



Joined: 17 Oct 2009
Posts: 92

Post Reply with quote
eberswine wrote:
I think I understand.

Try this:

Find this in images.mdu (around line 629 or so)
Code:
<a target="_blank" title="<?=$echo['imageTitle']; ?>" href="<?=$config_path_image_upload.'/'.$file; ?>"><?=$file; ?></a>


Change it to this:
Code:
<a target="_blank" title="<?=$echo['imageTitle']; ?>" href="<?=$config_path_image_upload.'/'.$file; ?>"><?=$file; ?></a><br /><input name="textfield" size="15" id="textfield" style="border: 2px solid rgb(204, 204, 204);" value="<?=$config_path_image_upload.'/'.$file; ?>" onclick="select()" type="text">


and you will get this:



Now you can just select it and copy and paste it. Smile


Hey, thanks for the help, but unfortunately, that wasn't what I was after. (but still a great idea nonetheless).

I'll try and explain better:

- Basically, you copy an image's URL (which isn't based on your server)
- Paste that into a box on YOUR server
- When you click upload, that same image is then copied to your server so it's under the URL of www.mysite.com/images/etc...

So instead of uploading from your computer, you can upload from a URL.

Hopefully that explanation is simplier. Very Happy
Thu Nov 26, 2009 12:06 am View user's profile Send private message
Chaser



Joined: 17 Feb 2009
Posts: 65

Post Reply with quote
I think this is what you need.

Add the following to images.mdu, below the existing <form>.
Code:
<b>Remote upload</b>
<form enctype="multipart/form-data" action="<?php echo $PHP_SELF; ?>&loadurl=true" method="post">
<table border="0" cellspacing="1" cellpadding="5"  width="300" class="panel">
  <tr>
    <td>
      <b>URL:</b>
    </td>
   
    <td>
      <input type="text" name="from" size="40">
   </td>
  </tr>
 
  <tr>
    <td>
      <b>Filename:</b>
     <br />(optional)
   </td>
   
    <td>
      <input type="text" name="to" size="40">
   </td>
  </tr>
 
  <tr>
    <td colspan="2">
      <input type="submit" value="Submit">
   </td>
  </tr>
 
</table>
</form>

<?php
if ($_GET[loadurl]){

   if ($_POST[from] == ""){
      echo 'Enter a url.';
    
   } else{
        $from = $_POST[from];
       
        if($_POST[to] == "") {
           $to = basename("$from");
         
        } else $to = $_POST[to];
       
        if (!copy("$_POST[from]","$folder/$to")){
           echo 'File upload failed.';
         
        }

    }

}

?>


It looks like this:



Copy the link to the image in the first field (example: http://path_to_image.com/img.jpg). In the second (optional) field you can enter a different filename instead of the original (ex: my_image.jpg).
Thu Nov 26, 2009 9:16 pm View user's profile Send private message Send e-mail
typeman



Joined: 17 Oct 2009
Posts: 92

Post Reply with quote
Chaser wrote:
I think this is what you need.

Etc, etc.



Very Happy!!!!!

Perfect! Just what i was after. I'll try it in a minute and let you know Smile Thanks a lot
Thu Nov 26, 2009 9:49 pm View user's profile Send private message
typeman



Joined: 17 Oct 2009
Posts: 92

Post Reply with quote
Damn, got some errors... Sad

Quote:
Warning: copy() [function.copy]: URL file-access is disabled in the server configuration in /home/baxyzco1/public_html/cat3/cutenews/inc/mod/images.mdu on line 519

Warning: copy(http://www.my360.com.au/img/game/Forza-Motorsport-3-1.jpg) [function.copy]: failed to open stream: no suitable wrapper could be found in /home/baxyzco1/public_html/cat3/cutenews/inc/mod/images.mdu on line 519
File upload failed.


This came up when I tried to upload the image.

However, this error was already there after uploading and editing your code:


Quote:
Warning: getimagesize() [function.getimagesize]: URL file-access is disabled in the server configuration in /home/baxyzco1/public_html/cat3/cutenews/inc/mod/images.mdu on line 637

Warning: getimagesize(http://www.baxy-z.com/cat3/cutenews/data/upimages/admin/post-6103-1259082369.jpg) [function.getimagesize]: failed to open stream: no suitable wrapper could be found in /home/baxyzco1/public_html/cat3/cutenews/inc/mod/images.mdu on line 637

Warning: getimagesize() [function.getimagesize]: URL file-access is disabled in the server configuration in /home/baxyzco1/public_html/cat3/cutenews/inc/mod/images.mdu on line 638

Warning: getimagesize(http://www.baxy-z.com/cat3/cutenews/data/upimages/admin/post-6103-1259082369.jpg) [function.getimagesize]: failed to open stream: no suitable wrapper could be found in /home/baxyzco1/public_html/cat3/cutenews/inc/mod/images.mdu on line 638


Sorry Razz

Thanks for the help Smile
Thu Nov 26, 2009 10:31 pm View user's profile Send private message
Chaser



Joined: 17 Feb 2009
Posts: 65

Post Reply with quote
It seems your hoster has disabled url access in the php settings. Sad
http://de.php.net/manual/en/filesystem.configuration.php#ini.allow-url-fopen

I will sleep on it.
Fri Nov 27, 2009 2:17 am View user's profile Send private message Send e-mail
typeman



Joined: 17 Oct 2009
Posts: 92

Post Reply with quote
Chaser wrote:
It seems your hoster has disabled url access in the php settings. Sad
http://de.php.net/manual/en/filesystem.configuration.php#ini.allow-url-fopen

I will sleep on it.


Damn. Sad

Thanks a lot Smile Really appreciated Very Happy
Fri Nov 27, 2009 2:45 am View user's profile Send private message
mark99



Joined: 09 Feb 2009
Posts: 127

Post Reply with quote
Simple, assuming your host allows this, make your own php.ini file and just add this line:

allow_url_fopen = 1

Then upload that to the root dir of your cutenewsru directory. This will make it work again, even under PHP5. Personally though most modern scripts use Curl because fopen has a few security problems.
Fri Nov 27, 2009 11:34 am View user's profile Send private message
typeman



Joined: 17 Oct 2009
Posts: 92

Post Reply with quote
mark99 wrote:
Simple, assuming your host allows this, make your own php.ini file and just add this line:

allow_url_fopen = 1

Then upload that to the root dir of your cutenewsru directory. This will make it work again, even under PHP5. Personally though most modern scripts use Curl because fopen has a few security problems.


Brilliant! Smile Thank you both for your help! Works like a charm Smile
Fri Nov 27, 2009 10:58 pm View user's profile Send private message
eberswine



Joined: 26 Apr 2007
Posts: 268

Post Reply with quote
Great hack. Wonder if there is a way to choose which folder it goes into? (from Remote upload???) default is main...
Wed Feb 03, 2010 4:32 pm View user's profile Send private message Visit poster's website
samiro



Joined: 20 Apr 2008
Posts: 93
Location: IL

Post Reply with quote
Chaser wrote:
I think this is what you need.

Add the following to images.mdu, below the existing <form>.
Code:
<b>Remote upload</b>
<form enctype="multipart/form-data" action="<?php echo $PHP_SELF; ?>&loadurl=true" method="post">
<table border="0" cellspacing="1" cellpadding="5"  width="300" class="panel">
  <tr>
    <td>
      <b>URL:</b>
    </td>
   
    <td>
      <input type="text" name="from" size="40">
   </td>
  </tr>
 
  <tr>
    <td>
      <b>Filename:</b>
     <br />(optional)
   </td>
   
    <td>
      <input type="text" name="to" size="40">
   </td>
  </tr>
 
  <tr>
    <td colspan="2">
      <input type="submit" value="Submit">
   </td>
  </tr>
 
</table>
</form>

<?php
if ($_GET[loadurl]){

   if ($_POST[from] == ""){
      echo 'Enter a url.';
    
   } else{
        $from = $_POST[from];
       
        if($_POST[to] == "") {
           $to = basename("$from");
         
        } else $to = $_POST[to];
       
        if (!copy("$_POST[from]","$folder/$to")){
           echo 'File upload failed.';
         
        }

    }

}

?>


It looks like this:



Copy the link to the image in the first field (example: http://path_to_image.com/img.jpg). In the second (optional) field you can enter a different filename instead of the original (ex: my_image.jpg).


where to add this code? there is alot fo "forms" !!?!
thank you...

_________________
www.Bwoman.co.il
Thu Feb 18, 2010 9:55 pm View user's profile Send private message Visit poster's website
Wesam



Joined: 29 Sep 2007
Posts: 16
Location: PALESTINE

Post Reply with quote
Great Fix

Help Needed to improve this Fix

Can any one help me to have thums after uploaded image from URL

This fix was great and I test it and every thing goes fine, but one problem is their

After you upload the image, their is no thumb for the image, only normal image

Please kindly fix it to make thumb

Thank you

_________________
LONG LIVE PALESTINE
Sat Mar 06, 2010 3:49 pm View user's profile Send private message Visit poster's website AIM Address Yahoo Messenger MSN Messenger ICQ Number
samiro



Joined: 20 Apr 2008
Posts: 93
Location: IL

Post Reply with quote
pleaseee

were to Add to images.mdu, below the <form>.
wich form ?
witch line !?

_________________
www.Bwoman.co.il
Sat Mar 06, 2010 3:58 pm View user's profile Send private message Visit poster's website
Display posts from previous:    
Reply to topic    Forum Index » Suggestions All times are GMT + 1 Hour
Goto page 1, 2  Next
Page 1 of 2

 
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
You cannot attach files in this forum
You can download files in this forum



Powered by phpBB © 2001, 2005 phpBB Group
Design by Freestyle XL / Music Lyrics.