View Full Version : Upload image with link
Lionel
11-24-2007, 07:14 AM
you need to have GD installed on your server
I would say that GD is installed because image verification in Control Panel > VB options is set to GD and it works ok when registering.
Lionel, I followed your instructions on putting an image in browselinks, newest links and random links but if a link is added without an image I get a box with a red cross in it. How do I get rid of the box and cross?
Also GD is working and the image width is reduced but the height limit seems to have no effect.
Lionel
12-03-2007, 01:38 AM
to avoid the red cross you need to put a conditional
<if condition="$link[imagedata]!=''">
<img src="showlink.php?do=getimage&linkid=$link[linkid]">
</if>
make sure that you set image size in php
when resizing an image, it looks for either height or width whichever is smaller and only resizes according to one criteria, not both
to avoid the red cross you need to put a conditional
<if condition="$link[imagedata]!=''">
<img src="showlink.php?do=getimage&linkid=$link[linkid]">
</if>
I hate to bother you again Lionel but I tried every which way to get it to work but there is no picture displayed at all with that code.
Lionel
12-03-2007, 08:26 PM
My instructions were for showlinks. If you want to put it somewhere else, you need to put the proper conditional. On top of my head I thought they all use $link[imagedata], but you are telling me they are not... so look for it in template.
I had a look but I'm getting no where because I dont know what I'm doing.
I'll just have to put up with them not showing in last 5 links and random links.
Thanks for your help anyway its a great hack.
mel
airliner
12-05-2007, 06:21 AM
Hi,
Is there a way of having random images taken from different categories?
Thanx.
dcuellar
04-17-2008, 11:46 AM
lionel,
Can you add some screenshots possibly? And an example of where in the ADV_LINKS_SHOWLINK template you placed the code in your first post? Would be nice if you could upload the php file with the changes for those of us who are noobs.
I'm seeing the place to upload an image, but I do not see the image anywhere.
Thanks.
dcuellar
05-07-2008, 01:08 AM
Disregard my last post. I managed to figure out where to put the image.
I also made the changes to the php files, which were a bit more difficult because the data we were supposed to look for has changed slightly. Just thought I should let you know.
dcuellar
05-07-2008, 09:13 PM
to delete existing image
in template ADV_LINKS_ADD_EDIT
put this where you have the upload input right before
</div>
</fieldset>
<if condition="$show['editlink']"><div>
<input type="checkbox" name="deleteimage" value="1"> Check this box to delete current image.
</div>
</if>
in addlinks.php
in the routine: // ##### Do Edit Link
put
$deleteimage=$vbulletin->input->clean_gpc('p', 'deleteimage', TYPE_UINT);
below (it's at the beginning of routine)
$newlink = $vbulletin->input->clean_gpc('p', 'link', TYPE_ARRAY);
still in the same routine, locate
and add below it
else if(isset($deleteimage))
{
$imagedata = "";
$imagetype = "";
$imagesql = ", imagedata = '', imagetype = ''";
}
now, you can delete existing image
By doing this edit will the picture used previously automatically be deleted when another picture is uploaded?
Or will the user have to delete first and then upload a new picture?
Wouldn't it be better to have the "delete checkbox" appear only if there is an image present, while the "upload box" is not? Once deleted, or if there is no image, only the "upload" box would be present.
Another way of doing it would be to automatically check the "delete box" if the upload box is used. Causing the previous picture to automatically be removed.
Perhaps I am just not understanding? By default, do images get deleted if a new one is uploaded? (without this hack) In other words, is this hack only for those who wish to not have an image?
Please explain.
Mr Peabody
06-13-2008, 06:03 AM
Be nice if this was standard
drynax
07-04-2008, 06:10 PM
Be nice if this was standard
----------------------
With vba Links Directory 3 beta 2, did this become standard? and if not, is this mod still good?
Does anyone have the image showing in the ADV_LINKS_SHOWLINK template? Got the hack installed but cant figure out where would be the best place to place the code into the template. Would like to if possible see some samples of where you have placed it and what it looks like.
Thanks!
<if condition="!empty($link[imagedata])">
<img style="padding: 0px" src="showlink.php?$session[sessionurl]do=getimage&linkid=$link[linkid]" />
</if>
Cancelled - decided to stick with the latest beta.
Chani
10-10-2008, 07:38 PM
Lionel,
Would you be willing to make an update to this tutorial to upload an image with links for v3?
This is one of the last pieces to the puzzle for my new site.
Thank you. :)
Chani
10-12-2008, 08:34 AM
Whoo Hoo!!! I figured it out! :D
Well, mostly. It's a little buggy, but I got this working with Links v3!
I'll try to cobble what I did together and post what I did.
Chani
Chani
01-17-2009, 12:52 AM
Sorry I never posted what my solution was. I need to figure it out again as when I upgraded to 3.1, it broke. :(
vBulletin® v3.8.4, Copyright ©2000-2012, Jelsoft Enterprises Ltd.