Jump to content
php.lv forumi

preg_replace


ziedinjsh

Recommended Posts

Rāda tikai linku.. it kā jau vajadzēja rādīt bildi

<?php
$Mixed2 = "https://web.tradekorea.com/upload_file2/sell/39/S00006939/sexy_lingerie_sexy_teddy_make_magic_syle_.jpg";
$Mixed2 = preg_replace("#(http://[^ ]+\\.jpg(?= |$))#i","<img src=\"$1\" alt=\"$1\"/>", $Mixed2);
echo $Mixed2;
?>

šinī gadījumā bildi nerāda, jo bilde ir https nevis http. kā lai lasa abus un jpg, jpeg, png un gif formātu?

Edited by ziedinjsh
Link to comment
Share on other sites

bilde, jā.. nu man arī šitā iet

$Mixed2 = preg_replace('/((https?|ftp).*(gif|png|jpg|jpeg))/i', '<img src="$1" />', $Mixed2);

 

Vienīgā problēma ir tāda, ka tas neiet vanilla 2 forumā.. iekš faila library/core/class.format.php

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...