vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB3 Programming Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=15)
-   -   modifying script to store images to folder (https://vborg.vbsupport.ru/showthread.php?t=159161)

neverstop 10-17-2007 04:43 AM

I am also looking for help with this same problem, albeit with a different modification. This mod allows an image to be uploaded with a link for the vbadvanced links directory (link).

Here is the relevant code (I think):
PHP Code:

$max_height 500;
$max_width 200;
if (
is_uploaded_file($_FILES['linkimage']['tmp_name']))
 {
  
$imagetype trim(substr(strrchr(strtolower($_FILES['linkimage']['name']), '.'), 1));
  if (
$imagetype == "jpeg" OR $imagetype == "jpg" OR $imagetype == "png")
  {
   
// Get new sizes
   
list($width$height) = getimagesize($_FILES['linkimage']['tmp_name']);
   
$new_width $width;
   
$new_height $height;
   if (
$height $max_height) {
    
$new_width = ($max_height $height) * $width;
    
$new_height $max_height;
   }
   if (
$width $max_width) {
    
$new_height = ($max_width $width) * $height;
    
$new_width $max_width;
   }
   
$imagedata imagecreatetruecolor($new_width$new_height);
  }
  if (
$imagetype == 'jpeg' OR $imagetype == 'jpg')
  {
   
$source imagecreatefromjpeg($_FILES['linkimage']['tmp_name']);
   
imagecopyresampled($imagedata$source0000$new_width$new_height$width$height);
   
ob_start();
   
imagejpeg($imagedata);
   
$imagedata ob_get_contents();
   
ob_end_clean();
  }
  elseif (
$imagetype == 'gif')
  {
   
$imagedata file_get_contents($_FILES['linkimage']['tmp_name']);
  }
  elseif (
$imagetype == 'png')
  {
   
$source imagecreatefrompng($_FILES['linkimage']['tmp_name']);
   
imagecopyresampled($imagedata$source0000$new_width$new_height$width$height);
   
ob_start();
   
imagepng($imagedata);
   
$imagedata ob_get_contents();
   
ob_end_clean();
  }
  else
  {
   
$imagedata "";
   
$imagetype "";
  }
  if (!empty(
$imagedata) AND !empty($imagetype))
  {
   
$imagesql ", imagedata = '" addslashes($imagedata) . "', imagetype = '$imagetype'";
  }
 }
 else
 {
  
$imagedata "";
  
$imagetype "";
  
$imagesql "";
 } 

Cheers,
Ian

Dismounted 10-17-2007 06:43 AM

Quote:

Originally Posted by TeamDevotion (Post 1359534)
There is no longer support for the vbgarage script. Beginners have to learn somehow.

Yes, that is true, but you don't just jump into the deep end.

TeamDevotion 10-18-2007 04:42 AM

It looks like no one really wants to help but just tell me that I shouldn't, i guess i'll take a look at the vbimage host coding and some how tie it into vbgarage.

neverstop 10-19-2007 02:40 AM

Am not sure if this type of posting is allowed but if anyone wants to tackle this for a fee i am offering it here: https://vborg.vbsupport.ru/showthread.php?t=160423

Again sorry for the spam-ish post.


All times are GMT. The time now is 06:04 PM.

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.00993 seconds
  • Memory Usage 1,743KB
  • 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
  • (1)bbcode_php_printable
  • (1)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (1)pagenav_pagelink
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (4)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