CodeCharge Studio
search Register Login  

Visual PHP Web Development

Visually Create Internationalized Web Applications, Web Reports, Calendars, and more.
CodeCharge.com

YesSoftware Forums -> Archive -> GotoCode Archive

 default image if picture null

Print topic Send  topic

Author Message
Zye
Posted: 05/20/2003, 2:03 PM

Why won't my code work?
The page runs OK on the server without errors - PHP/MySQL using CCS 2.0.6.10

I put the code in the Beforeshow event of an image called picture on Grid form:

global $live;
if ($live->picture->GetValue() == "0") {
$live->picture->SetValue($live->picture->GetValue(). "<img src=images/noimageavail.gif>");
}

I have searched these forums, newsgroup and codechargers for days.
Is there a better solution? .... Indeed what is the solution? .... I am fading fast .... Still can't get a grip of CCS 2 logic ..... Help!

Default image if picture = null;
Zye
Posted: 05/25/2003, 12:33 PM

Bump!!

Nobody loves me :(

Maybe it's my presentation....
rclayh
Posted: 05/25/2003, 6:10 PM

global $live;
if ($live->picture->GetValue() == "0") {
$live->picture->SetValue("<img src=images/noimageavail.gif>");
}
Zye
Posted: 10/29/2003, 1:30 PM

Thanks for your help rclayh ... very belated though LoL.

I inserted your code into 'Before Show' event of the image
and 'On Initialize View' of the page and no joy.

Duh! I must be missing the plot.

Is there any way I can show a default image if no image is chosen for an article.

Helppppp! Thanks again. Just restarted project with a few questions not solved.
Zye
Posted: 10/29/2003, 2:57 PM

Dark Master posted a solution:
http://www.gotocode.com/disc_viewt.asp?mid=21630&s_topic=default+image&

Which goes ...

global $form_name;
if( !$form_name->image_control->GetValue()
|| !file_exists($form_name->image_control->GetValue()) )
{
$employees->picture->SetValue("defaults/noimage.gif");
}

Works! but even if an image value is chosen or not, it places the defaut image on every entry.

Does anyone know how to fix this, unless it's me again.

Thanks!
Zye
Posted: 10/29/2003, 5:46 PM

Got it to work by eliminating the exclamation mark (! logical operator) next to file_exists.

global $form_name;
if(!$form_name->image_control->GetValue()
|| file_exists($artiste->image_control->GetValue()) )
{
$form_name->image_control->SetValue("../default/noimageavail.gif");
}

Cheers!

   


These are Community Forums for users to exchange information.
If you would like to obtain technical product help please visit http://support.yessoftware.com.

MS Access to Web

Convert MS Access to Web.
Join thousands of Web developers who build Web applications with minimal coding.

CodeCharge.com

Home   |    Search   |    Members   |    Register   |    Login


Powered by UltraApps Forum created with CodeCharge Studio
Copyright © 2003-2004 by UltraApps.com  and YesSoftware, Inc.