With the Aid Of this Function, you can Crawl Out the First Occurence Image Url.

If a post Contain

Analike The Baddo Of Destiney
as the post image link,this Function wil crawl it out negleting the [img] and [/img] bbcode.

Xo it wil be nw become this http://netnaija.com/images/featured/analike-the-baddo-of-destiney.png
xo u can use it at ur exclusive update in ur web lyk NetNaija


Code
<?php
function first_img($text,$thumb) {
global $config;
$res = preg_match('#\[img\](.*?)\[\/img\]#is', $text, $matches);
if (!$thumb == '') $text = '<img src="'.$thumb.'" width="48" height="48">';
elseif(!$matches[1] == '') $text = '<img src="'.$matches[1].'" width="48" height="48">';
else $text = '<img src="'.$config->url.'/images/none.png" width="48" height="48">';
return $text;
}
?>

If deres no Image Found In the Post, it wil return default img, xo change the /images/none.png to ur default image link

Now,
fetch the post content and rap it wit the abv function to get the image link
i.e

Code
<?php
$post_content = $info["message"]; $change_tags=preg_replace('#<img(.*?)src="(.*?)"(.*?)>#is','[img]\\2[/img]',$post_content);
$img_first = first_img($change_tags,$post_content = NULL);
?>

And Insert $img_first into ur b_updates. For u to b able to do dis..kindly create a column in ur b_updates named `img`

Code
<?php
ERROR_REPORTING(0);
 
include("init.php");
$query=mysql_query("ALTER TABLE `b_updates` ADD `img` varchar(255) NOT NULL");
if(!$query){
header("location: index.php?msg=error");
} else {
header("location: index.php?msg=success");
}
?>

save as img.php and install...

Goto ur func.php,fetch along the img row and print or echo am as desired. Complicated? Drop Comment below.. Ama reply u

Download Now
  • Date: Dec 08, 2013


With the Aid Of this Function, you can Crawl Out the First Occurence Image Url.

If a post Contain

Analike The Baddo Of Destiney
as the post image link,this Function wil crawl it out negleting the [img] and [/img] bbcode.

Xo it wil be nw become this http://netnaija.com/images/featured/analike-the-baddo-of-destiney.png
xo u can use it at ur exclusive update in ur web lyk NetNaija


Code
<?php
function first_img($text,$thumb) {
global $config;
$res = preg_match('#\[img\](.*?)\[\/img\]#is', $text, $matches);
if (!$thumb == '') $text = '<img src="'.$thumb.'" width="48" height="48">';
elseif(!$matches[1] == '') $text = '<img src="'.$matches[1].'" width="48" height="48">';
else $text = '<img src="'.$config->url.'/images/none.png" width="48" height="48">';
return $text;
}
?>

If deres no Image Found In the Post, it wil return default img, xo change the /images/none.png to ur default image link

Now,
fetch the post content and rap it wit the abv function to get the image link
i.e

Code
<?php
$post_content = $info["message"]; $change_tags=preg_replace('#<img(.*?)src="(.*?)"(.*?)>#is','[img]\\2[/img]',$post_content);
$img_first = first_img($change_tags,$post_content = NULL);
?>

And Insert $img_first into ur b_updates. For u to b able to do dis..kindly create a column in ur b_updates named `img`

Code
<?php
ERROR_REPORTING(0);
 
include("init.php");
$query=mysql_query("ALTER TABLE `b_updates` ADD `img` varchar(255) NOT NULL");
if(!$query){
header("location: index.php?msg=error");
} else {
header("location: index.php?msg=success");
}
?>

save as img.php and install...

Goto ur func.php,fetch along the img row and print or echo am as desired. Complicated? Drop Comment below.. Ama reply u

Trustwordi1

nice one bt pls can you help me code my uloki script to be like that pls

  • Date: Jan 26, 2014

please where are we to add this code. try to explain stepwise. .....novice

  • Date: Feb 17, 2014

Pls i dnt understand. Where are we going to put the codes?

  • Date: Feb 17, 2014

i dont rilly knw about pbnl again... You can put in tag.php or topics.php


anyway, share me your either topics.php or tag.php in your forum folder to help you code it inside....

  • Date: Feb 20, 2014
  • Edited: Nov 03, 2014 by Guruslord


Share it here... AMA help you out exactly as netnaija own

Trustwordi1

pls help the stuff is still showinq the defalut image

1. Have install the table
2. Have create a function with that first image
3. Have put that 2nd code when my update is but when i echo it out its not showing the image inside of the topic

pls help

  • Date: Feb 20, 2014

I don't know how you integrate it.... Share your files here and let me see what I can do

  • Date: Feb 23, 2014

Please av u help d guy code all dose files he shared here...so dat i can also use dem

‹‹12››
Viewing Page 1 of 2 pages