This topic is locked

Images - Thumbnails

4/3/2007 2:52:24 PM
PHPRunner General questions
W
wilmer author

Hi,
Is it possible to save pictures and thumbnails in different maps? Pictures in picturemap and thumbnails in thumbmap?

Sergey Kornilov admin 4/3/2007

What are maps?

W
wilmer author 4/6/2007

What are maps?


Sorry, maybe folder is the right word.

J
Jane 4/6/2007

Hi,
you can do the following:

  • open generated include/commonfunction.php file and add following functions:

    function AddLinkPrefix2($field,$link,$table="")

    {

    if(strpos($link,"://")===false && substr($link,0,7)!="mailto:")

    return GetLinkPrefix2($field,$table).$link;

    return $link;

    }

    function GetLinkPrefix2($field,$table="")

    {

    return GetFieldData($table,$field,"LinkPrefix2","");

    }

    function GetUploadFolder2($field, $table="")

    {

    $path = GetFieldData($table,$field,"UploadFolder2","");

    if(strlen($path) && substr($path,strlen($path)-1) != "/")

    $path.="/";

    return $path;

    }


  • open include/..._settings.php file, find this line:

    $fdata["LinkPrefix"]="files/";





and replace it with this one:

$fdata["LinkPrefix"]="files/";

$fdata["LinkPrefix2"]="thumbs/";

$fdata["UploadFolder2"]="thumbs/";


  • open ..._edit.php and ..._add.php files, find this line:
    $file = GetUploadFolder("FieldName")."th".$value;

and replace it with this one:

$file = GetUploadFolder2("FieldName")."th".$value;


  • then open ..._list.php file, find this line:
    if(substr("files/",0,7)!="http://"'>http://"; && !file_exists(GetUploadFolder("FieldName").$thumbname))

and replace it with this one:

if(substr("files/",0,7)!="http://"'>http://"; && !file_exists(GetUploadFolder2("FieldName").$thumbname))



and this line:

$value.=" src=\"".htmlspecialchars(AddLinkPrefix("FieldName",$thumbname))."\"></a>"

replace with this one:

$value.=" src=\"".htmlspecialchars(AddLinkPrefix2("FieldName",$thumbname))."\"></a>"

W
wilmer author 4/7/2007

Thanks, thats superb. Is it possible to have this choice in a new version?

J
Jane 4/9/2007

Hi,
also you can easily create new directory for thumbnails in the directory where large pictures are stored and then use following expression as Thumbnail prefix on the "Edit as" settings dialog on the Visual Editor tab:

thumb/th_

W
wilmer author 4/9/2007

Hi,
Isn't it possible (through the easy way) to create a folder for thumbs outside the "big" images folder? You see I have made a rewriterule to put a watermark on the pictures in the "big" images folder. And this put watermark on every image in the folder. And I don't want watermark on the thumbs.

M
mmponline 4/10/2007

nochampion
Do you mind sharing how to put a watermark on the pictures? - Or some link to find a way.
Thanks

W
wilmer author 4/11/2007

nochampion

Do you mind sharing how to put a watermark on the pictures? - Or some link to find a way.
Thanks


Of course.
Just visit http://www.veqa.com/ to get some software, and put a rewriterule in .htaccess like:
RewriteEngine on

RewriteRule ^"picturefolder"/(.*).jpg$ ./"name of folder you put veqa in"/?image=$1.jpg&mark="name of watermark"

J
Jane 4/11/2007

Unfortunately there is no wasy way to create folder with thumbnails outside the folder with large images.

You can only edit generated files as I've suggested in the previous comments.

W
wilmer author 4/11/2007

Unfortunately there is no wasy way to create folder with thumbnails outside the folder with large images.

You can only edit generated files as I've suggested in the previous comments.


Thanks for your help Jane, and after a little investigation I think I find a very easy solution on the problem using .htaccess and rewriterule. Now I can have the thums folder into the "big pictures" folder with watermark only on the big ones.