PDA

View Full Version : how to do this


Easy5s.net
04-02-2015, 12:53 AM
When I post like:

http://domain.com/picture.jpg
description...

and when I want view source, it looks like this:

<a href="http://domain.com/picture.jpg">
<img src="http://domain.com/picture.jpg" />
</a>
<div class="des">description...</div>


How to auto add tag <div class="des"> for description... and <a href=" for img ?

ForceHSS
04-02-2015, 01:24 AM
vb is php based so the source will show it that way but as to your question you have not asked one

Easy5s.net
04-02-2015, 01:35 AM
vb is php based so the source will show it that way but as to your question you have not asked one

How to auto add tag <div class="des"> for description... and <a href=" for img ?

MarkFL
04-02-2015, 03:24 AM
I am thinking you will need to hack the file "/includes/class_bbcode.php" to include this extra HTML, if I am interpreting your question correctly.

Open that file, and locate the text:
// Display the attachment with no link to bigger image

Beneath this you will see the code:
$replace[] = ($fullsize ? '<div class="size_fullsize">' : '') .
"<img class=\"image\" src=\"{$this->registry->options['bburl']}/attachment.php?{$this->registry->session->vars['sessionurl']}attachmentid=\\1&amp;d=$attachment[dateline]$stc\" border=\"0\" alt=\""
. construct_phrase($vbphrase['image_x_y_z'], $attachment['filename'], $attachment['counter'], $attachment['filesize'])
. "\" " . ((!empty($align) AND $align != 'config') ? " style=\"float: $align\"" : '') . " />";


Now it's just a matter of adding the HTML markup you want.

Easy5s.net
04-02-2015, 05:42 AM
I am thinking you will need to hack the file "/includes/class_bbcode.php" to include this extra HTML, if I am interpreting your question correctly.

Open that file, and locate the text:
// Display the attachment with no link to bigger image

Beneath this you will see the code:
$replace[] = ($fullsize ? '<div class="size_fullsize">' : '') .
"<img class=\"image\" src=\"{$this->registry->options['bburl']}/attachment.php?{$this->registry->session->vars['sessionurl']}attachmentid=\\1&amp;d=$attachment[dateline]$stc\" border=\"0\" alt=\""
. construct_phrase($vbphrase['image_x_y_z'], $attachment['filename'], $attachment['counter'], $attachment['filesize'])
. "\" " . ((!empty($align) AND $align != 'config') ? " style=\"float: $align\"" : '') . " />";


Now it's just a matter of adding the HTML markup you want.

NO.

I just wanted to post my img, after finishing post I want the code to be like this:

<a href="http://domain.com/picture.jpg"><img src="http://domain.com/picture.jpg" /></a>
<div class="des">description...</div>

MarkFL
04-02-2015, 06:03 AM
And I was explaining one possible way to do just that. You could also do it client-side using javascript, but what I suggested would be easier I think.

blind-eddie
04-02-2015, 08:53 AM
When you create a new thread/post, you add a linked image to it right?
You are wanting to know how to show tags in the source code for said linked image?

Well, you can't that I am aware of unless what MarkFL posted works that way.

You can however allow html while posting and use what you showed in your first post to achieve what you are after but, that is a very risking to allow.

Easy5s.net
04-02-2015, 09:19 AM
When you create a new thread/post, you add a linked image to it right?
You are wanting to know how to show tags in the source code for said linked image?

Well, you can't that I am aware of unless what MarkFL posted works that way.

You can however allow html while posting and use what you showed in your first post to achieve what you are after but, that is a very risking to allow.

You are wanting to know how to show tags in the source code for said linked image?
YES

After I post have inserted pictures as usual -> OK, then I want when I view source (right click -> View Page Source). the html code will look something like this:

When post:
https://vborg.vbsupport.ru/external/2015/04/39.png

https://vborg.vbsupport.ru/external/2015/04/40.png

I want when I view source (right click -> View Page Source):

<a href="http://localhost/demov4/images/misc/vbulletin1_logo.png">
<img src="http://localhost/demov4/images/misc/vbulletin1_logo.png" />
</a>
<div class="des">image 01</div>

<a href="http://localhost/demov4/images/misc/vbulletin2_logo.png">
<img src="http://localhost/demov4/images/misc/vbulletin2_logo.png" />
</a>
<div class="des">image 02</div>

<a href="http://localhost/demov4/images/misc/vbulletin3_logo.png">
<img src="http://localhost/demov4/images/misc/vbulletin3_logo.png" />
</a>
<div class="des">image 03</div>

<a href="http://localhost/demov4/images/misc/vbulletin4_logo.png">
<img src="http://localhost/demov4/images/misc/vbulletin4_logo.png" />
</a>
<div class="des">image 04</div>

MarkFL
04-02-2015, 02:58 PM
The HTML that is generated associated with images posted using the IMG tags is done in the file /includes/class_bbcode.php. In this file is a function called "handle_bbcode_img()."

You would also need to alter the PHP code to allow for the innerHTML of your div element to be passed as an option with the IMG tags, for example:

http://localhost/demov4/images/misc/vbulletin4_logo.png

Another option would be to create a custom BBCode that will generate the HTML you desire.