Jump to content

Classified site with pics


dford

Recommended Posts

I have a classified website that has a script to allow the number of photos I choose to be included with thier ad.  The software that i have is under the GPL, so I can post it here.  Anyways the script allows uploads that keeps the original size of the photo on the server and resizes it when needed or viewed.  Problem is, the software craps out with large photos, the case with most new digital cameras.  So this leaves me at a disadvantage to competitors along with the fact that the developers are happy with their design and will not assist in changing it to resize photos on the fly to the predetermined size; say 500px wide.  This would elimate max file size settings in the software as the photos would be small enough to pass the say 1meg limit. Whew!

 

Ok so here is the script:  if it can't be done tell me and I will move on to other avenues.  So can this be modified to allow resizing when uploading?

 

 

{if $main_type == 'listing_edit'}

{* Template designers: if you want to use a totally different template file for edit

  listings, you would surround it with these if smart tags.  The same goes for classified,

  auction, and reverse_auction, just change 'listing_edit' as appropriate in the if stmt *}

{/if}

{if !$full_step && $error_msgs.cart_error}

<div class='cart_error'>{$error_msgs.cart_error}</div>

{/if}

{if $full_step === null}

<form action="{$process_form_url}" method="post" enctype="multipart/form-data" id="imageForm"

{if $uploading_image || $uploading_image_placeholder}

onsubmit="javascript: document.getElementById('loadingImage').src='{$uploading_image}';">

<script type="text/javascript">

loadingAnim = new Image();

loadingAnim.src = 'images/loading.gif';

</script>

{else}>

{/if}

{/if}

<!-- <input type="hidden" name="MAX_FILE_SIZE" value="{$old_config.maximum_upload_size}" /> -->

<table cellpadding="2" cellspacing="1" border="0" width="100%">

{if $full_step === null}

<tr class="place_ad_section_title">

<td>{$title1}</td>

</tr>

<tr class="page_title">

<td>{$title2}</td>

</tr>

<tr class="page_description">

<td>{$page_description}</td>

</tr>

{/if}

{if $uploading_image}

<tr class="page_description">

<td style="text-align: center;">

<img id="loadingImage" alt="" src="{$uploading_image_placeholder}" />

</td>

</tr>

{/if}

{if $error_msgs.images_error}

<tr class="error_message">

<td>{$error_msgs.images_error}</td>

</tr>

{/if}

{if count($images_captured) > 0}

<tr class="place_an_ad_instructions">

<td>{include file="images/display_images.tpl"}</td>

</tr>

{/if}

{if count($not_keys_yet) > 0}

<tr>

<td style="text-align: center;">

<table cellpadding="2" cellspacing="1" border="0" style="margin-left: auto; margin-right: auto; text-align: left;">

{if $old_config.allow_upload_images}

<tr class="image_upload_size">

<td> </td>

{if $old_config.allow_url_referenced}

<td> </td>

{/if}

<td class="image_upload_size">

{$messages[643]} {$old_config.maximum_upload_size}

</td>

<td class="image_upload_size"> </td>

</tr>

{/if}

<tr class="url_upload_field_labels">

<td> </td>

{if $old_config.allow_url_referenced}

<td>{$messages.166}</td>

{/if}

{if $old_config.allow_upload_images}

<td class="image_upload_field_labels">

{$messages[169]}

</td>

{/if}

<td>{$messages.500371}</td>

</tr>

{foreach from=$not_keys_yet item="img_key"}

<tr>

<td class="url_upload_field_labels"> {$img_key}) </td>

{if $old_config.allow_url_referenced}

<td class="url_upload_field_labels">

<input type="text" name="c[{$img_key}][location]" size="25" maxlength="100" />{if $img_key == 1} *{/if}

</td>

{/if}

{if $old_config.allow_upload_images}

<td class="image_upload_field_labels">

<input type="file" name="d[{$img_key}]" />{if $img_key == 1} *{/if}

</td>

{/if}

<td class="url_upload_field_labels">

<input type="text" name="c[{$img_key}][text]" size="25" maxlength="100" /> 

</td>

</tr>

{/foreach}

</table>

</td>

</tr>

{/if}

{if $full_step === null}

{if count($not_keys_yet) > 0}

<tr>

<td class="enter_images_button">

<input type="submit" name="submit" value="{$enter_images_txt}" class="enter_images_button" />

</td>

</tr>

{/if}

{if count($images_captured) > 0}

<tr>

<td class="enter_no_images_button">

<input type="submit" name="c[no_images]" value="{$back_txt}" class="enter_no_images_button" />

</td>

</tr>

{else}

<tr>

<td class="enter_no_images_button">

<input type="submit" name="c[no_images]" value="{$enter_no_images_txt}" class="enter_no_images_button" />

</td>

</tr>

{/if}

<tr>

<td class="end_sell_process_link" colspan="2">

<br /><br />

<a href="{$classifieds_url}?a=cart&action=cancel" class="end_sell_process_link">{$cancel_txt}</a>

</td>

</tr>

</table>

</form>

{else}

</table>

{if count($images_captured) >= $max}

<input type='hidden' name='c[no_images]' value='1' />

{/if}

{/if}

Link to comment
https://forums.phpfreaks.com/topic/138690-classified-site-with-pics/
Share on other sites

That's the Smarty Template file and does no work on any files. You will need to modify the code behind the file-handler to resize files.

 

It's perfectly possible to do, but not if you don't know PHP fairly well. You could always ask the original developers where file uploads are handled and make your modifications there.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.