use GD::Image; open(PREVIOUSPRODUCTS,"/aussie/2008/previousproducts/products.txt"); @previousproducts=; close(PREVIOUSPRODUCTS); open(TWENTYSIX,"/aussie/2008/previousproducts/26/products.txt"); @twentysix=; close(TWENTYSIX); system("dir /b items > items.txt"); system("dir /b content > content.txt"); open(CONTENT,"content.txt"); @content=; close(CONTENT); open(ITEMS,"items.txt"); @items=; close(ITEMS); open(PRODUCTS,"/aussie/2008/products.txt"); @products=; close(PRODUCTS); open(PRODUCTSA,">/aussie/2008/productsa.txt"); foreach $pr (@products) { chomp $pr; @arpr = split( /\t/, $pr ); $sku = $arpr[0]; $title = $arpr[1]; $description = $arpr[2]; $gst = $arpr[3]; $supplier = $arpr[4]; $price = $arpr[5]; $wholesale = $arpr[6]; $discount = $arpr[7]; $departments = $arpr[8]; $groups = $arpr[9]; $subgroups = $arpr[10]; $image = $arpr[11]; $size = $arpr[12]; $option_type = $arpr[13]; $gift_cert = $arpr[14]; $related = $arpr[15]; $featured = $arpr[16]; $url = $arpr[17]; $image_2 = $arpr[18]; $email_year = $arpr[19]; $inactive = $arpr[20]; $thumb = $arpr[21]; $shipping_rate = $arpr[22]; $comment = $arpr[23]; $quantity = $arpr[24]; $bullet_header = $arpr[25]; $bullet_one = $arpr[26]; $bullet_two = $arpr[27]; $bullet_three = $arpr[28]; $bullet_four = $arpr[29]; $bullet_five = $arpr[30]; $bullet_six = $arpr[31]; $bullet_seven = $arpr[32]; $bullet_eight = $arpr[33]; $bullet_nine = $arpr[34]; $bullet_ten = $arpr[35]; $bullet_eleven = $arpr[36]; $bullet_twelve = $arpr[37]; $bullet_thirteen = $arpr[38]; $bullet_fourteen = $arpr[39]; $bullet_fifteen = $arpr[40]; $bullet_sixteen = $arpr[41]; $weight = $arpr[42]; $model_number = $arpr[43]; $sale_price = $arpr[44]; ################################################### if ($subgroups eq "Thompsons") { foreach $tw (@twentysix) { chomp $tw; @arpt = split( /\t/, $tw ); $skut = $arpt[0]; $titlet = $arpt[1]; $descriptiont = $arpt[2]; $gstt = $arpt[3]; $suppliert = $arpt[4]; $pricet = $arpt[5]; $wholesalet = $arpt[6]; $discountt = $arpt[7]; $departmentst = $arpt[8]; $groupst = $arpt[9]; $subgroupst = $arpt[10]; $imaget = $arpt[11]; $sizet = $arpt[12]; $option_typet = $arpt[13]; $gift_certt = $arpt[14]; $relatedt = $arpt[15]; $featuredt = $arpt[16]; $urlt = $arpt[17]; $image_2t = $arpt[18]; $email_yeart = $arpt[19]; $inactivet = $arpt[20]; $thumbt = $arpt[21]; $shipping_ratet = $arpt[22]; $commentt = $arpt[23]; $quantityt = $arpt[24]; $bullet_headert = $arpt[25]; $bullet_onet = $arpt[26]; $bullet_twot = $arpt[27]; $bullet_threet = $arpt[28]; $bullet_fourt = $arpt[29]; $bullet_fivet = $arpt[30]; $bullet_sixt = $arpt[31]; $bullet_sevent = $arpt[32]; $bullet_eightt = $arpt[33]; $bullet_ninet = $arpt[34]; $bullet_tent = $arpt[35]; $bullet_elevent = $arpt[36]; $bullet_twelvet = $arpt[37]; $bullet_thirteent = $arpt[38]; $bullet_fourteent = $arpt[39]; $bullet_fifteent = $arpt[40]; $bullet_sixteent = $arpt[41]; $weightt = $arpt[42]; $model_numbert = $arpt[43]; $sale_pricet = $arpt[44]; if ($descriptiont eq $description) { $sku=$skut; $groups=$groupst; $departments=$departmentst; } } } ################################################### foreach $c (@content) { chomp $c; $sk=$c; $sk=~s/\.txt//; $text=""; $file="/aussie/2008/content/$c"; if ($sku eq $sk) { open(COM,"$file"); @com=; close(COM); foreach $l (@com) { chomp $l; $l =~ s/\n\r/\/g; $l =~ s/\n/\/g; $l =~ s/\r/\/g; $l =~ s/\n/\/g; $l =~ s/\t/ /g; $text=$text." ".$l; } $comment=$text; } } ######################### foreach $c (@items) { chomp $c; $sk=$c; $sk=~s/\..*$//; if ($sku eq $sk) { $imagefile=$c; if ( ( $imagefile =~ /jpg/ ) | ( $imagefile =~ /JPG/ ) | ( $imagefile =~ /jpgeg/ ) | ( $imagefile =~ /JPEG/ ) ) { # LARGE JPG $file="/aussie/2008/large/$c"; $target_file=$file; $image="/aussie/2008/items/$c"; #require "/perl/site/lib/GD.pm"; $imagewidth=100; my $jpeg_quality = 60; #Quality my $max_sizex = $imagewidth; #max picturewith my $max_sizey = 800; #max pictureheight my $source_file = $image; my $jpeg_quality = 60; #Quality GD::Image->trueColor(1); #improves quality my $bildle = newFromJpeg GD::Image( $source_file, 1 ) || die "could not open image."; #Bild ffnen... ( my $width, my $height ) = $bildle->getBounds(); #Mae herausfinden... $imageheight = $imagewidth * $height / $width; my $bild = newTrueColor GD::Image( $imagewidth, $imageheight ); $bild->copyResized( $bildle, 0, 0, 0, 0, $imagewidth, $imageheight, $width, $height ); $bild->interlaced('true'); open( DATEI, ">$target_file" ) || die "could not write image: $!"; binmode DATEI; print DATEI ( $bild->jpeg($jpeg_quality) ); close(DATEI); # SMALL JPG $file="/aussie/2008/small/$c"; $target_file=$file; $image="/aussie/2008/items/$c"; #require "/perl/site/lib/GD.pm"; $imagewidth=60; my $jpeg_quality = 60; #Quality my $max_sizex = $imagewidth; #max picturewith my $max_sizey = 800; #max pictureheight my $source_file = $image; my $jpeg_quality = 60; #Quality GD::Image->trueColor(1); #improves quality my $bildle = newFromJpeg GD::Image( $source_file, 1 ) || die "could not open image."; #Bild ffnen... ( my $width, my $height ) = $bildle->getBounds(); #Mae herausfinden... $imageheight = $imagewidth * $height / $width; my $bild = newTrueColor GD::Image( $imagewidth, $imageheight ); $bild->copyResized( $bildle, 0, 0, 0, 0, $imagewidth, $imageheight, $width, $height ); $bild->interlaced('true'); open( DATEI, ">$target_file" ) || die "could not write image: $!"; binmode DATEI; print DATEI ( $bild->jpeg($jpeg_quality) ); close(DATEI); $image=$c; $thumb=$c; } ####################### GIF if ( ( $imagefile =~ /\.gif/ ) | ( $imagefile =~ /\.GIF/ ) ) { # LARGE GIF $file="/aussie/2008/large/$c"; $target_file=$file; $image="/aussie/2008/items/$c"; #require "/perl/site/lib/GD.pm"; $imagewidth=100; my $source_file = $image; my $jpeg_quality = 60; #Quality GD::Image->trueColor(1); #improves quality open(SOURCE,"$source_file"); my $bildle = newFromGif GD::Image(\*SOURCE) || die "could not open image."; #Bild ffnen... ( my $width, my $height ) = $bildle->getBounds(); #Mae herausfinden... $imageheight = $imagewidth * $height / $width; my $bild = newTrueColor GD::Image( $imagewidth, $imageheight ); $bild->copyResized( $bildle, 0, 0, 0, 0, $imagewidth, $imageheight, $width, $height ); $bild->interlaced('true'); open( DATEI, ">$target_file" ) || die "could not write image: $!"; binmode DATEI; print DATEI ( $bild->png ); close(DATEI); # SMALL GIF $file="/aussie/2008/small/$c"; $target_file=$file; $image="/aussie/2008/items/$c"; #require "/perl/site/lib/GD.pm"; $imagewidth=60; my $jpeg_quality = 60; #Quality GD::Image->trueColor(1); #improves quality open(SOURCE,"$source_file"); my $bildle = newFromGif GD::Image(\*SOURCE) || die "could not open image."; #Bild ffnen... ( my $width, my $height ) = $bildle->getBounds(); #Mae herausfinden... $imageheight = $imagewidth * $height / $width; my $bild = newTrueColor GD::Image( $imagewidth, $imageheight ); $bild->copyResized( $bildle, 0, 0, 0, 0, $imagewidth, $imageheight, $width, $height ); $bild->interlaced('true'); open( DATEI, ">$target_file" ) || die "could not write image: $!"; binmode DATEI; print DATEI ( $bild->png ); close(DATEI); $image=$c; $thumb=$c; } # PNG ################################################# if ( ( $imagefile =~ /png/ ) | ( $imagefile =~ /PNG/ ) ) { # LARGE PNG $file="/aussie/2008/large/$c"; $target_file=$file; $image="/aussie/2008/items/$c"; my $source_file = $image; #require "/perl/site/lib/GD.pm"; $imagewidth=100; my $source_file = $image; my $jpeg_quality = 60; #Quality GD::Image->trueColor(1); #improves quality my $bildle = GD::Image->newFromPng($source_file); ( my $width, my $height ) = $bildle->getBounds(); #Mae herausfinden... $imageheight = $imagewidth * $height / $width; my $bild = newTrueColor GD::Image( $imagewidth, $imageheight ); $bild->copyResized( $bildle, 0, 0, 0, 0, $imagewidth, $imageheight, $width, $height ); $bild->interlaced('true'); open( DATEI, ">$target_file" ) || die "could not write image: $!"; binmode DATEI; print DATEI ( $bild->png ); close(DATEI); # SMALL PNG $file="/aussie/2008/small/$c"; $target_file=$file; $image="/aussie/2008/items/$c"; #require "/perl/site/lib/GD.pm"; $imagewidth=60; my $jpeg_quality = 60; #Quality GD::Image->trueColor(1); #improves quality my $bildle = GD::Image->newFromPng($source_file); ( my $width, my $height ) = $bildle->getBounds(); #Mae herausfinden... $imageheight = $imagewidth * $height / $width; my $bild = newTrueColor GD::Image( $imagewidth, $imageheight ); $bild->copyResized( $bildle, 0, 0, 0, 0, $imagewidth, $imageheight, $width, $height ); $bild->interlaced('true'); open( DATEI, ">$target_file" ) || die "could not write image: $!"; binmode DATEI; print DATEI ( $bild->png ); close(DATEI); $image=$c; $thumb=$c; } ################################################# } } ######################### if ($image eq "") { $image="image coming soon.jpg"; } if ($thumb eq "") { $thumb="image coming soon.jpg"; } #<---------------------------- if ( ($bullet_header eq "PH") | ($bullet_header eq "PE") | ($bullet_header eq "LI") | ($bullet_header eq "MO") ) { if ($gst eq 1) { #$discount=0.815; } else { #$discount=0.80; } } #<---------------------- if ( ($subgroups eq "Body Concepts Nutritionals") ) { $discount=0.7347158; } if ( ($subgroups eq "Body Ripped") ) { $discount=0.65; } if ( ($subgroups eq "BSN") ) { $discount=0.896; } if ( ($subgroups eq "Morlife") ) { if ($gst eq 1) { $discount=0.82; } else { $discount=0.8; } } #<---------------------- if ( ($subgroups eq "Redbak") | ($subgroups eq "Ladybird") | ($subgroups eq "Black Widow") | ($subgroups eq "Carb Less") | ($subgroups eq "Natural Health Supplements") ) { if ($gst eq 1) { $discount=0.55; } else { $discount=0.55; } } #<------------------- ######################################## foreach $prev (@previousproducts) { chomp $prev; @arp = split( /\t/, $prev ); $skup = $arp[0]; $titlep = $arp[1]; $descriptionp = $arp[2]; $gstp = $arp[3]; $supplierp = $arp[4]; $pricep = $arp[5]; $wholesalep = $arp[6]; $discountp = $arp[7]; $departmentsp = $arp[8]; $groupsp = $arp[9]; $subgroupsp = $arp[10]; $imagep = $arp[11]; $sizep = $arp[12]; $option_typep = $arp[13]; $gift_certp = $arp[14]; $relatedp = $arp[15]; $featuredp = $arp[16]; $urlp = $arp[17]; $image_2p = $arp[18]; $email_yearp = $arp[19]; $inactivep = $arp[20]; $thumbp = $arp[21]; $shipping_ratep = $arp[22]; $commentp = $arp[23]; $quantityp = $arp[24]; $bullet_headerp = $arp[25]; $bullet_onep = $arp[26]; $bullet_twop = $arp[27]; $bullet_threep = $arp[28]; $bullet_fourp = $arp[29]; $bullet_fivep = $arp[30]; $bullet_sixp = $arp[31]; $bullet_sevenp = $arp[32]; $bullet_eightp = $arp[33]; $bullet_ninep = $arp[34]; $bullet_tenp = $arp[35]; $bullet_elevenp = $arp[36]; $bullet_twelvep = $arp[37]; $bullet_thirteenp = $arp[38]; $bullet_fourteenp = $arp[39]; $bullet_fifteenp = $arp[40]; $bullet_sixteenp = $arp[41]; $weightp = $arp[42]; $model_numberp = $arp[43]; $sale_pricep = $arp[44]; if (($sku eq $skup) && ($sku ne "sku") && ($sku ne "")) { $departments=$departmentsp; $groups=$groupsp; $subgroups=$subgroupsp; } } if (($description=~/Cospak/) | ($description=~/cospak/) | ($sku=~/cospak/)) { $subgroups="Cospak"; $groups="Herb Capsules"; $departments="Herb Capsules"; } if ($sku eq "natracare-organic-cotton-baby-wipes") { $weight=0.4; } if ($sku eq "natracare-organic-cotton-intimate-wipe") { $weight=0.2; } if ($groups eq "Oils") { $groups="Natural Oils"; } if ($departments eq "Natural Spreads") { $departments="Healthy Spreads"; } if ($groups eq "Natural Spreads") { $groups="Healthy Spreads"; } if ($groups eq "Healthy Foods") { $groups="Whole Foods"; } if ($departments eq "Healthy Foods") { #$departments="Whole Foods"; } if ($groups eq "Hair Dye") { $groups="Natural Hair Care"; } if ($groups eq "Vitamins Minerals Supplements") { $groups="Vitamins and Minerals"; } if ($departments eq "Vitamins Minerals Supplements") { $departments="Vitamins and Minerals"; } if ($departments eq "Tealight Candles") { $departments="Aromatherapy Oil Blends"; $groups="Aromatherapy Oil Blends"; } if ($groups eq "Tealight Candles") { $departments="Aromatherapy Oil Blends"; $groups="Aromatherapy Oil Blends"; } if ($subgroups eq "Gemcraft") { $departments="Health Educations"; $groups="Health Education"; $subgroups="Books"; } if ($groups eq "Bars Snacks") { $departments="Whole Foods"; $groups="Whole Foods"; } if ($groups eq "Biosnacky") { $departments="Whole Foods"; $groups="Whole Foods"; } if ($groups eq "Flour Grain Seed") { $departments="Whole Foods"; $groups="Whole Foods"; } if ($groups eq "Amaranth") { $departments="Whole Foods"; $groups="Whole Foods"; } if (($groups eq "Body Skin Hair Care") | ($groups eq "Organic Body Skin Hair Care")) { $departments="Creams"; $groups="Creams"; } if ($groups eq "Organic Food Beverage") { $departments="Drinks"; $groups="Drinks"; } if ($groups eq "Beans") { $departments="Whole Foods"; $groups="Whole Foods"; } if ($groups eq "Dried Fruit Nuts") { $departments="Whole Foods"; $groups="Whole Foods"; } if ($groups eq "Mixes") { $departments="Whole Foods"; $groups="Whole Foods"; } if ($groups eq "Carob") { $departments="Whole Foods"; $groups="Whole Foods"; } if ($groups eq "Additional Products") { $departments="Whole Foods"; $groups="Whole Foods"; } if ($groups eq "Japanese") { $departments="Macrobiotic"; $groups="Macrobiotic"; } if ($groups eq "Toothpaste") { $departments="Oral Care"; $groups="Oral Care"; } if ($groups eq "Chai Tea") { $departments="Herbal Tea"; $groups="Herbal Tea"; } if ($groups eq "Laundry") { $departments="Washing"; $groups="Washing"; } if ($groups eq "Books") { $departments="Health Education"; $groups="Health Education"; $subgroups="Books"; } if ($groups eq "Mens Skin Care") { $departments="For Men"; $groups="For Men"; } if ($groups eq "Wheat Gluten Free") { $departments="Whole Foods"; $groups="Whole Foods"; } if ($groups eq "Organic Vitamins Minerals Supplements") { $departments="Vitamins and Minerals"; $groups="Vitamins and Minerals"; } if ($groups eq "Seasoning") { $departments="Dressings and Sauces"; $groups="Dressing and Sauces"; } if ($groups eq "Kitchen") { $departments="Washing"; $groups="Washing"; } if ($groups eq "Dental Floss") { $departments="Oral Care"; $groups="Oral Care"; } if ($groups eq "Deodorant") { $departments="Spa & Deodorant"; $groups="Spa & Deodorant"; } if ($groups eq "Spirulina") { $departments="Vegetable Supplements"; $groups="Vegetable Supplements"; } if ($groups eq "Plex Range") { $departments="Brain and Insomnia"; $groups="Brain and Insomnia"; } if ($groups eq "Juices") { $departments="Drinks"; $groups="Drinks"; } if ($groups eq "Soy") { $departments="Drinks"; $groups="Drinks"; } if ($groups eq "Pure Floral Waters") { $departments="Aromatherapy Oil Blends"; $groups="Aromatherapy Oil Blends"; } if ($groups eq "Shampoo Conditioner") { $departments="Soaps and Shampoos"; $groups="Soaps and Shampoos"; } if ($groups eq "Beauty") { $departments="Beautiful Skin"; $groups="Beautiful Skin"; } if ($groups eq "Arnica") { $departments="Pain Relief"; $groups="Pain Relief"; } if ($groups eq "Pain relief") { $departments="Pain Relief"; $groups="Pain Relief"; } if ($groups eq "Vapourisers") { $departments="Aromatherapy Oil Blends"; $groups="Aromatherapy Oil Blends"; } ######################################## print PRODUCTSA "$sku $title $description $gst $supplier $price $wholesale $discount $departments $groups $subgroups $image $size $option_type $gift_cert $related $featured $url $image_2 $email_year $inactive $thumb $shipping_rate $comment $quantity $bullet_header $bullet_one $bullet_two $bullet_three $bullet_four $bullet_five $bullet_six $bullet_seven $bullet_eight $bullet_nine $bullet_ten $bullet_eleven $bullet_twelve $bullet_thirteen $bullet_fourteen $bullet_fifteen $bullet_sixteen $weight $model_number $sale_price\n"; $flag=""; #comment= "" ########## } $username = "aussievitamin"; $password = "hlsupi"; use Net::FTP; $servername = "www.aussievitamin.com"; open( FTPDATA, ">ftpdata.txt" ); print FTPDATA "open $servername\n"; print FTPDATA "$username\n"; print FTPDATA "$password\n"; print FTPDATA "quote PWD\n"; print FTPDATA "quote PASV\n"; print FTPDATA "bin\n"; print FTPDATA "prompt\n"; print FTPDATA "CWD /var/www/html/aussievitamin/images/items\n"; #print FTPDATA "cd /var/www/html/aussievitamin/images/items\n"; print FTPDATA "lcd large\n"; print FTPDATA "mput *\n"; #print FTPDATA "cd /var/www/html/aussievitamin/images/thumb\n"; print FTPDATA "CWD /var/www/html/aussievitamin/images/thumb\n"; print FTPDATA "lcd ..\n"; print FTPDATA "lcd small\n"; print FTPDATA "quote PASV\n"; print FTPDATA "mput *\n"; print FTPDATA "bye\n"; close(FTPDATA); # DISABLED NEED TO UPLOAD IMAGES AND THUMBS #system("ftp -s:ftpdata.txt"); system("copy /b productsa.txt products.txt");