Forum Moderators: coopster

Message Too Old, No Replies

Link to off site image script?

         

Capezio

10:06 pm on Oct 17, 2005 (gmt 0)

10+ Year Member



I want to insert into php page some lines,that i could in that page not upload image to my site but link it anywhere from the web and to put in some place in my site.Can you help me?
I hope you understood my question,if not i will try to explain if you ask:)

jatar_k

4:13 pm on Oct 18, 2005 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



Welcome to WebmasterWorld Capezio,

do you mean you want to go get an image from some location on the web and save it to your site?

or did you just want to show an image from somewhere else on your site?

Capezio

5:11 pm on Oct 18, 2005 (gmt 0)

10+ Year Member



I mean that i want to show image from elsewhere in my site and then in what page i want that it would be shown i put some lines of script or etc and it will be visible:)
Is that very hard to do?:)

jatar_k

5:24 pm on Oct 18, 2005 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



you could set the fully qualified url to a variable and then echo that variable within the a tag

keep in mind that poeple don't like people hotlinking their images as it uses up their bandwidth. It is also an issue grabbing images from other sites/servers and saving them to your own. I know you weren't thinking of this but just to clarify that I am not recommending that option.

Capezio

8:24 pm on Oct 18, 2005 (gmt 0)

10+ Year Member



I will link images from my own server,just the script i now got creates many dublicates if i want the same image added elsewhere just it renames the image and makes copies.And i didn't write that because i wanted that my question would be clearer:)

By the way could you write those couple of lines,because i think that i didn't write them correctly...

whoisgregg

11:03 pm on Oct 18, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Capezio, could you please post the couple lines that you wrote? Then we can work off those to provide corrected code. :)

Capezio

12:27 am on Oct 19, 2005 (gmt 0)

10+ Year Member


i am quite new at php,but i did this code, and i think it is somewhere incorrect if not all incorrect...
$user_avatar_remoteurl = (!empty($HTTP_POST_VARS['avatarremoteurl']) )? trim( $HTTP_POST_VARS['avatarremoteurl'] ) : '';
$user_avatar_url = (!empty($HTTP_POST_VARS['avatarurl']) )? trim( $HTTP_POST_VARS['avatarurl'] ) : '';
$user_avatar_loc = ( $HTTP_POST_FILES['avatar']['tmp_name']!= "none")? $HTTP_POST_FILES['avatar']['tmp_name'] : '';
$user_avatar_name = (!empty($HTTP_POST_FILES['avatar']['name']) )? $HTTP_POST_FILES['avatar']['name'] : '';
$user_avatar_size = (!empty($HTTP_POST_FILES['avatar']['size']) )? $HTTP_POST_FILES['avatar']['size'] : 0;
$user_avatar_filetype = (!empty($HTTP_POST_FILES['avatar']['type']) )? $HTTP_POST_FILES['avatar']['type'] : '';

Sorry if that will look stupid to you,but as am mentioned i am a newbie at this....It is a little big and am tottaly mixed up,maybe you can write the correct code?

jatar_k

12:43 am on Oct 19, 2005 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



we don't spend time telling people code is tupid or anything else like that so quit worrying so much ;)

now I see, avatars for forums, I am guessing

one comment on oyur code $HTTP_POST_VARS is deprecated since 4.1.0 if your version is greater than 4.1.0 then you should use $_POST. The same goes for $HTTP_POST_VARS use $_FILES instead.

so your code would look like this

$user_avatar_remoteurl = (!empty($_POST['avatarremoteurl']) )? trim( $_POST['avatarremoteurl'] ) : '';
$user_avatar_url = (!empty($_POST['avatarurl']) )? trim( $_POST['avatarurl'] ) : '';
$user_avatar_loc = ( $_FILES['avatar']['tmp_name']!= "none")? $_FILES['avatar']['tmp_name'] : '';
$user_avatar_name = (!empty($_FILES['avatar']['name']) )? $_FILES['avatar']['name'] : '';
$user_avatar_size = (!empty($_FILES['avatar']['size']) )? $_FILES['avatar']['size'] : 0;
$user_avatar_filetype = (!empty($_FILES['avatar']['type']) )? $_FILES['avatar']['type'] : '';

so are you just asking how to build the link to show the image? if so can you show me how you are using $user_avatar_url in the display then.