vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vBulletin 3.5 Add-ons (https://vborg.vbsupport.ru/forumdisplay.php?f=113)
-   -   Attached Image Watermark (https://vborg.vbsupport.ru/showthread.php?t=112829)

hypnoticpimp 05-31-2006 04:33 PM

yes it here, check it

PHP Code:

// begin variables
// the path to the PNG file that you want to overlay with
// must be on the local machine, not an http:// URL
$WATERMARK_PNG_FILE '/home/wshh/public_html/watermark.png';
// how you want to position the watermark enter either center or bottom_left
$WATERMARK_POSITION 'bottom_left';
// user you want to see watermarking on - this is just for testing
// set to 0 to work for all users
$VB_USER_ID 0;
// end variables - you shouldn't need to edit below here
 

// if there's no filepath to work with there's nothing we can do
// we also need the watermark file to exist
// if $VB_USER_ID is specified (for testing) show it just them
if(! empty($attachpath) && file_exists($WATERMARK_PNG_FILE) && ( $VB_USER_ID == || $GLOBALS['vbulletin']->userinfo['userid'] == $VB_USER_ID )) {

 
// derive output name
 
$fo preg_replace('/\.attach$/''.marked'$attachpath);
 
// image doesn't exist or thumbnail is newer than the cached file - create a watermarked version
 
if( (! file_exists($fo) || filemtime($WATERMARK_PNG_FILE) > filemtime($fo) || true) && $fo != $attachpath ) {
  
// decide what image type it is
  
if( preg_match('/\.png$/i'$attachmentinfo['filename']) ) {
   
$im = @imagecreatefrompng($attachpath);
  } elseif( 
preg_match('/\.jpg$/i'$attachmentinfo['filename']) ) {
   
$im = @imagecreatefromjpeg($attachpath);
  
   
// create an empty truecolor container
   
$tempimage = @imagecreatetruecolor(@imagesx($im), @imagesy($im));
       
   
// copy the 8-bit gif into the truecolor image
   
@imagecopy($tempimage$im,
    
0000
    @
imagesx($im), @imagesy($im)
   );
       
   
// copy the source_id int
   
$im $tempimage;
  }
  
// open the watermark image
  
$wm = @imagecreatefrompng($WATERMARK_PNG_FILE);
  @
imagealphablending($wmfalse);
  @
imagesavealpha($wmtrue);
  
// catch opening problems
  
if($im && $wm) {
   if(
$WATERMARK_POSITION == 'center') {
    
$pos_x = (imagesx($im) / 2) - (imagesx($wm) / 2);
    
$pos_y = (imagesy($im) / 2) - (imagesy($wm) / 2);
   } else {
    
$pos_x imagesx($im) - imagesx($wm) - 10;
    
$pos_y imagesy($im) - imagesy($wm) - 10;
   }

   
// merge the files together
   
$copy_worked = @imagecopy($im,$wm,
         
$pos_x$pos_y,
    
00imagesx($wm), imagesy($wm)
   );
  }
  
// write out the new image
  
if($copy_worked) {
   
// decide what image type it is
   
if( preg_match('/\.png$/i'$attachmentinfo['filename']) ) {
    @
imagepng($im,$fo);
   } elseif( 
preg_match('/\.jpg$/i'$attachmentinfo['filename']) ) {
    @
imagejpeg($im,$fo);
   } elseif( 
preg_match('/\.gif$/i'$attachmentinfo['filename']) ) {
    @
imagegif($im,$fo);
   }
  }
 }
 
// check that the new file is there - if so open the file pointer to it
 
if( @filesize($fo) > && $fp2 fopen($fo,'rb') ) {
  
// re-send image size header
  
header('Content-Length: 'filesize($fo));
  @
fclose($fp);
  
$fp $fp2;
 }


so please tell me now why nothing happens?

Ntfu2 06-01-2006 11:02 PM

link to your site please

Do you have GD2+ installed on server?

chipdien 07-23-2006 01:28 PM

i use vbb 3.5.3. And nothing happens like hypnoticpimp

http://diendan.svvn-dresden.org/show...8304#post28304

Quote:

GD Support enabled
GD Version bundled (2.0.28 compatible)
FreeType Support enabled
FreeType Linkage with freetype
T1Lib Support enabled
GIF Read Support enabled
GIF Create Support enabled
JPG Support enabled
PNG Support enabled
WBMP Support enabled
XBM Support enabled

Ntfu2 07-23-2006 08:26 PM

Try uploading a fresh image,

make sure your attachments are in the filesystem and not the database.

if viewing old attachments press CTRL+F5 to maybe try to recache it

shadyninja 07-24-2006 02:53 AM

what does this need to be changed to....
to be able to move them to the file system

We attempted to write a test file to /path/to/your/attachment/directory, but we were unsuccessful. Please verify that the web server has write/delete permissions for this path.
?

Ntfu2 07-24-2006 03:43 AM

You'll need to chmod the directory to 0777 that you set in the adminCP, you can do it either FTP usually with a right click -> permissions or via SSH command

Code:

chmod -R 0777 /path/to/your/attachment/directory/

shadyninja 07-24-2006 03:47 AM

Quote:

Originally Posted by Ntfu2
You'll need to chmod the directory to 0777 that you set in the adminCP, you can do it either FTP usually with a right click -> permissions or via SSH command

Code:

chmod -R 0777 /path/to/your/attachment/directory/

Im kind of a noob when it comes to this stuff , want to explain this to me as if I were 5 years old.

Ntfu2 07-24-2006 03:56 AM

Quote:

Originally Posted by shadyninja
Im kind of a noob when it comes to this stuff , want to explain this to me as if I were 5 years old.

*I'll assume a 5 year old got far enough to import the plugin*

1. Login to your site using your FTP program (the way you uploaded your vbulletin files)
2. Create a new directory outside of the public_html (or www) folder called 'attachments'
3. Right click on that new folder you just created and look for a way to change its permissions, enter 0777 for its new permissions
4. Go to your site
5. Find the AdminCP link
6. Login using your administrator details.
7. On the left hand side look for ATtachments
8. Hit the Blue arrow to make a drop down, and reveals Attachment Storage Type
9. either move them from the Database into the filesystem, Hit the go button
10. set the folder to your attachment folder you created in step 2, should look something like /home/site/attachments

That should move your attachments from database into the file system

shadyninja 07-24-2006 10:06 AM

ok thanks
I now feel 6 years old!

shadyninja 07-24-2006 03:24 PM

hmmm
"Right click on that new folder you just created and look for a way to change its permissions, enter 0777 for its new permissions"
I thought I knew what you were talking about, but when I got to the folder, there wasnt a way to change permissions


All times are GMT. The time now is 10:03 AM.

Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.01531 seconds
  • Memory Usage 1,780KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (2)bbcode_code_printable
  • (1)bbcode_php_printable
  • (3)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (4)pagenav_pagelink
  • (2)pagenav_pagelinkrel
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (10)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • printthread_start
  • pagenav_page
  • pagenav_complete
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete