1 of 2
1
Insert URL not Link into Custom-Field
Posted: 04 June 2008 12:26 AM   [ Ignore ]
Jr. Member
RankRank
Total Posts:  33
Joined  2007-09-04

hi folks

i’m very confused: i use the File-Upload-Module on my own site and on one of my customers.

now if i upload a file on the customer-site and place the image into the custom-field (type="hidden") the EE-URL (f.ex. «{filedir_12}test.png») has been placed into this field…

now if i upload a fiel on my own site and place the image into the custom-field (type="text") the Link (f.ex. < img src = “{filedir_12}test.png” alt… / >) has been placed into this field…

BUT i need only the URL (as it does on the customer-site, but i can’t change the field-type to hidden! it has to be text) … where can i set this pref? I haven’t change anything neither on the customter nor on my own site hmmm

Profile
 
 
Posted: 04 June 2008 06:53 AM   [ Ignore ]   [ # 1 ]
Administrator
Avatar
RankRankRankRank
Total Posts:  3351
Joined  2006-10-18

Stefan,

There’s no clean way of doing this… as File Upload takes this functionality from a native EE function.

You can hack it though… it appears to be located in cp.publish.php
You’ll need to just strip out the “img” html from the generation process smile
NOTE: this would effect ALL functionality of this across your website, including the CP.

In ExpressionEngine 1.6.x, around line 9830:

if ($data['is_image'== 1)
  
{  
   $imgsrc 
'<img src="'.$file_url.'"'.$properties;
   
   
$wh '';
   
   if (
function_exists('getimagesize')) 
   
{
$imgdim 
= @getimagesize($query->row['server_path'].$data['file_name']);

if (
is_array($imgdim)) 
{
  $imgsrc 
.= " width=\"".$imgdim['0']."\" height=\"".$imgdim['1']."\"";
  
$wh "width=".($imgdim['0']+15).",height=".($imgdim['1']+15).",";
}

if (isset($data['orig_name']) AND $data['orig_name'!= '')
{
  $imgdim 
= @getimagesize($query->row['server_path'].$data['orig_name']);
  
  if (
is_array($imgdim)) 
  
{
   $wh 
"width=".($imgdim['0']+15).",height=".($imgdim['1']+15).",";
  

}

   }
   
   $imgsrc 
.= " />";

She’s all yours though rasberry

 Signature 
Profile
 
 
Posted: 04 June 2008 07:01 AM   [ Ignore ]   [ # 2 ]
Jr. Member
RankRank
Total Posts:  33
Joined  2007-09-04

thx - that means if i upload and place a File via CP the «as Link» instead of «as URL» will also paste only the URL instead of the Link? did you that mean with «effect ALL functionality» or are there other functions effected to?

Profile
 
 
Posted: 04 June 2008 07:02 AM   [ Ignore ]   [ # 3 ]
Jr. Member
RankRank
Total Posts:  33
Joined  2007-09-04

btw: i cant php - can you say me, where exactly to add /* and */ ?

Profile
 
 
Posted: 04 June 2008 07:03 AM   [ Ignore ]   [ # 4 ]
Administrator
Avatar
RankRankRankRank
Total Posts:  3351
Joined  2006-10-18
Stefan Rechsteiner - 04 June 2008 07:01 AM

that means if i upload and place a File via CP the «as Link» instead of «as URL» will also paste only the URL instead of the Link?

Correct smile

Stefan Rechsteiner - 04 June 2008 07:01 AM

did you that mean with «effect ALL functionality» or are there other functions effected to?

No, it only affects as mentioned above. It will not hurt anything else wink

 Signature 
Profile
 
 
Posted: 04 June 2008 07:39 AM   [ Ignore ]   [ # 5 ]
Administrator
Avatar
RankRankRankRank
Total Posts:  3351
Joined  2006-10-18

Ok,

Two places actually: smile

You’ll need to just strip out the “img” html from the generation process
NOTE: this would effect ALL functionality of this across your website, including the CP.
(re-iterating for reference for other visitors)

In cp.publish.php in ExpressionEngine 1.6.x, around line 9833:

Change:

if ($data['is_image'== 1)
  
{  
   $imgsrc 
'<img src="'.$file_url.'"'.$properties;
   
   
$wh '';
   
   if (
function_exists('getimagesize')) 
   
{
$imgdim 
= @getimagesize($query->row['server_path'].$data['file_name']);

if (
is_array($imgdim)) 
{
  $imgsrc 
.= " width=\"".$imgdim['0']."\" height=\"".$imgdim['1']."\"";
  
$wh "width=".($imgdim['0']+15).",height=".($imgdim['1']+15).",";
}

if (isset($data['orig_name']) AND $data['orig_name'!= '')
{
  $imgdim 
= @getimagesize($query->row['server_path'].$data['orig_name']);
  
  if (
is_array($imgdim)) 
  
{
   $wh 
"width=".($imgdim['0']+15).",height=".($imgdim['1']+15).",";
  

}

   }
   
   $imgsrc 
.= " />";

To:

if ($data['is_image'== 1)
  
{  
   $imgsrc 
''.$file_url.''.$properties;
   
   
$wh '';
   
   if (
function_exists('getimagesize')) 
   
{
 $imgdim 
= @getimagesize($query->row['server_path'].$data['file_name']);
 
 if (
is_array($imgdim)) 
 
{
  $imgsrc 
.= "";
  
$wh "width=".($imgdim['0']+15).",height=".($imgdim['1']+15).",";
 
}
 
 
if (isset($data['orig_name']) AND $data['orig_name'!= '')
 
{
  $imgdim 
= @getimagesize($query->row['server_path'].$data['orig_name']);
  
  if (
is_array($imgdim)) 
  
{
   $wh 
"width=".($imgdim['0']+15).",height=".($imgdim['1']+15).",";
  

 }
 
   }
   
   $imgsrc 
.= "";

In cp.publish.php in ExpressionEngine 1.6.x, around line 9894:

Change:

function fileplacer() 
  
{
   
if (document.upload.style[1].checked)
   
{
 
var file '<?php echo $file_url; ?>';
   
}
   
else if (document.upload.nonimage.value == 'yes'
   
{
 
var file '<?php echo $props; ?>';
   
}
   
else
   
{
 
if (document.upload.style[0].checked
 
{
  
var file '<?php echo $props; ?>';
 
}
 
else if (document.upload.style[2].checked
 
{
  
var file '<?php echo $popup_link; ?>';
 
}
 
else
 
{
  
var file '<?php echo $popup_thumb; ?>';
 
}
   }

To:

function fileplacer() 
  
{
   
if (document.upload.style[0].checked)
   
{
 
var file '<?php echo $file_url; ?>';
   
}
   
else if (document.upload.nonimage.value == 'yes'
   
{
 
var file '<?php echo $props; ?>';
   
}
   
else
   
{
 
if (document.upload.style[0].checked
 
{
  
var file '<?php echo $props; ?>';
 
}
 
else if (document.upload.style[2].checked
 
{
  
var file '<?php echo $popup_link; ?>';
 
}
 
else
 
{
  
var file '<?php echo $popup_thumb; ?>';
 
}
   }

(notice the first document.upload.style[1].checked changes to document.upload.style[0].checked - notice the 0 instead of 1)

 Signature 
Profile
 
 
Posted: 04 June 2008 07:50 AM   [ Ignore ]   [ # 6 ]
Jr. Member
RankRank
Total Posts:  33
Joined  2007-09-04

thank you very much! BUT it hasn’t changed! hmmm

did i have to delete some cache or so? (did so in CP - nothing changed)

Profile
 
 
Posted: 04 June 2008 07:56 AM   [ Ignore ]   [ # 7 ]
Administrator
Avatar
RankRankRankRank
Total Posts:  3351
Joined  2006-10-18
Stefan Rechsteiner - 04 June 2008 07:50 AM

(did so in CP - nothing changed)

It didn’t work in the CP either?

 Signature 
Profile
 
 
Posted: 04 June 2008 08:09 AM   [ Ignore ]   [ # 8 ]
Jr. Member
RankRank
Total Posts:  33
Joined  2007-09-04

no - everything is the same as bevore! hmmm

Profile
 
 
Posted: 04 June 2008 08:15 AM   [ Ignore ]   [ # 9 ]
Administrator
Avatar
RankRankRankRank
Total Posts:  3351
Joined  2006-10-18

Hehe, this might sound like a stupid question, but are you sure you saved uploaded the revised file? Could you do it again for the sake of it? LOL

 Signature 
Profile
 
 
Posted: 04 June 2008 08:24 AM   [ Ignore ]   [ # 10 ]
Jr. Member
RankRank
Total Posts:  33
Joined  2007-09-04

hehe, «of course i did» … grin

Profile
 
 
Posted: 05 June 2008 06:25 AM   [ Ignore ]   [ # 11 ]
Administrator
Avatar
RankRankRankRank
Total Posts:  3351
Joined  2006-10-18

I see.... didn’t work for me in the SAEF either… (but did in the CP)

Back to the drawing boards…

I’ll have to dig deeper into this one.... I’ll get back to you shortly smile

 Signature 
Profile
 
 
Posted: 05 June 2008 11:24 AM   [ Ignore ]   [ # 12 ]
Jr. Member
RankRank
Total Posts:  33
Joined  2007-09-04

would be great! grin *g*

Profile
 
 
Posted: 09 June 2008 12:12 AM   [ Ignore ]   [ # 13 ]
Jr. Member
RankRank
Total Posts:  33
Joined  2007-09-04
Pie Man - 05 June 2008 06:25 AM

I see.... didn’t work for me in the SAEF either… (but did in the CP)

Back to the drawing boards…

I’ll have to dig deeper into this one.... I’ll get back to you shortly smile

have you found something? hmmm

Profile
 
 
Posted: 09 June 2008 07:50 AM   [ Ignore ]   [ # 14 ]
Administrator
Avatar
RankRankRankRank
Total Posts:  3351
Joined  2006-10-18

Stefan,

I haven’t had a chance yet, but I will make sure I have a look by tomorrow smile

Thank you for your patience wink

 Signature 
Profile
 
 
Posted: 10 June 2008 10:43 AM   [ Ignore ]   [ # 15 ]
Jr. Member
RankRank
Total Posts:  33
Joined  2007-09-04
Pie Man - 09 June 2008 07:50 AM

I haven’t had a chance yet, but I will make sure I have a look by tomorrow smile

would be great! grin thx.

Profile
 
 
   
1 of 2
1