[MOD] Image Upload (v.1)

Register an Account
Reply
 
Thread Tools Display Modes
  #51 (permalink)  
Old 04-13-2007, 12:13 AM
Pligg Donor
 
Join Date: Apr 2007
Posts: 23
In step 3 of 3 in the submit process when I am trying to upload image I see following code

img["format"]=ereg_replace(".*\.(.*)$","\\1",$imgfile); $this->img["format"]=strtoupper($this->img["format"]); if ($this->img["format"]=="JPG" || $this->img["format"]=="JPEG") { //JPEG $this->img["format"]="JPEG"; $this->img["src"] = ImageCreateFromJPEG ($imgfile); } elseif ($this->img["format"]=="PNG") { //PNG $this->img["format"]="PNG"; $this->img["src"] = ImageCreateFromPNG ($imgfile); } else { //DEFAULT exit(); } @$this->img["lebar"] = imagesx($this->img["src"]); @$this->img["tinggi"] = imagesy($this->img["src"]); //default quality jpeg $this->img["quality"]=75; } function size_auto($size=100) { //size if ($this->img["lebar"]>=$this->img["tinggi"]) { $this->img["lebar_thumb"]=$size; @$this->img["tinggi_thumb"] = ($this->img["lebar_thumb"]/$this->img["lebar"])*$this->img["tinggi"]; } else { $this->img["tinggi_thumb"]=$size; @$this->img["lebar_thumb"] = ($this->img["tinggi_thumb"]/$this->img["tinggi"])*$this->img["lebar"]; } } function jpeg_quality($quality=75) { //jpeg quality $this->img["quality"]=$quality; } function show($gd_version) { @Header("Content-Type: image/".$this->img["format"]); if($gd_version==2) { $this->img["des"] = imagecreatetruecolor($this->img["lebar_thumb"],$this->img["tinggi_thumb"]); @imagecopyresampled ($this->img["des"], $this->img["src"], 0, 0, 0, 0, $this->img["lebar_thumb"],$this->img["tinggi_thumb"], $this->img["lebar"], $this->img["tinggi"]); } if($gd_version==1) { $this->img["des"] = imagecreate($this->img["lebar_thumb"], $this->img["tinggi_thumb"]); @imagecopyresized ($this->img["des"], $this->img["src"], 0, 0, 0, 0, $this->img["lebar_thumb"], $this->img["tinggi_thumb"], $this->img["lebar"], $this->img["tinggi"]); } if ($this->img["format"]=="JPG" || $this->img["format"]=="JPEG") { //JPEG imageJPEG($this->img["des"],"", $this->img["quality"]); } elseif ($this->img["format"]=="PNG") { //PNG imagePNG($this->img["des"]); } } function save($save="", $gd_version) { if($gd_version==2) { $this->img["des"] = imagecreatetruecolor($this->img["lebar_thumb"],$this->img["tinggi_thumb"]); @imagecopyresampled ($this->img["des"], $this->img["src"], 0, 0, 0, 0, $this->img["lebar_thumb"], $this->img["tinggi_thumb"], $this->img["lebar"], $this->img["tinggi"]); } if($gd_version==1) { $this->img["des"] = imagecreate($this->img["lebar_thumb"], $this->img["tinggi_thumb"]); @imagecopyresized ($this->img["des"], $this->img["src"], 0, 0, 0, 0, $this->img["lebar_thumb"], $this->img["tinggi_thumb"], $this->img["lebar"], $this->img["tinggi"]); } if ($this->img["format"]=="JPG" || $this->img["format"]=="JPEG") { //JPEG imageJPEG($this->img["des"],"$save", $this->img["quality"]); } elseif ($this->img["format"]=="PNG") { //PNG imagePNG($this->img["des"],"$save"); } } } ?>

from file www\modules\image_upload\plugins\class.thumbnail.i nc.php

Any clue what I have done wrong.

All I have done in submit_step_3.tpl is added

check_actions('image_upload_process'); between following line


$linkres->store();

tags_insert_string($linkres->id, $dblang, $linkres->tags);

Thanks,

-BestOfIndya
Reply With Quote
  #52 (permalink)  
Old 04-13-2007, 12:37 AM
Pligg Developer/Admin
Pligg Version: 0
Pligg Template: none
 
Join Date: Jun 2006
Location: Muncie, Indiana
Posts: 3,215
BestOfIndya,

open www\modules\image_upload\plugins\class.thumbnail.i nc.php and change <? to <?php

Cent, along with that error BestOfIndya mentioned, I still can't get this mod to work. It's showing a broken image on the story page but works fine when I click on it. Are you sure that the checks you made for my_pligg_base are actually working?

I tried to output my_pligg_base within the debug code and it didn't output anything.
Reply With Quote
  #53 (permalink)  
Old 04-13-2007, 01:16 AM
Pligg Donor
 
Join Date: Apr 2007
Posts: 23
kbeeveer46,

Thanks. Actually I had figured it out after I posted this on the forum. I saw your reply when I came back to update my post.

About your question what do you mean by broken image? Is is not in right aspect ratio? If that is the case there is flag in image_upload_settings.php file that you change

define('module_imageupload_thumb_square', false);

Hope this helps,

-BestOfIndya
Reply With Quote
  #54 (permalink)  
Old 04-13-2007, 01:17 AM
Pligg Developer/Admin
Pligg Version: 0
Pligg Template: none
 
Join Date: Jun 2006
Location: Muncie, Indiana
Posts: 3,215
What I mean by broken image is that the image does not show at all on the story page. The red "X" appears as if the image is broken.
Reply With Quote
  #55 (permalink)  
Old 04-13-2007, 10:40 PM
Constant Pligger
 
Join Date: Oct 2006
Posts: 220
Another big thank you. This mod is going to push Pligg in new directions.
Reply With Quote
  #56 (permalink)  
Old 04-13-2007, 11:03 PM
cent's Avatar
Constant Pligger
 
Join Date: Jan 2007
Location: New York, NY
Posts: 180
if you're getting a red X than the URL path to the image is not correct. If you're getting just a black square then the server path to the image isn't correct. What site do you have it on?

Best,
Cent

Quote:
Originally Posted by kbeeveer46 View Post
What I mean by broken image is that the image does not show at all on the story page. The red "X" appears as if the image is broken.
Reply With Quote
  #57 (permalink)  
Old 04-14-2007, 10:51 AM
Pligg Developer/Admin
Pligg Version: 0
Pligg Template: none
 
Join Date: Jun 2006
Location: Muncie, Indiana
Posts: 3,215
Until I can add this mod to the SVN we're going to have to figure out how to fix it so it doesn't break all the other javascript on Pligg sites. the jquery and thickbox js interfere will scriptaculous and prototype.

EDIT: I may have fixed it.

Last edited by kbeeveer46; 04-14-2007 at 10:55 AM.
Reply With Quote
  #58 (permalink)  
Old 04-14-2007, 12:44 PM
Constant Pligger
 
Join Date: Oct 2006
Posts: 220
I know Cent and KB are busy working out the kinks in this, but is there still a plan to add multiple image upload functionality to this mod? Is it still possible?
Reply With Quote
  #59 (permalink)  
Old 04-14-2007, 10:47 PM
Pligg Developer/Admin
Pligg Version: 0
Pligg Template: none
 
Join Date: Jun 2006
Location: Muncie, Indiana
Posts: 3,215
I have added this mod to the SVN code. If I may make a suggestion, I think that the #1 bug priority is to figure out how not to lose the image when you edit a story. Currently if you edit a story and you don't upload the same image during the edit process the previous image will be gone.
Reply With Quote
  #60 (permalink)  
Old 04-16-2007, 12:33 PM
Constant Pligger
 
Join Date: Oct 2006
Posts: 220
I had posted what i thought was a fix for the image being removed when you edit a post, but i just realized that my fix isn't working. If I get it working I'll post again.

Last edited by revolver; 04-16-2007 at 12:53 PM.
Reply With Quote
Reply

Thread Tools
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
Upload Module (File and Image Attachment) Yankidank Free Modules 268 02-03-2012 12:19 PM
[MOD] Image Upload Module (v1.0) -- Now Available cent Questions and Comments 190 01-08-2011 05:12 PM
[MOD] Image Upload Module (v0.93) -- Please test cent Questions and Comments 54 05-01-2009 11:12 PM
Image Upload Module -- Call for feature requests cent Questions and Comments 12 11-15-2008 01:13 PM
Image Upload / Image display with stories mod - Will pay for dev and share adampoots Questions and Comments 8 04-10-2007 08:22 PM


Pligg Modules and Pligg Templates from Pligg Pro Find support on the Pligg CMS Forum - 24 hours a day! Make a donation to support Pligg CMS development