Author Topic: The upload URL (Add image) in admin as default  (Read 7337 times)

0 Members and 1 Guest are viewing this topic.

Offline Sun Zaza

  • Sr. Member
  • ****
  • Posts: 399
    • View Profile
The upload URL (Add image) in admin as default
« on: November 26, 2008, 01:42:50 PM »
Hello,

How can I make the upload URL (http://www.site.com/pic.jpg) in the admin (Add image) as default?

Because for some reasons I upload always the same pic to my gallery (My gallery is only for Youtube video), I want to make the upload URL as default.

Please see the attachemt to understand what I mean.

Many thanks in advance,

Cruxy

Offline batu544

  • Sr. Member
  • ****
  • Posts: 336
    • View Profile
    • Free Celebrity wallpapers
Re: The upload URL (Add image) in admin as default
« Reply #1 on: November 26, 2008, 05:35:05 PM »
Hi,
    try this untested code..

open admin_functions.php  and find

Code: [Select]
echo "<b>URL:</b><br><input type=\"text\" name=\"remote_".$name."\" value=\"".$value."\" size=\"".$textinput_size."\">";in
 show_upload_row  function.

replace it with the following one..
Code: [Select]
echo "<b>URL:</b><br><input type=\"text\" name=\"remote_".$name."\" value=\"http://site.com/test.jpg\" size=\"".$textinput_size."\">";
change ur desired .. site name ..


Thanks,


Offline Sun Zaza

  • Sr. Member
  • ****
  • Posts: 399
    • View Profile
Re: The upload URL (Add image) in admin as default
« Reply #2 on: November 26, 2008, 06:53:43 PM »
Thanks batu544. It works perfect.

Offline Sun Zaza

  • Sr. Member
  • ****
  • Posts: 399
    • View Profile
Re: The upload URL (Add image) in admin as default
« Reply #3 on: November 27, 2008, 09:47:08 AM »
Hello,

I just discover a small problem:

The URL (http://www.site.com/pic.jpg) is shown in both upload Image and thumb. Actually I want it only for Image.

Any help is appreciated.

Thanks in advance,

Offline batu544

  • Sr. Member
  • ****
  • Posts: 336
    • View Profile
    • Free Celebrity wallpapers
Re: The upload URL (Add image) in admin as default
« Reply #4 on: November 27, 2008, 10:16:36 AM »
yup.. I knew that .. but I thought you may need in that way..

now do the changes...   :)

In images.php fiind

Code: [Select]
show_upload_row($lang['image'], "file_".$i, "<br /><span class=smalltext>".$lang['allowed_mediatypes_desc'].str_replace(",",", ",$config['allowed_mediatypes'])."</span>");
replace this with

Code: [Select]
show_upload_row1($lang['image'], "file_".$i, "<br /><span class=smalltext>".$lang['allowed_mediatypes_desc'].str_replace(",",", ",$config['allowed_mediatypes'])."</span>");
In admin_functions.php revert back the changes..
and find

Code: [Select]
function show_upload_row($title, $name, $extra = "", $value = "") {

insert above

Code: [Select]
function show_upload_row1($title, $name, $extra = "", $value = "") {
  global $error, $HTTP_POST_VARS, $textinput_size;
  if (isset($error[$name]) || isset($error['remote_'.$name])) {
    $title = sprintf("<span class=\"marktext\">%s *</span>", $title);
  }
  if (isset($HTTP_POST_VARS['remote_'.$name])/* && $value == ""*/) {
    $value = stripslashes($HTTP_POST_VARS['remote_'.$name]);
  }

  echo "<tr class=\"".get_row_bg()."\" valign='top'>\n<td><p class=\"rowtitle\">$title</p></td>\n";
  echo "<td><p>";
  echo "<b>Upload:</b><br><input type=\"file\" name=\"".$name."\"><br>";
  echo "<b>URL:</b><br><input type=\"text\" name=\"remote_".$name."\" value=\"http://site.com/test.jpg\" size=\"".$textinput_size."\">";
  echo $extra."</p></td>\n</tr>\n";
}


change site.come/test.jpg as per your site name..

hope this will help..

Offline V@no

  • If you don't tell me what to do, I won't tell you where you should go :)
  • Global Moderator
  • 4images Guru
  • *****
  • Posts: 17.849
  • mmm PHP...
    • View Profile
    • 4images MODs Demo
Re: The upload URL (Add image) in admin as default
« Reply #5 on: November 27, 2008, 10:29:03 AM »
@batu544:
you were on right track, but got little stuck in a thought that something must be changed in admin_functions.php ;)


all you need replace is the line in images.php:
show_upload_row($lang['image'], "file_".$i"<br /><span class=smalltext>".$lang['allowed_mediatypes_desc'].str_replace(",",", ",$config['allowed_mediatypes'])."</span>");

with this:
show_upload_row($lang['image'], "file_".$i"<br /><span class=smalltext>".$lang['allowed_mediatypes_desc'].str_replace(",",", ",$config['allowed_mediatypes'])."</span>""http://site.com/test.jpg");


It will affect only upload images form.

If you want have that custom URL when edit an image then replace
  $value = (is_remote($image_row['image_media_file']) || is_local_file($image_row['image_media_file'])) ? $image_row['image_media_file'] : "";


with this:
  $value = (is_remote($image_row['image_media_file']) || is_local_file($image_row['image_media_file'])) ? $image_row['image_media_file'] : "http://site.com/test.jpg";
Your first three "must do" before you ask a question:
Please do not PM me asking for help unless you've been specifically asked to do so. Such PMs will be deleted without answer. (forum rule #6)
Extension for Firefox/Thunderbird: Master Password+    Back/Forward History Tweaks (restartless)    Cookies Manager+    Fit Images (restartless for Thunderbird)

Offline batu544

  • Sr. Member
  • ****
  • Posts: 336
    • View Profile
    • Free Celebrity wallpapers
Re: The upload URL (Add image) in admin as default
« Reply #6 on: November 27, 2008, 10:37:21 AM »
Oh !!  :)  as you know I am a new php programmer..  :)  .

Thanks V@no..

Offline Sun Zaza

  • Sr. Member
  • ****
  • Posts: 399
    • View Profile
Re: The upload URL (Add image) in admin as default
« Reply #7 on: November 27, 2008, 10:27:06 PM »
Thanks V@no & batu544. I like your work.